server: Remove the socket from the polling loop if it was aborted.

Don't use rd_shutdown and wr_shutdown to determine this. On the one hand, it's
possible to have pending asyncs even if rd_shutdown && wr_shutdown, which will
be cheerfully completed upon receiving data. On the other hand, RST doesn't
cause WSAESHUTDOWN, but rather WSAECONNRESET.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2021-07-26 11:53:45 -05:00 committed by Alexandre Julliard
parent 361435f609
commit 9bc5bc7c66
1 changed files with 6 additions and 2 deletions

View File

@ -215,6 +215,7 @@ struct sock
unsigned int wr_shutdown : 1; /* is the write end shut down? */
unsigned int wr_shutdown_pending : 1; /* is a write shutdown pending? */
unsigned int hangup : 1; /* has the read end received a hangup? */
unsigned int aborted : 1; /* did we get a POLLERR or irregular POLLHUP? */
unsigned int nonblocking : 1; /* is the socket nonblocking? */
unsigned int bound : 1; /* is the socket bound? */
};
@ -1079,8 +1080,7 @@ static void sock_poll_event( struct fd *fd, int event )
}
else if (event & (POLLHUP | POLLERR))
{
sock->rd_shutdown = 1;
sock->wr_shutdown = 1;
sock->aborted = 1;
if (debug_level)
fprintf( stderr, "socket %p aborted by error %d, event %#x\n", sock, error, event );
@ -1175,6 +1175,9 @@ static int sock_get_poll_events( struct fd *fd )
return -1;
}
if (sock->aborted)
return -1;
if (sock->accept_recv_req)
{
ev |= POLLIN;
@ -1403,6 +1406,7 @@ static struct sock *create_socket(void)
sock->wr_shutdown = 0;
sock->wr_shutdown_pending = 0;
sock->hangup = 0;
sock->aborted = 0;
sock->nonblocking = 0;
sock->bound = 0;
sock->rcvbuf = 0;