Mike Kaplinskiy : server: Keep polling sockets after we got a 0 recv, but not for POLLIN.

Alexandre Julliard julliard at winehq.org
Thu May 13 13:15:01 CDT 2010


Module: wine
Branch: master
Commit: 535f878e3d04c237e9dc7af2b14aad2bd92d13ec
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=535f878e3d04c237e9dc7af2b14aad2bd92d13ec

Author: Mike Kaplinskiy <mike.kaplinskiy at gmail.com>
Date:   Wed May 12 01:59:04 2010 -0400

server: Keep polling sockets after we got a 0 recv, but not for POLLIN.

---

 server/sock.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/server/sock.c b/server/sock.c
index 753518d..da7ae67 100644
--- a/server/sock.c
+++ b/server/sock.c
@@ -428,13 +428,16 @@ static void sock_poll_event( struct fd *fd, int event )
             if (debug_level)
                 fprintf(stderr, "socket %p got OOB data\n", sock);
         }
+
         /* According to WS2 specs, FD_CLOSE is only delivered when there is
            no more data to be read (i.e. hangup_seen = 1) */
-        else if ( hangup_seen && (sock->state & (FD_READ|FD_WRITE) ))
+        if ( hangup_seen && (sock->state & (FD_READ|FD_WRITE) ))
         {
             sock->errors[FD_CLOSE_BIT] = sock_error( fd );
             if ( (event & POLLERR) || ( sock_shutdown_type == SOCK_SHUTDOWN_EOF && (event & POLLHUP) ))
                 sock->state &= ~FD_WRITE;
+            sock->state &= ~FD_READ;
+
             sock->pmask |= FD_CLOSE;
             sock->hmask |= FD_CLOSE;
             if (debug_level)
@@ -443,7 +446,7 @@ static void sock_poll_event( struct fd *fd, int event )
         }
     }
 
-    if ( sock->pmask & FD_CLOSE || event & (POLLERR|POLLHUP) )
+    if ( event & (POLLERR|POLLHUP) )
     {
         if ( debug_level )
             fprintf( stderr, "removing socket %p from select loop\n", sock );




More information about the wine-cvs mailing list