server: Do not poll sockets for POLLPRI unless we are selecting for AFD_POLL_OOB.

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-06-15 10:39:44 -05:00 committed by Alexandre Julliard
parent 69549fc0c7
commit 2daf76432e
1 changed files with 14 additions and 5 deletions

View File

@ -1063,11 +1063,20 @@ static int sock_get_poll_events( struct fd *fd )
{
if (async_waiting( &sock->read_q )) ev |= POLLIN | POLLPRI;
}
else if (!sock->rd_shutdown && (mask & AFD_POLL_READ))
ev |= POLLIN | POLLPRI;
/* We use POLLIN with 0 bytes recv() as hangup indication for stream sockets. */
else if (sock->state == SOCK_CONNECTED && (mask & AFD_POLL_HUP) && !(sock->reported_events & AFD_POLL_READ))
ev |= POLLIN;
else
{
if (!sock->rd_shutdown)
{
if (mask & AFD_POLL_READ)
ev |= POLLIN;
if (mask & AFD_POLL_OOB)
ev |= POLLPRI;
}
/* We use POLLIN with 0 bytes recv() as hangup indication for stream sockets. */
if (sock->state == SOCK_CONNECTED && (mask & AFD_POLL_HUP) && !(sock->reported_events & AFD_POLL_READ))
ev |= POLLIN;
}
if (async_queued( &sock->write_q ))
{