diff options
author | Christian Grothoff <christian@grothoff.org> | 2018-03-02 21:45:17 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2018-03-02 21:45:26 +0100 |
commit | 0ebdff94d461abd4328cf45a6281c15139a045eb (patch) | |
tree | f87e851c2c1f519732787706ed4b90ab85f58b1f /src/microhttpd/daemon.c | |
parent | 73532f78bb3a1a07c091ef7123b3ab49347c0b95 (diff) | |
download | libmicrohttpd-0ebdff94d461abd4328cf45a6281c15139a045eb.tar.gz libmicrohttpd-0ebdff94d461abd4328cf45a6281c15139a045eb.zip |
fix test_upgrade transient failures (#5189)
Diffstat (limited to 'src/microhttpd/daemon.c')
-rw-r--r-- | src/microhttpd/daemon.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c index 8c196421..6179f2bc 100644 --- a/src/microhttpd/daemon.c +++ b/src/microhttpd/daemon.c | |||
@@ -2750,7 +2750,7 @@ resume_suspended_connections (struct MHD_Daemon *daemon) | |||
2750 | DLL_insert (daemon->connections_head, | 2750 | DLL_insert (daemon->connections_head, |
2751 | daemon->connections_tail, | 2751 | daemon->connections_tail, |
2752 | pos); | 2752 | pos); |
2753 | if (!used_thr_p_c) | 2753 | if (! used_thr_p_c) |
2754 | { | 2754 | { |
2755 | /* Reset timeout timer on resume. */ | 2755 | /* Reset timeout timer on resume. */ |
2756 | if (0 != pos->connection_timeout) | 2756 | if (0 != pos->connection_timeout) |
@@ -2787,6 +2787,15 @@ resume_suspended_connections (struct MHD_Daemon *daemon) | |||
2787 | /* Data forwarding was finished (for TLS connections) AND | 2787 | /* Data forwarding was finished (for TLS connections) AND |
2788 | * application was closed upgraded connection. | 2788 | * application was closed upgraded connection. |
2789 | * Insert connection into cleanup list. */ | 2789 | * Insert connection into cleanup list. */ |
2790 | |||
2791 | if ( (NULL != daemon->notify_completed) && | ||
2792 | (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) && | ||
2793 | (pos->client_aware) ) | ||
2794 | daemon->notify_completed (daemon->notify_completed_cls, | ||
2795 | pos, | ||
2796 | &pos->client_context, | ||
2797 | MHD_REQUEST_TERMINATED_COMPLETED_OK); | ||
2798 | pos->client_aware = false; | ||
2790 | DLL_insert (daemon->cleanup_head, | 2799 | DLL_insert (daemon->cleanup_head, |
2791 | daemon->cleanup_tail, | 2800 | daemon->cleanup_tail, |
2792 | pos); | 2801 | pos); |
@@ -3780,7 +3789,7 @@ MHD_poll_listen_socket (struct MHD_Daemon *daemon, | |||
3780 | } | 3789 | } |
3781 | 3790 | ||
3782 | if (0 != (daemon->options & MHD_TEST_ALLOW_SUSPEND_RESUME)) | 3791 | if (0 != (daemon->options & MHD_TEST_ALLOW_SUSPEND_RESUME)) |
3783 | (void)resume_suspended_connections (daemon); | 3792 | (void) resume_suspended_connections (daemon); |
3784 | 3793 | ||
3785 | if (MHD_NO == may_block) | 3794 | if (MHD_NO == may_block) |
3786 | timeout = 0; | 3795 | timeout = 0; |
@@ -4385,7 +4394,7 @@ close_connection (struct MHD_Connection *pos) | |||
4385 | 4394 | ||
4386 | mhd_assert (! pos->suspended); | 4395 | mhd_assert (! pos->suspended); |
4387 | mhd_assert (! pos->resuming); | 4396 | mhd_assert (! pos->resuming); |
4388 | if (pos->connection_timeout == pos->daemon->connection_timeout) | 4397 | if (pos->connection_timeout == daemon->connection_timeout) |
4389 | XDLL_remove (daemon->normal_timeout_head, | 4398 | XDLL_remove (daemon->normal_timeout_head, |
4390 | daemon->normal_timeout_tail, | 4399 | daemon->normal_timeout_tail, |
4391 | pos); | 4400 | pos); |
@@ -4433,6 +4442,8 @@ MHD_polling_thread (void *cls) | |||
4433 | /* Resume any pending for resume connections, join | 4442 | /* Resume any pending for resume connections, join |
4434 | * all connection's threads (if any) and finally cleanup | 4443 | * all connection's threads (if any) and finally cleanup |
4435 | * everything. */ | 4444 | * everything. */ |
4445 | if (0 != (MHD_TEST_ALLOW_SUSPEND_RESUME & daemon->options)) | ||
4446 | resume_suspended_connections (daemon); | ||
4436 | close_all_connections (daemon); | 4447 | close_all_connections (daemon); |
4437 | 4448 | ||
4438 | return (MHD_THRD_RTRN_TYPE_)0; | 4449 | return (MHD_THRD_RTRN_TYPE_)0; |
@@ -6304,7 +6315,8 @@ MHD_stop_daemon (struct MHD_Daemon *daemon) | |||
6304 | daemon->worker_pool[i].shutdown = true; | 6315 | daemon->worker_pool[i].shutdown = true; |
6305 | if (MHD_ITC_IS_VALID_(daemon->worker_pool[i].itc)) | 6316 | if (MHD_ITC_IS_VALID_(daemon->worker_pool[i].itc)) |
6306 | { | 6317 | { |
6307 | if (! MHD_itc_activate_ (daemon->worker_pool[i].itc, "e")) | 6318 | if (! MHD_itc_activate_ (daemon->worker_pool[i].itc, |
6319 | "e")) | ||
6308 | MHD_PANIC (_("Failed to signal shutdown via inter-thread communication channel.")); | 6320 | MHD_PANIC (_("Failed to signal shutdown via inter-thread communication channel.")); |
6309 | } | 6321 | } |
6310 | else | 6322 | else |
@@ -6335,11 +6347,8 @@ MHD_stop_daemon (struct MHD_Daemon *daemon) | |||
6335 | if (0 != (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) | 6347 | if (0 != (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) |
6336 | { /* Worker daemon or single daemon with internal thread(s). */ | 6348 | { /* Worker daemon or single daemon with internal thread(s). */ |
6337 | mhd_assert (0 == daemon->worker_pool_size); | 6349 | mhd_assert (0 == daemon->worker_pool_size); |
6338 | if (0 != (MHD_TEST_ALLOW_SUSPEND_RESUME & daemon->options)) | ||
6339 | resume_suspended_connections (daemon); | ||
6340 | |||
6341 | /* Separate thread(s) is used for polling sockets. */ | 6350 | /* Separate thread(s) is used for polling sockets. */ |
6342 | if (MHD_ITC_IS_VALID_(daemon->itc)) | 6351 | if (MHD_ITC_IS_VALID_ (daemon->itc)) |
6343 | { | 6352 | { |
6344 | if (! MHD_itc_activate_ (daemon->itc, | 6353 | if (! MHD_itc_activate_ (daemon->itc, |
6345 | "e")) | 6354 | "e")) |