Re: epoll, POLLHUP, and packet loss

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 9 Oct 2003, Dan Kegel wrote:

> Davide Libenzi wrote:
> > Hi Dan. The POLLHUP is a condition that does not preclude the socket to
> > have data to be still read. The correct approach, with both and new epoll,
> > is to register the event and read until data is available (if you need
> > to). Then, if a POLLHUP has been received, do not go to wait for POLLINs.
>
> Sounds like I need to go read Stevens again.
>
> For what it's worth, SuSv3 says in the poll() man page:
>
> POLLHUP
>      The device has been disconnected. This event and POLLOUT are
>      mutually-exclusive; a stream can never be writable if a hangup has
>      occurred. However, this event and POLLIN, POLLRDNORM, POLLRDBAND,
>      or POLLPRI are not mutually-exclusive.
>
> which doesn't quite say that POLLHUP may be signalled when
> there's still bunches of data to read, but it comes close.

If you think about it, it comes fairly simple. Suppose you have:

     PEER                 PEER
send 10k
                      recv 2k
send FIN
                      POLLHUP
                      (8k pending here)


- Davide

-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux