From fae0b6fa63358c9b2881314bc0f30333c4637517 Mon Sep 17 00:00:00 2001 From: Mike Kaplinskiy Date: Sat, 31 Jul 2010 23:21:28 -0400 Subject: [PATCH] ws2_32: Don't set FD_READ/FD_WRITE before the connection is complete. --- dlls/ws2_32/socket.c | 2 +- server/sock.c | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c index 2597c8d0d2..4b742e1083 100644 --- a/dlls/ws2_32/socket.c +++ b/dlls/ws2_32/socket.c @@ -1844,7 +1844,7 @@ int WINAPI WS_connect(SOCKET s, const struct WS_sockaddr* name, int namelen) { /* tell wineserver that a connection is in progress */ _enable_event(SOCKET2HANDLE(s), FD_CONNECT|FD_READ|FD_WRITE, - FD_CONNECT|FD_READ|FD_WRITE, + FD_CONNECT, FD_WINE_CONNECTED|FD_WINE_LISTENING); if (_is_blocking(s)) { diff --git a/server/sock.c b/server/sock.c index 4922d64c52..24ad50c18d 100644 --- a/server/sock.c +++ b/server/sock.c @@ -524,6 +524,7 @@ static enum server_fd_type sock_get_fd_type( struct fd *fd ) static void sock_queue_async( struct fd *fd, const async_data_t *data, int type, int count ) { struct sock *sock = get_fd_user( fd ); + struct async *async; struct async_queue *queue; assert( sock->obj.ops == &sock_ops ); @@ -543,20 +544,19 @@ static void sock_queue_async( struct fd *fd, const async_data_t *data, int type, return; } - if ( ( !( sock->state & FD_READ ) && type == ASYNC_TYPE_READ ) || - ( !( sock->state & FD_WRITE ) && type == ASYNC_TYPE_WRITE ) ) + if ( ( !( sock->state & (FD_READ|FD_CONNECT) ) && type == ASYNC_TYPE_READ ) || + ( !( sock->state & (FD_WRITE|FD_CONNECT) ) && type == ASYNC_TYPE_WRITE ) ) { set_error( STATUS_PIPE_DISCONNECTED ); - } - else - { - struct async *async; - if (!(async = create_async( current, queue, data ))) return; - release_object( async ); - set_error( STATUS_PENDING ); + return; } + if (!(async = create_async( current, queue, data ))) return; + release_object( async ); + sock_reselect( sock ); + + set_error( STATUS_PENDING ); } static void sock_reselect_async( struct fd *fd, struct async_queue *queue )