]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
msg: fix poll event driver, handling POLLHUP and POLLERR 49812/head
authorLucian Petrut <lpetrut@cloudbasesolutions.com>
Fri, 20 Jan 2023 16:52:14 +0000 (18:52 +0200)
committerLucian Petrut <lpetrut@cloudbasesolutions.com>
Fri, 20 Jan 2023 17:05:18 +0000 (19:05 +0200)
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 <lpetrut@cloudbasesolutions.com>
src/msg/async/EventPoll.cc

index dac5e18d4038712112588df15ebabfc9329f35d0..4c09dbb4db4177b0533014c9a7a10fd0b5ad6b93 100644 (file)
@@ -178,6 +178,12 @@ int PollDriver::event_wait(std::vector<FiredFileEvent> &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;