libmicrohttpd

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

commit fefb1e5b60131bc6bf73046e902d5cb14debc1f1
parent a66ec8da4269cbaf27b902716b63d16de51459e7
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date:   Sun, 14 May 2017 14:31:10 +0300

Improved resume_suspended_connections() handling:
Removed extra call from MHD_run(), moved call in MHD_epoll() so resumed connections are handled without delay

Diffstat:
Msrc/microhttpd/daemon.c | 16++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c @@ -3467,7 +3467,7 @@ MHD_run_from_select (struct MHD_Daemon *daemon, } /* Resuming external connections when using an extern mainloop */ - if (0 != (daemon->options & MHD_ALLOW_SUSPEND_RESUME)) + if (0 != (daemon->options & MHD_TEST_ALLOW_SUSPEND_RESUME)) resume_suspended_connections (daemon); return internal_run_from_select (daemon, read_fd_set, @@ -4226,6 +4226,11 @@ MHD_epoll (struct MHD_Daemon *daemon, MHD_PANIC (_("Failed to remove listen FD from epoll set\n")); daemon->listen_socket_in_epoll = false; } + + if ( (0 != (daemon->options & MHD_TEST_ALLOW_SUSPEND_RESUME)) && + (MHD_YES == resume_suspended_connections (daemon)) ) + may_block = MHD_NO; + if (MHD_YES == may_block) { if (MHD_YES == MHD_get_timeout (daemon, @@ -4364,11 +4369,6 @@ MHD_epoll (struct MHD_Daemon *daemon, run_epoll_for_upgrade (daemon); #endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */ - /* we handle resumes here because we may have ready connections - that will not be placed into the epoll list immediately. */ - if (0 != (daemon->options & MHD_TEST_ALLOW_SUSPEND_RESUME)) - (void) resume_suspended_connections (daemon); - /* process events for connections */ prev = daemon->eready_tail; while (NULL != (pos = prev)) @@ -4451,10 +4451,6 @@ MHD_run (struct MHD_Daemon *daemon) if ( (daemon->shutdown) || (0 != (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) ) return MHD_NO; - /* Resume resuming connection (if any) so they will be processing - * in this turn. */ - if (0 != (daemon->options & MHD_ALLOW_SUSPEND_RESUME)) - resume_suspended_connections (daemon); if (0 != (daemon->options & MHD_USE_POLL)) { MHD_poll (daemon, MHD_NO);