libmicrohttpd

HTTP/1.x server C library (MHD 1.x, stable)
Log | Files | Refs | Submodules | README | LICENSE

commit 82ce5348c515ab89da8521241c5d7c56d220ef45
parent e5c74b3a125cee3f4c0dda04d04c9251c8ab116c
Author: Christian Grothoff <christian@grothoff.org>
Date:   Fri,  4 Nov 2016 11:42:22 +0100

use MHD_YES/NO instead of 0/!0

Diffstat:
Msrc/microhttpd/daemon.c | 35++++++++++++++++++++++-------------
1 file changed, 22 insertions(+), 13 deletions(-)

diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c @@ -1404,27 +1404,28 @@ thread_main_handle_connection (void *data) #endif #undef EXTRA_SLOTS #ifdef HAVE_POLL - const _MHD_bool use_poll = (0 != (daemon->options & MHD_USE_POLL)); + const int use_poll = (0 != (daemon->options & MHD_USE_POLL)); #else /* ! HAVE_POLL */ - const _MHD_bool use_poll = 0; + const int use_poll = MHD_NO; #endif /* ! HAVE_POLL */ while ( (MHD_YES != daemon->shutdown) && (MHD_CONNECTION_CLOSED != con->state) ) { const unsigned int timeout = daemon->connection_timeout; - _MHD_bool was_suspended = 0; + int was_suspended = MHD_NO; #ifdef UPGRADE_SUPPORT struct MHD_UpgradeResponseHandle * const urh = con->urh; #else /* ! UPGRADE_SUPPORT */ static const void * const urh = NULL; #endif /* ! UPGRADE_SUPPORT */ - if (MHD_NO != con->suspended && NULL == urh) + if ( (MHD_NO != con->suspended) && + (NULL == urh) ) { /* Connection was suspended, wait for resume. */ - was_suspended = !0; - if (!use_poll) + was_suspended = MHD_YES; + if (! use_poll) { FD_ZERO (&rs); if (! MHD_add_to_fd_set_ (MHD_itc_r_fd_ (daemon->itc), @@ -1439,7 +1440,10 @@ thread_main_handle_connection (void *data) goto exit; } if (0 > MHD_SYS_select_ (MHD_itc_r_fd_ (daemon->itc) + 1, - &rs, NULL, NULL, NULL)) + &rs, + NULL, + NULL, + NULL)) { const int err = MHD_socket_get_error_(); @@ -1460,7 +1464,9 @@ thread_main_handle_connection (void *data) p[0].events = POLLIN; p[0].fd = MHD_itc_r_fd_ (daemon->itc); p[0].revents = 0; - if (0 > MHD_sys_poll_ (p, 1, -1)) + if (0 > MHD_sys_poll_ (p, + 1, + -1)) { if (MHD_SCKT_LAST_ERR_IS_(MHD_SCKT_EINTR_)) continue; @@ -1477,10 +1483,11 @@ thread_main_handle_connection (void *data) continue; /* Check again for resume. */ } /* End of "suspended" branch. */ - if ( was_suspended && (0 != con->connection_timeout) ) + if ( (MHD_YES == was_suspended) && + (0 != con->connection_timeout) ) { con->last_activity = MHD_monotonic_sec_counter(); /* Reset timeout timer. */ - was_suspended = 0; + was_suspended = MHD_NO; } tvp = NULL; @@ -2473,8 +2480,9 @@ resume_suspended_connections (struct MHD_Daemon *daemon) next = pos->next; if ( (MHD_NO == pos->resuming) #ifdef UPGRADE_SUPPORT - || ((NULL != urh) && - ((MHD_NO == urh->was_closed) || (MHD_NO == urh->clean_ready))) + || ( (NULL != urh) && + ( (MHD_NO == urh->was_closed) || + (MHD_NO == urh->clean_ready) ) ) #endif /* UPGRADE_SUPPORT */ ) continue; @@ -2533,7 +2541,8 @@ resume_suspended_connections (struct MHD_Daemon *daemon) MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex); if (MHD_NO != ret) { /* Wake up suspended connections. */ - if ( !MHD_itc_activate_(daemon->itc, "w")) + if (! MHD_itc_activate_(daemon->itc, + "w")) #ifdef HAVE_MESSAGES MHD_DLOG (daemon, _("Failed to signal resume of connection via inter-thread communication channel."));