diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2017-10-30 21:53:30 +0300 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2017-10-30 23:37:44 +0300 |
commit | dc96775e3210bce764284d46be5fd889d63ef0b8 (patch) | |
tree | a3a67b543bdbcafa83a42d6967ab26060ba2ecc3 /src/microhttpd/connection.c | |
parent | 8da22ca0612e633aa76f145b879d83833dbdcdfe (diff) | |
download | libmicrohttpd-dc96775e3210bce764284d46be5fd889d63ef0b8.tar.gz libmicrohttpd-dc96775e3210bce764284d46be5fd889d63ef0b8.zip |
MHD_queue_response(): ignore response, but return OK if daemon is shut down.
This will avoid race condition: if daemon is shutting down in parallel,
response may be queued but aborted later.
Therefore, returning "MHD_OK" will unify situation from application
point of view.
Diffstat (limited to 'src/microhttpd/connection.c')
-rw-r--r-- | src/microhttpd/connection.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c index 9b040418..b19c67fa 100644 --- a/src/microhttpd/connection.c +++ b/src/microhttpd/connection.c | |||
@@ -3880,6 +3880,11 @@ MHD_queue_response (struct MHD_Connection *connection, | |||
3880 | (MHD_CONNECTION_FOOTERS_RECEIVED != connection->state) ) ) | 3880 | (MHD_CONNECTION_FOOTERS_RECEIVED != connection->state) ) ) |
3881 | return MHD_NO; | 3881 | return MHD_NO; |
3882 | daemon = connection->daemon; | 3882 | daemon = connection->daemon; |
3883 | |||
3884 | if (daemon->shutdown) | ||
3885 | return MHD_YES; /* If daemon was shut down in parallel, | ||
3886 | * response will be aborted now or on later stage. */ | ||
3887 | |||
3883 | if ( (!connection->suspended) && | 3888 | if ( (!connection->suspended) && |
3884 | (0 != (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) && | 3889 | (0 != (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) && |
3885 | (!MHD_thread_ID_match_current_(connection->pid.ID)) ) | 3890 | (!MHD_thread_ID_match_current_(connection->pid.ID)) ) |