[vlc-devel] [PATCH 2/4] httpd: update poll timeout with clients timeouts
Thomas Guillem
thomas at gllm.fr
Wed Oct 28 13:34:35 CET 2020
Use the lowest timeout of all clients.
This fixes client timeouts that were not always strictly respected.
Indeed, poll was waiting indefinitely by default so timeouts were only
handled after a socket event was processed.
---
src/network/httpd.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/network/httpd.c b/src/network/httpd.c
index 13feb383a14..fd232dce8e2 100644
--- a/src/network/httpd.c
+++ b/src/network/httpd.c
@@ -1756,6 +1756,13 @@ static void httpdLoop(httpd_host_t *host)
continue;
}
+ if (cl->i_activity_timeout > 0)
+ {
+ vlc_tick_t timeout_delay_ms = cl->i_activity_date + cl->i_activity_timeout - now;
+ if (timeout_delay_ms < delay || delay == -1)
+ delay = MS_FROM_VLC_TICK(timeout_delay_ms);
+ }
+
struct pollfd *pufd = ufd + nfd;
assert (pufd < ufd + ARRAY_SIZE (ufd));
--
2.28.0
More information about the vlc-devel
mailing list