aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeny Grin (Karlson2k) <k2k@narod.ru>2017-03-15 21:34:59 +0300
committerEvgeny Grin (Karlson2k) <k2k@narod.ru>2017-03-15 21:34:59 +0300
commitafb221c32aeeb2731e3b5362cc4ff8949d34edea (patch)
treea5296cef10df2a1b275f624357f47771da8cb9d0
parentb8a3977d58c58ae42762aabefff8841eabeb49c1 (diff)
downloadlibmicrohttpd-afb221c32aeeb2731e3b5362cc4ff8949d34edea.tar.gz
libmicrohttpd-afb221c32aeeb2731e3b5362cc4ff8949d34edea.zip
Improved thread-safety with suspended connections.
-rw-r--r--src/microhttpd/connection.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index 0d55fb3c..40182c4e 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -2404,7 +2404,8 @@ int
2404MHD_connection_handle_read (struct MHD_Connection *connection) 2404MHD_connection_handle_read (struct MHD_Connection *connection)
2405{ 2405{
2406 update_last_activity (connection); 2406 update_last_activity (connection);
2407 if (MHD_CONNECTION_CLOSED == connection->state) 2407 if ( (MHD_CONNECTION_CLOSED == connection->state) ||
2408 (connection->suspended) )
2408 return MHD_YES; 2409 return MHD_YES;
2409 /* make sure "read" has a reasonable number of bytes 2410 /* make sure "read" has a reasonable number of bytes
2410 in buffer to use per system call (if possible) */ 2411 in buffer to use per system call (if possible) */
@@ -2474,6 +2475,8 @@ MHD_connection_handle_write (struct MHD_Connection *connection)
2474{ 2475{
2475 struct MHD_Response *response; 2476 struct MHD_Response *response;
2476 ssize_t ret; 2477 ssize_t ret;
2478 if (connection->suspended)
2479 return MHD_YES;
2477 2480
2478 update_last_activity (connection); 2481 update_last_activity (connection);
2479 while (1) 2482 while (1)