[vlc-devel] [PATCH 1/2] httpd: warn when an accept() failed even though it was signaled

Steve Lhomme robux4 at gmail.com
Mon Nov 30 18:01:28 CET 2015


On Mon, Nov 30, 2015 at 5:46 PM, Rémi Denis-Courmont <remi at remlab.net> wrote:
> On Monday 30 November 2015 17:35:58 Steve Lhomme wrote:
>> ---
>>  src/network/httpd.c | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/src/network/httpd.c b/src/network/httpd.c
>> index 7c924a8..cfaac4b 100644
>> --- a/src/network/httpd.c
>> +++ b/src/network/httpd.c
>> @@ -2038,7 +2038,10 @@ static void httpdLoop(httpd_host_t *host)
>>          /* */
>>          fd = vlc_accept (fd, NULL, NULL, true);
>>          if (fd == -1)
>> +        {
>> +            msg_Warn(host, "accept failed: %s", vlc_strerror_c(net_errno));
>> continue;
>> +        }
>>          setsockopt (fd, SOL_SOCKET, SO_REUSEADDR,
>>                  &(int){ 1 }, sizeof(int));
>
> accept() failing is perfectly normal, if rare. TCP connections can be aborted.
>
> Not sure we want to flood the logs if/when that happens.

But we only reach this code when we poll() that bound socket for
POLLIN. If we're signaled and accept fails there must be something
fishy going on. For a server that might be an indication of a problem
to handle. On our side it helps to detect weird behaviours.

> --
> Rémi Denis-Courmont
> http://www.remlab.net/
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list