[vlc-commits] httpd: store timeout date rather than activity date

Rémi Denis-Courmont git at videolan.org
Tue Jan 12 14:18:53 UTC 2021


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Nov 22 18:53:24 2020 +0200| [2fd2b843c4af0e42c6848bc88ab03173500cc52c] | committer: Thomas Guillem

httpd: store timeout date rather than activity date

This should not make any functional differences.

Signed-off-by: Thomas Guillem <thomas at gllm.fr>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2fd2b843c4af0e42c6848bc88ab03173500cc52c
---

 src/network/httpd.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/network/httpd.c b/src/network/httpd.c
index 52c8e5bdf3..24f7912e27 100644
--- a/src/network/httpd.c
+++ b/src/network/httpd.c
@@ -146,7 +146,7 @@ struct httpd_client_t
     bool    b_stream_mode;
     uint8_t i_state;
 
-    vlc_tick_t i_activity_date;
+    vlc_tick_t i_timeout_date;
     vlc_tick_t i_activity_timeout;
 
     /* buffer for reading header */
@@ -1204,8 +1204,8 @@ void httpd_MsgAdd(httpd_message_t *msg, const char *name, const char *psz_value,
 static void httpd_ClientInit(httpd_client_t *cl, vlc_tick_t now)
 {
     cl->i_state = HTTPD_CLIENT_RECEIVING;
-    cl->i_activity_date = now;
     cl->i_activity_timeout = VLC_TICK_FROM_SEC(10);
+    cl->i_timeout_date = now + cl->i_activity_timeout;
     cl->i_buffer_size = HTTPD_CL_BUFSIZE;
     cl->i_buffer = 0;
     cl->p_buffer = xmalloc(cl->i_buffer_size);
@@ -1744,15 +1744,14 @@ static void httpdLoop(httpd_host_t *host)
         }
 
         if (cl->i_state == HTTPD_CLIENT_DEAD
-         || (cl->i_activity_timeout > 0
-          && cl->i_activity_date + cl->i_activity_timeout < now)) {
+         || (cl->i_activity_timeout > 0 && cl->i_timeout_date < now)) {
             host->client_count--;
             httpd_ClientDestroy(cl);
             continue;
         }
 
         if (val == 0) {
-            cl->i_activity_date = now;
+            cl->i_timeout_date = now + cl->i_activity_timeout;
             delay = 0;
         }
 



More information about the vlc-commits mailing list