diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c index 19d29bf179c..b078b9f3381 100644 --- a/dlls/ws2_32/tests/sock.c +++ b/dlls/ws2_32/tests/sock.c @@ -3205,16 +3205,6 @@ static void test_events(int useMessages) ok_event_seq(src, hEvent, empty_seq, NULL, 0); } - /* wine gets a stale notifications because of the async ops, clear them. - * remove when sending messages during pending asyncs is fixed */ - ret = send(dst, "2", 1, 0); - ok(ret == 1, "Failed to send buffer %d err %d\n", ret, GetLastError()); - ok_event_seq(src, hEvent, read_seq, NULL, 0); - - ret = recv(src, buffer, 1, 0); - ok(ret == 1, "Failed to empty buffer: %d - %d\n", ret, GetLastError()); - ok_event_seq(src, hEvent, empty_seq, NULL, 0); - /* Flood the send queue */ hThread = CreateThread(NULL, 0, drain_socket_thread, &dst, 0, &id); if (hThread == NULL) diff --git a/server/sock.c b/server/sock.c index e5681b0eda4..36f6c7a4833 100644 --- a/server/sock.c +++ b/server/sock.c @@ -295,7 +295,7 @@ static inline int sock_error( struct fd *fd ) return optval; } -static void sock_dispatch_asyncs( struct sock *sock, int event, int error ) +static int sock_dispatch_asyncs( struct sock *sock, int event, int error ) { if ( sock->flags & WSA_FLAG_OVERLAPPED ) { @@ -303,11 +303,13 @@ static void sock_dispatch_asyncs( struct sock *sock, int event, int error ) { if (debug_level) fprintf( stderr, "activating read queue for socket %p\n", sock ); async_wake_up( sock->read_q, STATUS_ALERTED ); + event &= ~(POLLIN|POLLPRI); } if ( event & POLLOUT && async_waiting( sock->write_q ) ) { if (debug_level) fprintf( stderr, "activating write queue for socket %p\n", sock ); async_wake_up( sock->write_q, STATUS_ALERTED ); + event &= ~POLLOUT; } if ( event & (POLLERR|POLLHUP) ) { @@ -319,6 +321,7 @@ static void sock_dispatch_asyncs( struct sock *sock, int event, int error ) async_wake_up( sock->write_q, status ); } } + return event; } static void sock_dispatch_events( struct sock *sock, int prevstate, int event, int error ) @@ -451,7 +454,7 @@ static void sock_poll_event( struct fd *fd, int event ) event |= POLLHUP; } - sock_dispatch_asyncs( sock, event, error ); + event = sock_dispatch_asyncs( sock, event, error ); sock_dispatch_events( sock, prevstate, event, error ); /* if anyone is stupid enough to wait on the socket object itself,