diff options
author | Christian Grothoff <christian@grothoff.org> | 2018-02-14 20:31:22 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2018-02-14 20:31:22 +0100 |
commit | 8c8f43fa9526f29e568305d51980466eda79c6a0 (patch) | |
tree | 54805433069139f02dcd7b21c16295fae2ed30c6 | |
parent | b7dd331e440f36db9c362731afed803148a08fe9 (diff) | |
download | libmicrohttpd-8c8f43fa9526f29e568305d51980466eda79c6a0.tar.gz libmicrohttpd-8c8f43fa9526f29e568305d51980466eda79c6a0.zip |
simplify check, do not test same condition twice in nesting
-rw-r--r-- | src/microhttpd/daemon.c | 49 |
1 files changed, 23 insertions, 26 deletions
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c index 639add58..541dab8a 100644 --- a/src/microhttpd/daemon.c +++ b/src/microhttpd/daemon.c | |||
@@ -6339,34 +6339,31 @@ MHD_stop_daemon (struct MHD_Daemon *daemon) | |||
6339 | if (0 != (MHD_TEST_ALLOW_SUSPEND_RESUME & daemon->options)) | 6339 | if (0 != (MHD_TEST_ALLOW_SUSPEND_RESUME & daemon->options)) |
6340 | resume_suspended_connections (daemon); | 6340 | resume_suspended_connections (daemon); |
6341 | 6341 | ||
6342 | if (0 != (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) | 6342 | /* Separate thread(s) is used for polling sockets. */ |
6343 | { | 6343 | if (MHD_ITC_IS_VALID_(daemon->itc)) |
6344 | /* Separate thread(s) is used for polling sockets. */ | 6344 | { |
6345 | if (MHD_ITC_IS_VALID_(daemon->itc)) | 6345 | if (! MHD_itc_activate_ (daemon->itc, "e")) |
6346 | { | 6346 | MHD_PANIC (_("Failed to signal shutdown via inter-thread communication channel")); |
6347 | if (! MHD_itc_activate_ (daemon->itc, "e")) | 6347 | } |
6348 | MHD_PANIC (_("Failed to signal shutdown via inter-thread communication channel")); | 6348 | else |
6349 | } | 6349 | { |
6350 | else | ||
6351 | { | ||
6352 | #ifdef HAVE_LISTEN_SHUTDOWN | 6350 | #ifdef HAVE_LISTEN_SHUTDOWN |
6353 | if (MHD_INVALID_SOCKET != fd) | 6351 | if (MHD_INVALID_SOCKET != fd) |
6354 | { | 6352 | { |
6355 | if (NULL == daemon->master) | 6353 | if (NULL == daemon->master) |
6356 | (void) shutdown (fd, | 6354 | (void) shutdown (fd, |
6357 | SHUT_RDWR); | 6355 | SHUT_RDWR); |
6358 | } | 6356 | } |
6359 | else | 6357 | else |
6360 | #endif /* HAVE_LISTEN_SHUTDOWN */ | 6358 | #endif /* HAVE_LISTEN_SHUTDOWN */ |
6361 | mhd_assert (false); /* Should never happen */ | 6359 | mhd_assert (false); /* Should never happen */ |
6362 | } | 6360 | } |
6363 | 6361 | ||
6364 | if (! MHD_join_thread_ (daemon->pid.handle)) | 6362 | if (! MHD_join_thread_ (daemon->pid.handle)) |
6365 | { | 6363 | { |
6366 | MHD_PANIC (_("Failed to join a thread\n")); | 6364 | MHD_PANIC (_("Failed to join a thread\n")); |
6367 | } | 6365 | } |
6368 | /* close_all_connections() was called in daemon thread. */ | 6366 | /* close_all_connections() was called in daemon thread. */ |
6369 | } | ||
6370 | } | 6367 | } |
6371 | else | 6368 | else |
6372 | { | 6369 | { |