libmicrohttpd

HTTP/1.x server C library (MHD 1.x, stable)
Log | Files | Refs | Submodules | README | LICENSE

commit afb221c32aeeb2731e3b5362cc4ff8949d34edea
parent b8a3977d58c58ae42762aabefff8841eabeb49c1
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date:   Wed, 15 Mar 2017 21:34:59 +0300

Improved thread-safety with suspended connections.

Diffstat:
Msrc/microhttpd/connection.c | 5++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c @@ -2404,7 +2404,8 @@ int MHD_connection_handle_read (struct MHD_Connection *connection) { update_last_activity (connection); - if (MHD_CONNECTION_CLOSED == connection->state) + if ( (MHD_CONNECTION_CLOSED == connection->state) || + (connection->suspended) ) return MHD_YES; /* make sure "read" has a reasonable number of bytes in buffer to use per system call (if possible) */ @@ -2474,6 +2475,8 @@ MHD_connection_handle_write (struct MHD_Connection *connection) { struct MHD_Response *response; ssize_t ret; + if (connection->suspended) + return MHD_YES; update_last_activity (connection); while (1)