vlc | branch: master | Rémi Denis-Courmont <[email protected]> | Sat Jun 6 20:26:48 2020 +0300| [be6f5dfbe106c9075e5b6a34e257a33f5327c42f] | committer: Rémi Denis-Courmont
httpd: don't wait until all clients are idle As long as at least one client is active, we need to keep trying to read/write to drain the RX buffers or fill the TX buffers. We still need to poll (with zero timeout) to detect new connections. Fixes #24824. > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=be6f5dfbe106c9075e5b6a34e257a33f5327c42f --- src/network/httpd.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/network/httpd.c b/src/network/httpd.c index 6e1aed8a1b..d3bba11fee 100644 --- a/src/network/httpd.c +++ b/src/network/httpd.c @@ -1722,7 +1722,7 @@ static void httpdLoop(httpd_host_t *host) vlc_mutex_lock(&host->lock); /* add all socket that should be read/write and close dead connection */ vlc_tick_t now = vlc_tick_now(); - bool b_low_delay = false; + int delay = -1; httpd_client_t *cl; int canc = vlc_savecancel(); @@ -1750,8 +1750,10 @@ static void httpdLoop(httpd_host_t *host) continue; } - if (val == 0) + if (val == 0) { cl->i_activity_date = now; + delay = 0; + } struct pollfd *pufd = ufd + nfd; assert (pufd < ufd + ARRAY_SIZE (ufd)); @@ -1982,14 +1984,14 @@ static void httpdLoop(httpd_host_t *host) if (pufd->events != 0) nfd++; - else - b_low_delay = true; + /* we will wait 20ms (not too big) if HTTPD_CLIENT_WAITING */ + else if (delay != 0) + delay = 20; } vlc_mutex_unlock(&host->lock); vlc_restorecancel(canc); - /* we will wait 20ms (not too big) if HTTPD_CLIENT_WAITING */ - while (poll(ufd, nfd, b_low_delay ? 20 : -1) < 0) + while (poll(ufd, nfd, delay) < 0) { if (errno != EINTR) msg_Err(host, "polling error: %s", vlc_strerror_c(errno)); _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
