common: never remove forcibly a reused fd from epoll.
authorKrisztian Litkey <kli@iki.fi>
Tue, 15 Oct 2013 05:39:55 +0000 (08:39 +0300)
committerKrisztian Litkey <kli@iki.fi>
Tue, 15 Oct 2013 08:36:48 +0000 (11:36 +0300)
commit392e02f37ca3c6f86a679bdcd55c02e43e8ac6f4
treefd9c79d36666e04a55d1163da434a8f80f5893f3
parent850d490a9419f1442a262fe5bc81d5d85916fede
common: never remove forcibly a reused fd from epoll.

If during a single iteration of epoll event dispatching
a file descriptor is closed and reused, make sure the
new reused file desciptor is not accidentially removed
from epoll.

During dispatching we try to patch things up to prevent
a busy looping flood of EPOLLRDHUP/EPOLLHUP events for
users that don't properly handle them. This bug was
triggered when the closed file descriptor got reused and
a new watch for it readded from within the I/O watch
callback for the HUP event on the original closed descriptor.

This patch also makes sure that an effectively similar bug
can not be triggered by calling mrp_del_io_watch twice for
the same I/O watch.
src/common/mainloop.c