[gnutls-devel] GnuTLS | Nonblocking Sockets and GNUTLS_E_AGAIN (#1251)

Read-only notification of GnuTLS library development activities gnutls-devel at lists.gnutls.org
Wed Jun 30 02:42:25 CEST 2021

Cinolt Yuklair created an issue: https://gitlab.com/gnutls/gnutls/-/issues/1251

Nonblocking socket operation is crucial for many applications, for example when simultaneously handling many socket connections.

When handling a connection, it is necessary for the program to know when there is no more data to be read from the socket.

With traditional sockets, the recv(2) system call indicates this case with the EAGAIN errno code.

With GnuTLS, (when using gnutls_transport_set_int and default pull/push functions) there is the GNUTLS_E_AGAIN error code, which works some of the time, however I've noticed that there are certain cases when gnutls_record_recv will return this error code even when data has not been exhausted from the connection.

Therefore, there is no way for the program to reliably know when data has been exhausted from the connection.

In my opinion, gnutls_record_recv should return GNUTLS_E_AGAIN in the exact same semantics that recv returns EAGAIN. I don't see a reason why there are "extra" cases where GNUTLS_E_AGAIN is returned. In these cases, the program will think there is no more data and not handle connections correctly.

Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/gnutls/-/issues/1251
You're receiving this email because of your account on gitlab.com.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gnupg.org/pipermail/gnutls-devel/attachments/20210630/b3187804/attachment.html>

More information about the Gnutls-devel mailing list