[vlc-devel] [PATCH 4/5] httpd: set timeout duration per host rather than client

Andriy Gelman andriy.gelman at gmail.com
Sun Nov 22 19:08:21 CET 2020


On Sun, 22. Nov 18:53, remi at remlab.net wrote:
> From: RĂ©mi Denis-Courmont <remi at remlab.net>
> 
> ---
>  src/network/httpd.c | 31 +++++++++++++++----------------
>  1 file changed, 15 insertions(+), 16 deletions(-)
> 
> diff --git a/src/network/httpd.c b/src/network/httpd.c
> index 5a8aea918d..9a0a352566 100644
> --- a/src/network/httpd.c
> +++ b/src/network/httpd.c
> @@ -96,6 +96,7 @@ struct httpd_host_t
>  
>      size_t client_count;
>      struct vlc_list clients;
> +    unsigned timeout_sec;
>  
>      /* TLS data */
>      vlc_tls_server_t *p_tls;
> @@ -147,7 +148,6 @@ struct httpd_client_t
>      uint8_t i_state;
>  
>      vlc_tick_t i_timeout_date;
> -    vlc_tick_t i_activity_timeout;
>  
>      /* buffer for reading header */
>      int     i_buffer_size;
> @@ -882,12 +882,13 @@ void httpd_StreamDelete(httpd_stream_t *stream)
>   *****************************************************************************/
>  static void* httpd_HostThread(void *);
>  static httpd_host_t *httpd_HostCreate(vlc_object_t *, const char *,
> -                                       const char *, vlc_tls_server_t *);
> +                                      const char *, vlc_tls_server_t *,
> +                                      unsigned);
>  
>  /* create a new host */
>  httpd_host_t *vlc_http_HostNew(vlc_object_t *p_this)
>  {
> -    return httpd_HostCreate(p_this, "http-host", "http-port", NULL);
> +    return httpd_HostCreate(p_this, "http-host", "http-port", NULL, 10);
>  }
>  
>  httpd_host_t *vlc_https_HostNew(vlc_object_t *obj)
> @@ -911,12 +912,13 @@ httpd_host_t *vlc_https_HostNew(vlc_object_t *obj)
>      free(key);
>      free(cert);
>  
> -    return httpd_HostCreate(obj, "http-host", "https-port", tls);
> +    return httpd_HostCreate(obj, "http-host", "https-port", tls, 10);
>  }

>  
>  httpd_host_t *vlc_rtsp_HostNew(vlc_object_t *p_this)
>  {
> -    return httpd_HostCreate(p_this, "rtsp-host", "rtsp-port", NULL);
> +    /* XXX: for QT I have to disable timeout. Try to find why */
> +    return httpd_HostCreate(p_this, "rtsp-host", "rtsp-port", NULL, 0);

nit:
In the patch message you may want to add that setting the infinite
timeout for the rtsp connection did not work before this patch.

Your series works for me when testing with ffmpeg.

Thanks, 
-- 
Andriy


More information about the vlc-devel mailing list