aboutsummaryrefslogtreecommitdiff
path: root/src/microhttpd/daemon.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-04-04 15:50:15 +0000
committerChristian Grothoff <christian@grothoff.org>2015-04-04 15:50:15 +0000
commit47c6b680069bd2e0c174151d3078e60cc3b043d7 (patch)
tree441536c8294d876efdd14de7c96518742ace8116 /src/microhttpd/daemon.c
parent7d1a24e75480f07c644b1d5444c9755d79137067 (diff)
downloadlibmicrohttpd-47c6b680069bd2e0c174151d3078e60cc3b043d7.tar.gz
libmicrohttpd-47c6b680069bd2e0c174151d3078e60cc3b043d7.zip
fix thread-pool connection-limit shutdown issue, adding testcase
Diffstat (limited to 'src/microhttpd/daemon.c')
-rw-r--r--src/microhttpd/daemon.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index 7f4449e5..bdf08e00 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -2224,9 +2224,13 @@ MHD_select (struct MHD_Daemon *daemon,
2224 return MHD_NO; 2224 return MHD_NO;
2225 2225
2226 /* If we're at the connection limit, no need to 2226 /* If we're at the connection limit, no need to
2227 accept new connections. */ 2227 accept new connections; however, make sure
2228 if ( (daemon->connections == daemon->connection_limit) && 2228 we do not miss the shutdown, so only do this
2229 (MHD_INVALID_SOCKET != daemon->socket_fd) ) 2229 optimization if we have a shutdown signaling
2230 pipe. */
2231 if ( (MHD_INVALID_SOCKET != daemon->socket_fd) &&
2232 (daemon->connections == daemon->connection_limit) &&
2233 (0 != (daemon->options & MHD_USE_PIPE_FOR_SHUTDOWN)) )
2230 FD_CLR (daemon->socket_fd, &rs); 2234 FD_CLR (daemon->socket_fd, &rs);
2231 } 2235 }
2232 else 2236 else
@@ -2672,7 +2676,7 @@ MHD_epoll (struct MHD_Daemon *daemon,
2672 while ( (MHD_YES == MHD_accept_connection (daemon)) && 2676 while ( (MHD_YES == MHD_accept_connection (daemon)) &&
2673 (daemon->connections < daemon->connection_limit) && 2677 (daemon->connections < daemon->connection_limit) &&
2674 (series_length < 128) ) 2678 (series_length < 128) )
2675 series_length++; 2679 series_length++;
2676 } 2680 }
2677 } 2681 }
2678 } 2682 }