From: Lucian Petrut Date: Fri, 20 Jan 2023 16:52:14 +0000 (+0200) Subject: msg: fix poll event driver, handling POLLHUP and POLLERR X-Git-Tag: v18.1.0~420^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F49812%2Fhead;p=ceph.git msg: fix poll event driver, handling POLLHUP and POLLERR The poll event driver (mainly used on Windows) is currently ignoring POLLOUT and POLLERR events. Because of this, the caller doesn't get notified that the connection closed and can end up calling "event_wait" indefinitely. This change ensures that POLLOUT and POLLERR events are properly propagated by the poll driver. Related issue: https://github.com/cloudbase/wnbd/issues/98 Signed-off-by: Lucian Petrut --- diff --git a/src/msg/async/EventPoll.cc b/src/msg/async/EventPoll.cc index dac5e18d4038..4c09dbb4db41 100644 --- a/src/msg/async/EventPoll.cc +++ b/src/msg/async/EventPoll.cc @@ -178,6 +178,12 @@ int PollDriver::event_wait(std::vector &fired_events, if (pfds[j].revents & POLLOUT) { mask |= EVENT_WRITABLE; } + if (pfds[j].revents & POLLHUP) { + mask |= EVENT_READABLE | EVENT_WRITABLE; + } + if (pfds[j].revents & POLLERR) { + mask |= EVENT_READABLE | EVENT_WRITABLE; + } if (mask) { fe.fd = pfds[j].fd; fe.mask = mask;