[vlc-devel] [PATCH 2/2] httpd: skip the accept if the socket has errors

Rémi Denis-Courmont remi at remlab.net
Mon Nov 30 17:47:10 CET 2015


On Monday 30 November 2015 17:35:59 Steve Lhomme wrote:
> ---
>  src/network/httpd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/network/httpd.c b/src/network/httpd.c
> index cfaac4b..124d448 100644
> --- a/src/network/httpd.c
> +++ b/src/network/httpd.c
> @@ -2032,7 +2032,7 @@ static void httpdLoop(httpd_host_t *host)
> 
>          assert (fd == host->fds[nfd]);
> 
> -        if (ufd[nfd].revents == 0)
> +        if (ufd[nfd].revents == 0 || ufd[nfd].revents & (POLLERR|POLLHUP)
> != 0) continue;

When there is an error, you need to "read" (in this case, accept()) to dequeue 
the error. Otherwise, you might enter a live loop.

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



More information about the vlc-devel mailing list