commit b93ddc6b5ebb76fbe0a4beb73901ad2c4c7e8ca8
parent 47e648bd2667c2d2ef742154d2399b3a520a4cdf
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date: Sun, 4 Jun 2017 13:50:21 +0300
MHD_cleanup_connections(): improved thread safety
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
@@ -3195,8 +3195,6 @@ MHD_cleanup_connections (struct MHD_Daemon *daemon)
if (NULL != pos->tls_session)
gnutls_deinit (pos->tls_session);
#endif /* HTTPS_SUPPORT */
- daemon->connections--;
- daemon->at_limit = false;
/* clean up the connection */
if (NULL != daemon->notify_connection)
@@ -3247,6 +3245,8 @@ MHD_cleanup_connections (struct MHD_Daemon *daemon)
free (pos);
MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex);
+ daemon->connections--;
+ daemon->at_limit = false;
}
MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex);
}