server: Check if we have waiting asyncs in sock_dispatch_asyncs() before clearing POLLOUT.
This commit is contained in:
parent
aac0998262
commit
da6e707850
2 changed files with 13 additions and 1 deletions
|
@ -3115,13 +3115,19 @@ struct send_udp_thread_param
|
||||||
static DWORD WINAPI send_udp_thread( void *param )
|
static DWORD WINAPI send_udp_thread( void *param )
|
||||||
{
|
{
|
||||||
struct send_udp_thread_param *p = param;
|
struct send_udp_thread_param *p = param;
|
||||||
|
static const TIMEVAL timeout_zero = {0};
|
||||||
static char buf[256];
|
static char buf[256];
|
||||||
|
fd_set writefds;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
WaitForSingleObject( p->start_event, INFINITE );
|
WaitForSingleObject( p->start_event, INFINITE );
|
||||||
for (i = 0; i < 256; ++i)
|
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 );
|
ret = send( p->sock, buf, sizeof(buf), 0 );
|
||||||
ok( ret == sizeof(buf), "got %d, error %u, i %u.\n", ret, WSAGetLastError(), i );
|
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. */
|
possible that this test fails due to dropped packets. */
|
||||||
|
|
||||||
/* peer 0 receives data from all other peers */
|
/* peer 0 receives data from all other peers */
|
||||||
|
static const TIMEVAL timeout_zero = {0};
|
||||||
struct sock_info peer[NUM_UDP_PEERS];
|
struct sock_info peer[NUM_UDP_PEERS];
|
||||||
char buf[16];
|
char buf[16];
|
||||||
int ss, i, n_recv, n_sent, ret;
|
int ss, i, n_recv, n_sent, ret;
|
||||||
|
@ -3142,6 +3149,7 @@ static void test_UDP(void)
|
||||||
int sock;
|
int sock;
|
||||||
struct send_udp_thread_param udp_thread_param;
|
struct send_udp_thread_param udp_thread_param;
|
||||||
HANDLE thread;
|
HANDLE thread;
|
||||||
|
fd_set writefds;
|
||||||
|
|
||||||
|
|
||||||
memset (buf,0,sizeof(buf));
|
memset (buf,0,sizeof(buf));
|
||||||
|
@ -3211,6 +3219,10 @@ static void test_UDP(void)
|
||||||
{
|
{
|
||||||
ret = send( sock, buf, sizeof(buf), 0 );
|
ret = send( sock, buf, sizeof(buf), 0 );
|
||||||
ok( ret == sizeof(buf), "got %d, error %u, i %u.\n", ret, WSAGetLastError(), i );
|
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 );
|
WaitForSingleObject( thread, INFINITE );
|
||||||
CloseHandle( thread );
|
CloseHandle( thread );
|
||||||
|
|
|
@ -1231,7 +1231,7 @@ static int sock_dispatch_asyncs( struct sock *sock, int event, int error )
|
||||||
event &= ~(POLLIN | POLLPRI);
|
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 ))
|
if (async_waiting( &sock->write_q ))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue