From 70ca8aaaea43d209e30d4ce87f22184aa8cc9bb5 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 10 Nov 2015 14:27:57 +0000 Subject: [PATCH] Hi folks, I guess i found a problem with suspended connections. There is a scenarion where one can resume a connection and then stop the daemon without gives the daemon the oportunity to really resume the connection. In this case, microhttpd will abort telling one that there is suspended connection (because the connection is still in the daemon's suspended list). The following patch solves the problem (i've this problem using external mainloop). Regards, Flavio Ceolin --- ChangeLog | 4 ++++ src/include/microhttpd.h | 2 +- src/microhttpd/daemon.c | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index aea47a80..df3fa00d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Tue Nov 10 15:25:48 CET 2015 + Fix issue with shutdown if connection was resumed just + before shutdown. -FC + Fri Nov 6 22:54:38 CET 2015 Fixing the buffer shrinkage issue, this time with test. -CG Releasing libmicrohttpd 0.9.46. -CG diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h index 1b9b8494..42bcb191 100644 --- 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 0x00094601 +#define MHD_VERSION 0x00094602 /** * MHD-internal return code for "YES". diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c index 6a691746..37257db5 100644 --- a/src/microhttpd/daemon.c +++ b/src/microhttpd/daemon.c @@ -4489,6 +4489,9 @@ MHD_stop_daemon (struct MHD_Daemon *daemon) if (NULL == daemon) return; + + if (0 != (MHD_USE_SUSPEND_RESUME & daemon->options)) + resume_suspended_connections (daemon); daemon->shutdown = MHD_YES; fd = daemon->socket_fd; daemon->socket_fd = MHD_INVALID_SOCKET;