Mike Kaplinskiy : ws2_32: Don't set FD_READ/ FD_WRITE before the connection is complete.
Alexandre Julliard
julliard at winehq.org
Tue Aug 3 13:10:35 CDT 2010
Module: wine
Branch: master
Commit: fae0b6fa63358c9b2881314bc0f30333c4637517
URL: http://source.winehq.org/git/wine.git/?a=commit;h=fae0b6fa63358c9b2881314bc0f30333c4637517
Author: Mike Kaplinskiy <mike.kaplinskiy at gmail.com>
Date: Sat Jul 31 23:21:28 2010 -0400
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 2597c8d..4b742e1 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 4922d64..24ad50c 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 );
+ return;
}
- else
- {
- struct async *async;
- if (!(async = create_async( current, queue, data ))) return;
- release_object( async );
- set_error( STATUS_PENDING );
- }
+
+ 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 )
More information about the wine-cvs
mailing list