libmicrohttpd

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

commit 4d997941e33acfb57d9da7b560a81f94f0051796
parent 7eba79ea8607e1498fdc23a7045fe04f79c0daf5
Author: Christian Grothoff <christian@grothoff.org>
Date:   Sat, 27 Jun 2015 20:19:25 +0000

fix late counter-decrement issue reported by MD on the mailinglist

Diffstat:
MChangeLog | 9+++++++++
Msrc/include/microhttpd.h | 2+-
Msrc/microhttpd/daemon.c | 4++--
3 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -1,3 +1,12 @@ +Sat Jun 27 22:16:27 CEST 2015 + Make sure to decrement connection counter before + calling connection notifier so that + MHD_DAEMON_INFO_CURRENT_CONNECTIONS does not + present stale information (relevant if this is + used for termination detection of a daemon + stopped via MHD_quiesce_daemon()). Thanks to + Markus Doppelbauer for reporting. -CG + Fri Jun 26 23:17:20 CEST 2015 Fix (automatic) handling of HEAD requests with MHD_create_response_from_callback() and HTTP/1.1 diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h @@ -130,7 +130,7 @@ typedef intptr_t ssize_t; * Current version of the library. * 0x01093001 = 1.9.30-1. */ -#define MHD_VERSION 0x00094205 +#define MHD_VERSION 0x00094206 /** * MHD-internal return code for "YES". diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c @@ -1019,7 +1019,7 @@ exit: &con->socket_context, MHD_CONNECTION_NOTIFY_CLOSED); - return (MHD_THRD_RTRN_TYPE_)0; + return (MHD_THRD_RTRN_TYPE_) 0; } @@ -2039,6 +2039,7 @@ MHD_cleanup_connections (struct MHD_Daemon *daemon) if (NULL != pos->tls_session) gnutls_deinit (pos->tls_session); #endif + daemon->connections--; if (NULL != daemon->notify_connection) daemon->notify_connection (daemon->notify_connection_cls, pos, @@ -2087,7 +2088,6 @@ MHD_cleanup_connections (struct MHD_Daemon *daemon) if (NULL != pos->addr) free (pos->addr); free (pos); - daemon->connections--; } if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) && (MHD_YES != MHD_mutex_unlock_ (&daemon->cleanup_connection_mutex)) )