Zebediah Figura : server: Remove the socket from the polling loop if it was aborted.
Module: wine Branch: master Commit: 9bc5bc7c6628a69cef6e64facb8eb7e3cf2e269b URL: https://source.winehq.org/git/wine.git/?a=commit;h=9bc5bc7c6628a69cef6e64fac... Author: Zebediah Figura <zfigura(a)codeweavers.com> Date: Mon Jul 26 11:53:45 2021 -0500 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(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- server/sock.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/server/sock.c b/server/sock.c index 2d2aa733565..2660cf2dee0 100644 --- a/server/sock.c +++ b/server/sock.c @@ -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;
participants (1)
-
Alexandre Julliard