commit 8c8f43fa9526f29e568305d51980466eda79c6a0
parent b7dd331e440f36db9c362731afed803148a08fe9
Author: Christian Grothoff <christian@grothoff.org>
Date: Wed, 14 Feb 2018 20:31:22 +0100
simplify check, do not test same condition twice in nesting
Diffstat:
1 file changed, 23 insertions(+), 26 deletions(-)
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
@@ -6339,34 +6339,31 @@ MHD_stop_daemon (struct MHD_Daemon *daemon)
if (0 != (MHD_TEST_ALLOW_SUSPEND_RESUME & daemon->options))
resume_suspended_connections (daemon);
- if (0 != (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD))
- {
- /* Separate thread(s) is used for polling sockets. */
- if (MHD_ITC_IS_VALID_(daemon->itc))
- {
- if (! MHD_itc_activate_ (daemon->itc, "e"))
- MHD_PANIC (_("Failed to signal shutdown via inter-thread communication channel"));
- }
- else
- {
+ /* Separate thread(s) is used for polling sockets. */
+ if (MHD_ITC_IS_VALID_(daemon->itc))
+ {
+ if (! MHD_itc_activate_ (daemon->itc, "e"))
+ MHD_PANIC (_("Failed to signal shutdown via inter-thread communication channel"));
+ }
+ else
+ {
#ifdef HAVE_LISTEN_SHUTDOWN
- if (MHD_INVALID_SOCKET != fd)
- {
- if (NULL == daemon->master)
- (void) shutdown (fd,
- SHUT_RDWR);
- }
- else
+ if (MHD_INVALID_SOCKET != fd)
+ {
+ if (NULL == daemon->master)
+ (void) shutdown (fd,
+ SHUT_RDWR);
+ }
+ else
#endif /* HAVE_LISTEN_SHUTDOWN */
- mhd_assert (false); /* Should never happen */
- }
-
- if (! MHD_join_thread_ (daemon->pid.handle))
- {
- MHD_PANIC (_("Failed to join a thread\n"));
- }
- /* close_all_connections() was called in daemon thread. */
- }
+ mhd_assert (false); /* Should never happen */
+ }
+
+ if (! MHD_join_thread_ (daemon->pid.handle))
+ {
+ MHD_PANIC (_("Failed to join a thread\n"));
+ }
+ /* close_all_connections() was called in daemon thread. */
}
else
{