[Sheepdog] [PATCH] fix a bug in rx() when read() returns 0 but connection is not marked as closed.

MORITA Kazutaka morita.kazutaka at gmail.com
Wed Apr 25 07:07:07 CEST 2012


On Wed, Apr 25, 2012 at 10:05 AM, Huxinwei <huxinwei at huawei.com> wrote:
>> -----Original Message-----
>> From: MORITA Kazutaka [mailto:morita.kazutaka at gmail.com]
>> Sent: Tuesday, April 24, 2012 5:21 PM
>> To: Huxinwei
>> Cc: Li Wenpeng; sheepdog at lists.wpkg.org
>> Subject: Re: [Sheepdog] [PATCH] fix a bug in rx() when read() returns 0 but
>> connection is not marked as closed.
>>
>> On Tue, Apr 24, 2012 at 5:40 PM, Huxinwei <huxinwei at huawei.com> wrote:
>> > I proposed something similar a while ago.
>> > The connection is actually staying in CLOSE_WAIT status while this happens.
>> I'd suggest you consider something more reliable.
>>
>> Is there any case that read() returns zero but the connection is not closed?
>
> What if reading is interrupted by a signal ?
> Read() returns 0 while errno is EINTR then ?

No, it returns -1 when errno is set.

http://www.kernel.org/doc/man-pages/online/pages/man2/read.2.html



More information about the sheepdog mailing list