Re: epoll, POLLHUP, and packet loss

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

 



Davide Libenzi wrote:
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)

Yes, it's perfectly reasonable. It's just not what I was expecting. Just goes to show: I never understand POLLHUP (assuming this is also the way POLLHUP behaves with poll()). I just always assumed it was just like EOF.

BTW I finally posted my 2nd try at a userspace wrapper that lets programs
use /dev/epoll, sys_epoll, and sigio interchangably; it's
at http://kegel.com/rn/  and is significantly simpler than my
old Poller, since it doesn't try to simulate level-triggering at all
with sigio.
- Dan

--
Dan Kegel
http://www.kegel.com
http://counter.li.org/cgi-bin/runscript/display-person.cgi?user=78045

-
: 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