[vlc-devel] [PATCH] httpd: update activity time before processing timeout (#25151)

Rémi Denis-Courmont remi at remlab.net
Mon Sep 28 19:57:22 CEST 2020


Le maanantaina 28. syyskuuta 2020, 18.56.06 EEST Francois Cartegnie a écrit :
> as connection state handling block has moved in
> 67cdaeea58641d6d515728596f8b194f52538e2b
> sockets can now timeout when still active.
> ---
>  src/network/httpd.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/src/network/httpd.c b/src/network/httpd.c
> index 37ba36007d..5a90d19eb8 100644
> --- a/src/network/httpd.c
> +++ b/src/network/httpd.c
> @@ -1736,6 +1736,9 @@ static void httpdLoop(httpd_host_t *host)
>                  break;
>          }
> 
> +        if (val == 0)
> +            cl->i_activity_date = now;
> +
>          if (cl->i_ref < 0 || (cl->i_ref == 0 &&
>                      (cl->i_state == HTTPD_CLIENT_DEAD ||
>                        (cl->i_activity_timeout > 0 &&
> @@ -1746,9 +1749,6 @@ static void httpdLoop(httpd_host_t *host)
>              continue;
>          }
> 
> -        if (val == 0)
> -            cl->i_activity_date = now;
> -
>          struct pollfd *pufd = ufd + nfd;
>          assert (pufd < ufd + (sizeof (ufd) / sizeof (ufd[0])));

Leaving aside that it does not apply, it does not look it solves much 
anything. AFAIU, it just means that the socket will (now) or won't (with the 
patch) be expired if the inactivity time-out exactly inherently races with 
client activity. It's totally arbitrary and pretty much irrelevant whether to 
process expiration or refresh first.

If it seems to work around a bug, then probably one of the above supposedly 
non-blocking client I/O functions is incorrectly blocking, and jamming the 
whole server thread.

-- 
Rémi Denis-Courmont
http://www.remlab.net/





More information about the vlc-devel mailing list