1
0
Fork 0
mirror of synced 2025-03-07 03:53:26 +01:00

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

This commit is contained in:
Paul Gofman 2024-01-29 17:13:33 -06:00 committed by Alexandre Julliard
parent aac0998262
commit da6e707850
2 changed files with 13 additions and 1 deletions

View file

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

View file

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