On Thu, 30 Jun 2016, Tim Ruehsen wrote:
I believe, we already handle that case. If GNUTLS_E_INTERRUPTED occurs, we restart the loop and re-enter gnutls_handshake(). This happens for all non-fatal errors.
Right, but then it won't wait for the socket and just busy-loop. The gnutls_record_get_direction man page[*] seems to suggest that waiting for the socket is the appropriate way:
This function provides information about the internals of the record protocol and is only useful if a prior gnutls function call (e.g. gnutls_handshake()) was interrupted for some reason, that is, if a function returned GNUTLS_E_INTERRUPTED or GNUTLS_E_AGAIN. In such a case, you might want to call select() or poll() before calling the interrupted gnutls function again [*] = http://linux.die.net/man/3/gnutls_record_get_direction -- / daniel.haxx.se