[Spice-devel] [PATCH] Treat EAGAIN similarly to EINTR and try again.

Jeremy White jwhite at codeweavers.com
Thu May 3 06:50:08 PDT 2012


On 05/03/2012 03:38 AM, Yonit Halperin wrote:
> Hi,
> On 05/02/2012 10:24 PM, Jeremy White wrote:
>> I had a puzzling bug where I could not establish a connection
>> with a spice server across an openvpn connection onto a Debian
>> stable box.  It turns out that the network stack in question
>> apparently is very careful on non blocking sockets, and was
>> returning EAGAIN on the network ping test transmission.
>>
>> The channel code appears to be clearly broken; on the EAGAIN,
>> it should clearly try the write again later, just as it does
>> on an EINTR return.  This patch makes that change.
>>
> Why do you think it is broken? EAGAIN and EINTR have different meaning. The EAGAIN means that the write would have blocked if the socket was blocking. So we use watch_update_mask to watch the socket, and we make the thread available for other tasks and try again to write only when the socket is available again.

Ah, sure; I jumped to a wrong conclusion. The for (;;) gave me
the impression that red_peer_handle_outgoing() was not supposed
to exit until it had sent the data.

So then the question is - what mechanism is supposed
to cause red_peer_handle_outgoing() to be revisited,
and why didn't it?

Cheers,

Jeremy


More information about the Spice-devel mailing list