ws2_32: Don't set FD_READ/FD_WRITE before the connection is complete.

This commit is contained in:
Mike Kaplinskiy 2010-07-31 23:21:28 -04:00 committed by Alexandre Julliard
parent 5288a22585
commit fae0b6fa63
2 changed files with 10 additions and 10 deletions

View File

@ -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))
{

View File

@ -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 )