diff options
Diffstat (limited to 'src/microhttpd')
-rw-r--r-- | src/microhttpd/daemon.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c index 42b07c5e..091dff52 100644 --- a/src/microhttpd/daemon.c +++ b/src/microhttpd/daemon.c | |||
@@ -3105,9 +3105,9 @@ MHD_start_daemon (unsigned int flags, | |||
3105 | * clients to continue processing, but stops accepting new | 3105 | * clients to continue processing, but stops accepting new |
3106 | * connections. Note that the caller is responsible for closing the | 3106 | * connections. Note that the caller is responsible for closing the |
3107 | * returned socket; however, if MHD is run using threads (anything but | 3107 | * returned socket; however, if MHD is run using threads (anything but |
3108 | * external select mode), it must not be closed until AFTER | 3108 | * external select mode), socket will be removed from existing threads |
3109 | * #MHD_stop_daemon has been called (as it is theoretically possible | 3109 | * with some delay and it must not be closed while it's in use. To make |
3110 | * that an existing thread is still using it). | 3110 | * sure that socket is not used anymore, call #MHD_stop_daemon. |
3111 | * | 3111 | * |
3112 | * Note that some thread modes require the caller to have passed | 3112 | * Note that some thread modes require the caller to have passed |
3113 | * #MHD_USE_PIPE_FOR_SHUTDOWN when using this API. If this daemon is | 3113 | * #MHD_USE_PIPE_FOR_SHUTDOWN when using this API. If this daemon is |
@@ -3154,7 +3154,13 @@ MHD_quiesce_daemon (struct MHD_Daemon *daemon) | |||
3154 | MHD_PANIC ("Failed to remove listen FD from epoll set\n"); | 3154 | MHD_PANIC ("Failed to remove listen FD from epoll set\n"); |
3155 | daemon->worker_pool[i].listen_socket_in_epoll = MHD_NO; | 3155 | daemon->worker_pool[i].listen_socket_in_epoll = MHD_NO; |
3156 | } | 3156 | } |
3157 | else | ||
3157 | #endif | 3158 | #endif |
3159 | if (MHD_INVALID_PIPE_ != daemon->worker_pool[i].wpipe[1]) | ||
3160 | { | ||
3161 | if (1 != MHD_pipe_write_ (daemon->worker_pool[i].wpipe[1], "q", 1)) | ||
3162 | MHD_PANIC ("failed to signal quiesce via pipe"); | ||
3163 | } | ||
3158 | } | 3164 | } |
3159 | daemon->socket_fd = MHD_INVALID_SOCKET; | 3165 | daemon->socket_fd = MHD_INVALID_SOCKET; |
3160 | #if EPOLL_SUPPORT | 3166 | #if EPOLL_SUPPORT |
@@ -3169,7 +3175,14 @@ MHD_quiesce_daemon (struct MHD_Daemon *daemon) | |||
3169 | MHD_PANIC ("Failed to remove listen FD from epoll set\n"); | 3175 | MHD_PANIC ("Failed to remove listen FD from epoll set\n"); |
3170 | daemon->listen_socket_in_epoll = MHD_NO; | 3176 | daemon->listen_socket_in_epoll = MHD_NO; |
3171 | } | 3177 | } |
3178 | else | ||
3172 | #endif | 3179 | #endif |
3180 | if (MHD_INVALID_PIPE_ != daemon->wpipe[1]) | ||
3181 | { | ||
3182 | if (1 != MHD_pipe_write_ (daemon->wpipe[1], "q", 1)) | ||
3183 | MHD_PANIC ("failed to signal quiesce via pipe"); | ||
3184 | } | ||
3185 | |||
3173 | return ret; | 3186 | return ret; |
3174 | } | 3187 | } |
3175 | 3188 | ||