[PATCH v2 3/6] server: Allow polling on an fd after it was removed.

Zebediah Figura z.figura12 at gmail.com
Mon May 17 21:29:58 CDT 2021


In particular, so that we can wait for POLLOUT on a connecting socket multiple
times, in case the first connection fails, without polling on it while it is
unconnected.

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
v2: Patch added; no other patches in the series were modified.

 server/fd.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/server/fd.c b/server/fd.c
index 481e9a88f0f..e7253ec8f51 100644
--- a/server/fd.c
+++ b/server/fd.c
@@ -549,7 +549,6 @@ static inline void set_fd_epoll_events( struct fd *fd, int user, int events )
     }
     else if (pollfd[user].fd == -1)
     {
-        if (pollfd[user].events) return;  /* stopped waiting on it, don't restart */
         ctl = EPOLL_CTL_ADD;
     }
     else
@@ -658,7 +657,6 @@ static inline void set_fd_epoll_events( struct fd *fd, int user, int events )
     }
     else if (pollfd[user].fd == -1)
     {
-        if (pollfd[user].events) return;  /* stopped waiting on it, don't restart */
         ev[0].flags |= EV_ADD | ((events & POLLIN) ? EV_ENABLE : EV_DISABLE);
         ev[1].flags |= EV_ADD | ((events & POLLOUT) ? EV_ENABLE : EV_DISABLE);
     }
@@ -767,7 +765,6 @@ static inline void set_fd_epoll_events( struct fd *fd, int user, int events )
     }
     else if (pollfd[user].fd == -1)
     {
-        if (pollfd[user].events) return;  /* stopped waiting on it, don't restart */
         ret = port_associate( port_fd, PORT_SOURCE_FD, fd->unix_fd, events, (void *)user );
     }
     else
@@ -1647,7 +1644,7 @@ void set_fd_events( struct fd *fd, int events )
         pollfd[user].events = POLLERR;
         pollfd[user].revents = 0;
     }
-    else if (pollfd[user].fd != -1 || !pollfd[user].events)
+    else
     {
         pollfd[user].fd = fd->unix_fd;
         pollfd[user].events = events;
-- 
2.30.2




More information about the wine-devel mailing list