Re: [PATCH v2] daemon: correctly handle soft accept() errors in service_loop
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jun 27, 2025, 23:53 UTC
- Message-ID
- <xmqqy0tc68s4.fsf@gitster.g>
- In-Reply-To
- <vgailqqh3bcip3gxtdffoo4ey7xjso4xerewxncy22shrzn4k2@25hst4sfgxq4>
Carlo Marcelo Arenas Belón <carenas@gmail.com> writes:
Show 13 quoted lines
>> socklen_t sslen = sizeof(ss);
>> - int incoming = accept(pfd[i].fd, &ss.sa, &sslen);
>> + int incoming;
>> + int retry = 3;
>> +
>> + incoming = accept(pfd[i].fd, &ss.sa, &sslen);
>> if (incoming < 0) {
>> ...
>
> That seems unnecessarily restrictive just to minimize churn and leaves the
> deflaration of incoming strangely sitting in between two assignments, which
> while it doesn't trigger -Wdeclaration-after-statement seems to go against
> its spirit.Hmph, I am not Phillip, but my take on it is that incoming and retry are fairly closely related variables in this loop, and better grouped together?
I also find it a bit ugly to hardcode "3" here like this, but perhaps I am overthinking about it.