aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-10-27 12:17:14 +0000
committerChristian Grothoff <christian@grothoff.org>2011-10-27 12:17:14 +0000
commitfcf8127533ad1cef4447ef420cf722b85347e227 (patch)
tree356d98527c7a069255c82a391b1aa2ce7392ea35
parent15927a0e8932afb4711faca8ab840e52e8626da7 (diff)
downloadlibmicrohttpd-fcf8127533ad1cef4447ef420cf722b85347e227.tar.gz
libmicrohttpd-fcf8127533ad1cef4447ef420cf722b85347e227.zip
LRN: treat EAGAIN as EINTR
-rw-r--r--ChangeLog3
-rw-r--r--src/daemon/connection.c10
-rw-r--r--src/daemon/daemon.c5
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 @@
1Thu Oct 27 14:16:34 CEST 2011
2 Treat EAGAIN the same way as EINTR (helps on W32). -LRN
3
1Wed Oct 12 10:40:12 CEST 2011 4Wed Oct 12 10:40:12 CEST 2011
2 Made sockets blocking again for non-Linux platforms as non-blocking 5 Made sockets blocking again for non-Linux platforms as non-blocking
3 sockets cause problems (#1824) on Cygwin but offer better performance 6 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)
277 277
278 return ((connection->response == NULL) && 278 return ((connection->response == NULL) &&
279 (connection->version != NULL) && 279 (connection->version != NULL) &&
280 (0 == strcasecmp (connection->version, 280 (0 == strcasecmp (connection->version,
281 MHD_HTTP_VERSION_1_1)) && 281 MHD_HTTP_VERSION_1_1)) &&
282 (NULL != (expect = MHD_lookup_connection_value (connection, 282 (NULL != (expect = MHD_lookup_connection_value (connection,
283 MHD_HEADER_KIND, 283 MHD_HEADER_KIND,
@@ -1463,7 +1463,7 @@ do_read (struct MHD_Connection *connection)
1463 connection->read_buffer_offset); 1463 connection->read_buffer_offset);
1464 if (bytes_read < 0) 1464 if (bytes_read < 0)
1465 { 1465 {
1466 if (errno == EINTR) 1466 if ((errno == EINTR) || (errno == EAGAIN))
1467 return MHD_NO; 1467 return MHD_NO;
1468#if HAVE_MESSAGES 1468#if HAVE_MESSAGES
1469#if HTTPS_SUPPORT 1469#if HTTPS_SUPPORT
@@ -1510,7 +1510,7 @@ do_write (struct MHD_Connection *connection)
1510 1510
1511 if (ret < 0) 1511 if (ret < 0)
1512 { 1512 {
1513 if (errno == EINTR) 1513 if ((errno == EINTR) || (errno == EAGAIN))
1514 return MHD_NO; 1514 return MHD_NO;
1515#if HAVE_MESSAGES 1515#if HAVE_MESSAGES
1516#if HTTPS_SUPPORT 1516#if HTTPS_SUPPORT
@@ -1836,7 +1836,7 @@ MHD_connection_handle_write (struct MHD_Connection *connection)
1836 connection->continue_message_write_offset); 1836 connection->continue_message_write_offset);
1837 if (ret < 0) 1837 if (ret < 0)
1838 { 1838 {
1839 if (errno == EINTR) 1839 if ((errno == EINTR) || (errno == EAGAIN))
1840 break; 1840 break;
1841#if HAVE_MESSAGES 1841#if HAVE_MESSAGES
1842 MHD_DLOG (connection->daemon, 1842 MHD_DLOG (connection->daemon,
@@ -1898,7 +1898,7 @@ MHD_connection_handle_write (struct MHD_Connection *connection)
1898 pthread_mutex_unlock (&response->mutex); 1898 pthread_mutex_unlock (&response->mutex);
1899 if (ret < 0) 1899 if (ret < 0)
1900 { 1900 {
1901 if (errno == EINTR) 1901 if ((errno == EINTR) || (errno == EAGAIN))
1902 return MHD_YES; 1902 return MHD_YES;
1903#if HAVE_MESSAGES 1903#if HAVE_MESSAGES
1904 MHD_DLOG (connection->daemon, 1904 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,
751 (size_t) left); 751 (size_t) left);
752 if (ret != -1) 752 if (ret != -1)
753 return ret; 753 return ret;
754 if (EINTR == errno) 754 if ((EINTR == errno) || (EAGAIN == errno))
755 return 0; 755 return 0;
756 if ( (EINVAL == errno) || 756 if ( (EINVAL == errno) ||
757 (EBADF == errno) || 757 (EBADF == errno) )
758 (EAGAIN == errno) )
759 return -1; 758 return -1;
760 /* None of the 'usual' sendfile errors occurred, so we should try 759 /* None of the 'usual' sendfile errors occurred, so we should try
761 to fall back to 'SEND'; see also this thread for info on 760 to fall back to 'SEND'; see also this thread for info on