[PATCH 2/7] server: Do not poll sockets for POLLPRI unless we are selecting for AFD_POLL_OOB.

Zebediah Figura z.figura12 at gmail.com
Mon Jun 14 23:53:19 CDT 2021


Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 server/sock.c | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/server/sock.c b/server/sock.c
index 1d992d8f9e4..e1b30507514 100644
--- a/server/sock.c
+++ b/server/sock.c
@@ -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 ))
         {
-- 
2.30.2




More information about the wine-devel mailing list