libmicrohttpd

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

commit 9b083f8fbedf821dfa2f60f590d1d8767f0c948c
parent 8b0e534ac401da8187e67568e392d7635bf0c747
Author: Christian Grothoff <christian@grothoff.org>
Date:   Sat,  5 Dec 2015 16:31:45 +0000

aggressively close sockets in multi-threaded operation

Diffstat:
MChangeLog | 6+++++-
Msrc/microhttpd/daemon.c | 10+++++++++-
2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -1,8 +1,12 @@ +Sat Dec 5 17:30:45 CET 2015 + Close sockets more aggressively in multi-threaded + mode (possibly relevant for idle servers). -CG + Fri Dec 4 13:53:05 CET 2015 Releasing libmicrohttpd 0.9.47. -CG Thu Dec 3 18:21:44 CET 2015 - Reworked VS project files. Used x64 build tools by + Reworked VS project files. Used x64 build tools by default, many optimizations, fixes. Added project files for VS 2015. -EG diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c @@ -1027,7 +1027,15 @@ exit: con, &con->socket_context, MHD_CONNECTION_NOTIFY_CLOSED); - + if (MHD_INVALID_SOCKET != con->socket_fd) + { +#ifdef WINDOWS + shutdown (con->socket_fd, SHUT_WR); +#endif + if (0 != MHD_socket_close_ (con->socket_fd)) + MHD_PANIC ("close failed\n"); + con->socket_fd = MHD_INVALID_SOCKET; + } return (MHD_THRD_RTRN_TYPE_) 0; }