Commit 75242f9b authored by Martin Wilck's avatar Martin Wilck Committed by Alexandre Julliard

Fixes to FD_CLOSE handling.

parent cf518bcd
...@@ -188,8 +188,6 @@ static void sock_wake_up( struct sock *sock, int pollev ) ...@@ -188,8 +188,6 @@ static void sock_wake_up( struct sock *sock, int pollev )
/* We need this to delay FD_CLOSE events until all pending overlapped requests are processed */ /* We need this to delay FD_CLOSE events until all pending overlapped requests are processed */
if ( !events || async_active ) return; if ( !events || async_active ) return;
if (events & FD_CLOSE) sock->hmask |= FD_CLOSE;
if (sock->event) if (sock->event)
{ {
if (debug_level) fprintf(stderr, "signalling events %x ptr %p\n", events, sock->event ); if (debug_level) fprintf(stderr, "signalling events %x ptr %p\n", events, sock->event );
...@@ -284,7 +282,7 @@ static void sock_poll_event( struct object *obj, int event ) ...@@ -284,7 +282,7 @@ static void sock_poll_event( struct object *obj, int event )
{ {
/* incoming data */ /* incoming data */
sock->pmask |= FD_READ; sock->pmask |= FD_READ;
sock->hmask |= FD_READ; sock->hmask |= (FD_READ|FD_CLOSE);
sock->errors[FD_READ_BIT] = 0; sock->errors[FD_READ_BIT] = 0;
if (debug_level) if (debug_level)
fprintf(stderr, "socket %d is readable\n", sock->obj.fd ); fprintf(stderr, "socket %d is readable\n", sock->obj.fd );
...@@ -330,6 +328,7 @@ static void sock_poll_event( struct object *obj, int event ) ...@@ -330,6 +328,7 @@ static void sock_poll_event( struct object *obj, int event )
if ( event & ( POLLERR|POLLHUP ) ) if ( event & ( POLLERR|POLLHUP ) )
sock->state &= ~(FD_WINE_CONNECTED|FD_WRITE); sock->state &= ~(FD_WINE_CONNECTED|FD_WRITE);
sock->pmask |= FD_CLOSE; sock->pmask |= FD_CLOSE;
sock->hmask |= FD_CLOSE;
if (debug_level) if (debug_level)
fprintf(stderr, "socket %d aborted by error %d, event: %x - removing from select loop\n", fprintf(stderr, "socket %d aborted by error %d, event: %x - removing from select loop\n",
sock->obj.fd, sock->errors[FD_CLOSE_BIT], event); sock->obj.fd, sock->errors[FD_CLOSE_BIT], event);
...@@ -390,7 +389,7 @@ static int sock_get_poll_events( struct object *obj ) ...@@ -390,7 +389,7 @@ static int sock_get_poll_events( struct object *obj )
if (mask & FD_WRITE || (sock->flags & WSA_FLAG_OVERLAPPED && IS_READY (sock->write_q))) if (mask & FD_WRITE || (sock->flags & WSA_FLAG_OVERLAPPED && IS_READY (sock->write_q)))
ev |= POLLOUT; ev |= POLLOUT;
/* We use POLLIN with 0 bytes recv() as FD_CLOSE indication. */ /* We use POLLIN with 0 bytes recv() as FD_CLOSE indication. */
if (sock->mask & ~sock->hmask & FD_CLOSE && !(sock->hmask & FD_READ) ) if (sock->mask & ~sock->hmask & FD_CLOSE)
ev |= POLLIN; ev |= POLLIN;
return ev; return ev;
...@@ -447,6 +446,7 @@ static void sock_queue_async(struct object *obj, void *ptr, unsigned int status, ...@@ -447,6 +446,7 @@ static void sock_queue_async(struct object *obj, void *ptr, unsigned int status,
{ {
case ASYNC_TYPE_READ: case ASYNC_TYPE_READ:
q = &sock->read_q; q = &sock->read_q;
sock->hmask &= ~FD_CLOSE;
break; break;
case ASYNC_TYPE_WRITE: case ASYNC_TYPE_WRITE:
q = &sock->write_q; q = &sock->write_q;
...@@ -788,6 +788,8 @@ DECL_HANDLER(enable_socket_event) ...@@ -788,6 +788,8 @@ DECL_HANDLER(enable_socket_event)
sock->pmask &= ~req->mask; /* is this safe? */ sock->pmask &= ~req->mask; /* is this safe? */
sock->hmask &= ~req->mask; sock->hmask &= ~req->mask;
if ( req->mask & FD_READ )
sock->hmask &= ~FD_CLOSE;
sock->state |= req->sstate; sock->state |= req->sstate;
sock->state &= ~req->cstate; sock->state &= ~req->cstate;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment