wineserver: Avoid spurious FD_WRITE on repeated calls to WSAEventSelect().

Repeated calls to WSAEventSelect() with FD_WRITE deliver
spurious FD_WRITE events, as the flag isn't held, resulting
in us unnecessarily polling the socket for writability,
despite the fact FD_WRITE should only be delivered (1) initially
on socket creation, and (2) after send[to]() fails with
EWOULDBLOCK and buffer space becomes available.

Signed-off-by: Damjan Jovanovic <damjan.jov@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Damjan Jovanovic 2019-12-20 04:16:05 +02:00 committed by Alexandre Julliard
parent a6734f549f
commit b4a1d80ae3
2 changed files with 3 additions and 4 deletions

View File

@ -3053,9 +3053,8 @@ static void test_WSAEnumNetworkEvents(void)
}
else
{
todo_wine_if (i != 0) /* Remove when fixed */
ok (net_events.lNetworkEvents == 0, "Test[%d]: expected 0, got %d\n",
i, net_events.lNetworkEvents);
ok (net_events.lNetworkEvents == 0, "Test[%d]: expected 0, got %d\n",
i, net_events.lNetworkEvents);
}
for (k = 0; k < FD_MAX_EVENTS; k++)
{

View File

@ -1228,7 +1228,7 @@ DECL_HANDLER(set_socket_event)
FILE_WRITE_ATTRIBUTES, &sock_ops))) return;
old_event = sock->event;
sock->mask = req->mask;
sock->hmask &= ~req->mask; /* re-enable held events */
sock->hmask &= (FD_WRITE | ~req->mask); /* re-enable held events */
sock->event = NULL;
sock->window = req->window;
sock->message = req->msg;