Commit da6e7078 authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

server: Check if we have waiting asyncs in sock_dispatch_asyncs() before clearing POLLOUT.

parent aac09982
......@@ -3115,13 +3115,19 @@ struct send_udp_thread_param
static DWORD WINAPI send_udp_thread( void *param )
{
struct send_udp_thread_param *p = param;
static const TIMEVAL timeout_zero = {0};
static char buf[256];
fd_set writefds;
unsigned int i;
int ret;
WaitForSingleObject( p->start_event, INFINITE );
for (i = 0; i < 256; ++i)
{
FD_ZERO(&writefds);
FD_SET(p->sock, &writefds);
ret = select( 1, NULL, &writefds, NULL, &timeout_zero );
ok( ret == 1, "got %d, i %u.\n", ret, i );
ret = send( p->sock, buf, sizeof(buf), 0 );
ok( ret == sizeof(buf), "got %d, error %u, i %u.\n", ret, WSAGetLastError(), i );
}
......@@ -3135,6 +3141,7 @@ static void test_UDP(void)
possible that this test fails due to dropped packets. */
/* peer 0 receives data from all other peers */
static const TIMEVAL timeout_zero = {0};
struct sock_info peer[NUM_UDP_PEERS];
char buf[16];
int ss, i, n_recv, n_sent, ret;
......@@ -3142,6 +3149,7 @@ static void test_UDP(void)
int sock;
struct send_udp_thread_param udp_thread_param;
HANDLE thread;
fd_set writefds;
memset (buf,0,sizeof(buf));
......@@ -3211,6 +3219,10 @@ static void test_UDP(void)
{
ret = send( sock, buf, sizeof(buf), 0 );
ok( ret == sizeof(buf), "got %d, error %u, i %u.\n", ret, WSAGetLastError(), i );
FD_ZERO(&writefds);
FD_SET(sock, &writefds);
ret = select( 1, NULL, &writefds, NULL, &timeout_zero );
ok( ret == 1, "got %d, i %u.\n", ret, i );
}
WaitForSingleObject( thread, INFINITE );
CloseHandle( thread );
......
......@@ -1231,7 +1231,7 @@ static int sock_dispatch_asyncs( struct sock *sock, int event, int error )
event &= ~(POLLIN | POLLPRI);
}
if ((event & POLLOUT) && async_queued( &sock->write_q ))
if ((event & POLLOUT) && async_queue_has_waiting_asyncs( &sock->write_q ))
{
if (async_waiting( &sock->write_q ))
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment