From fcf8127533ad1cef4447ef420cf722b85347e227 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Thu, 27 Oct 2011 12:17:14 +0000 Subject: LRN: treat EAGAIN as EINTR --- ChangeLog | 3 +++ src/daemon/connection.c | 10 +++++----- src/daemon/daemon.c | 5 ++--- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index bea4ddad..6018d463 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +Thu Oct 27 14:16:34 CEST 2011 + Treat EAGAIN the same way as EINTR (helps on W32). -LRN + Wed Oct 12 10:40:12 CEST 2011 Made sockets blocking again for non-Linux platforms as non-blocking sockets cause problems (#1824) on Cygwin but offer better performance diff --git a/src/daemon/connection.c b/src/daemon/connection.c index 5c2106ee..c75c0aee 100644 --- a/src/daemon/connection.c +++ b/src/daemon/connection.c @@ -277,7 +277,7 @@ need_100_continue (struct MHD_Connection *connection) return ((connection->response == NULL) && (connection->version != NULL) && - (0 == strcasecmp (connection->version, + (0 == strcasecmp (connection->version, MHD_HTTP_VERSION_1_1)) && (NULL != (expect = MHD_lookup_connection_value (connection, MHD_HEADER_KIND, @@ -1463,7 +1463,7 @@ do_read (struct MHD_Connection *connection) connection->read_buffer_offset); if (bytes_read < 0) { - if (errno == EINTR) + if ((errno == EINTR) || (errno == EAGAIN)) return MHD_NO; #if HAVE_MESSAGES #if HTTPS_SUPPORT @@ -1510,7 +1510,7 @@ do_write (struct MHD_Connection *connection) if (ret < 0) { - if (errno == EINTR) + if ((errno == EINTR) || (errno == EAGAIN)) return MHD_NO; #if HAVE_MESSAGES #if HTTPS_SUPPORT @@ -1836,7 +1836,7 @@ MHD_connection_handle_write (struct MHD_Connection *connection) connection->continue_message_write_offset); if (ret < 0) { - if (errno == EINTR) + if ((errno == EINTR) || (errno == EAGAIN)) break; #if HAVE_MESSAGES MHD_DLOG (connection->daemon, @@ -1898,7 +1898,7 @@ MHD_connection_handle_write (struct MHD_Connection *connection) pthread_mutex_unlock (&response->mutex); if (ret < 0) { - if (errno == EINTR) + if ((errno == EINTR) || (errno == EAGAIN)) return MHD_YES; #if HAVE_MESSAGES MHD_DLOG (connection->daemon, diff --git a/src/daemon/daemon.c b/src/daemon/daemon.c index 1f6ca050..280d7789 100644 --- a/src/daemon/daemon.c +++ b/src/daemon/daemon.c @@ -751,11 +751,10 @@ send_param_adapter (struct MHD_Connection *connection, (size_t) left); if (ret != -1) return ret; - if (EINTR == errno) + if ((EINTR == errno) || (EAGAIN == errno)) return 0; if ( (EINVAL == errno) || - (EBADF == errno) || - (EAGAIN == errno) ) + (EBADF == errno) ) return -1; /* None of the 'usual' sendfile errors occurred, so we should try to fall back to 'SEND'; see also this thread for info on -- cgit v1.2.3