Module: wine Branch: master Commit: 0b251c08f2e9e2693beb9a1f1ed72286d634cb3b URL: http://source.winehq.org/git/wine.git/?a=commit;h=0b251c08f2e9e2693beb9a1f1e...
Author: Mike Kaplinskiy mike.kaplinskiy@gmail.com Date: Tue Jul 27 00:16:18 2010 -0400
server: Consume events triggered.
---
dlls/ws2_32/tests/sock.c | 10 ---------- server/sock.c | 7 +++++-- 2 files changed, 5 insertions(+), 12 deletions(-)
diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c index 19d29bf..b078b9f 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 e5681b0..36f6c7a 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,