commit 6d8b65a9c1ba39a7b2e78723bb7cfb2e8fba68e6
parent d71b91554d5d123372a6ab06824002d20be14590
Author: Christian Grothoff <christian@grothoff.org>
Date: Wed, 25 Aug 2010 20:32:18 +0000
maybe better fix
Diffstat:
1 file changed, 15 insertions(+), 20 deletions(-)
diff --git a/src/daemon/daemon.c b/src/daemon/daemon.c
@@ -351,18 +351,16 @@ recv_tls_adapter (struct MHD_Connection *connection, void *other, size_t i)
{
int res;
res = gnutls_record_recv (connection->tls_session, other, i);
- if (res != GNUTLS_E_AGAIN)
- return res;
- else
- {
- while (res == GNUTLS_E_AGAIN)
- {
- res = gnutls_record_recv (connection->tls_session, other, i);
- }
- return res;
- }
+ if ( (res == GNUTLS_E_AGAIN) ||
+ (res == GNUTLS_E_INTERRUPTED) )
+ {
+ errno = EINTR;
+ return -1;
+ }
+ return res;
}
+
/**
* Callback for writing data to the socket.
*
@@ -377,16 +375,13 @@ send_tls_adapter (struct MHD_Connection *connection,
{
int res;
res = gnutls_record_send (connection->tls_session, other, i);
- if (res != GNUTLS_E_AGAIN)
- return res;
- else
- {
- while (res == GNUTLS_E_AGAIN)
- {
- res = gnutls_record_send (connection->tls_session, other, i);
- }
- return res;
- }
+ if ( (res == GNUTLS_E_AGAIN) ||
+ (res == GNUTLS_E_INTERRUPTED) )
+ {
+ errno = EINTR;
+ return -1;
+ }
+ return res;
}