vlc/vlc-3.0 | branch: master | Rémi Denis-Courmont <[email protected]> | Sat Jun 6 20:26:48 2020 +0300| [dbcfd767910d2d4b2349189eebc9128a48ca6b02] | 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. (cherry picked from commit be6f5dfbe106c9075e5b6a34e257a33f5327c42f) > http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=dbcfd767910d2d4b2349189eebc9128a48ca6b02 --- src/network/httpd.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/network/httpd.c b/src/network/httpd.c index 37ba36007d..d3bc3d97aa 100644 --- a/src/network/httpd.c +++ b/src/network/httpd.c @@ -1716,8 +1716,7 @@ static void httpdLoop(httpd_host_t *host) } mtime_t now = mdate(); - bool b_low_delay = false; - + int delay = -1; int canc = vlc_savecancel(); for (int i_client = 0; i_client < host->i_client; i_client++) { httpd_client_t *cl = host->client[i_client]; @@ -1746,8 +1745,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 + (sizeof (ufd) / sizeof (ufd[0]))); @@ -1978,14 +1979,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
