server: Allow polling on an fd after it was removed.

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@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2021-05-17 21:29:58 -05:00 committed by Alexandre Julliard
parent 8fbf62ec47
commit 737fe1f993
1 changed files with 1 additions and 4 deletions

View File

@ -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;