[Help-gnutls] gnutls_bye(), return values, and looping

Joe Shaw joe at ximian.com
Fri Jan 30 19:44:28 CET 2004


Hi,

I am a little confused about how exactly to handle the return values
from gnutls_bye().  I have some code which does the following:

        do {
        	ret = gnutls_bye (chan->session, GNUTLS_SHUT_RDWR);
        } while (ret == GNUTLS_E_INTERRUPTED ||
        	 ret == GNUTLS_E_AGAIN);
        
In almost every case, this works out just fine, and I can close the file
descriptor after that.

I'm running into a problem on one of our test machines, though, that
gnutls_bye() always returns GNUTLS_E_AGAIN, causing an infinite loop and
using 100% CPU.

Searching through google and the GnuTLS docs, it looks like most uses of
gnutls_bye() ignore the return value, even if it's INTERRUPTED or AGAIN
and immediately closes the fd after that.  What is the correct way?

Perhaps more importantly, is there any steadfast reason why it'd always
return AGAIN?  Could it be a bug in GnuTLS that removing my do-while
would really just be papering over?  Any info would be helpful.

Thanks,
Joe






More information about the Gnutls-help mailing list