8000 Fix gh-127529: Correct asyncio.selector_events.BaseSelectorEventLoop.… · python/cpython@7ab3149 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7ab3149

Browse files
committed
Fix gh-127529: Correct asyncio.selector_events.BaseSelectorEventLoop._accept_connection's behaviour for handling ConnectionAbortedError
1 parent c430376 commit 7ab3149

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Lib/asyncio/selector_events.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,13 @@ def _accept_connection(
180180
logger.debug("%r got a new connection from %r: %r",
181181
server, addr, conn)
182182
conn.setblocking(False)
183-
except (BlockingIOError, InterruptedError, ConnectionAbortedError):
184-
# Early exit because the socket accept buffer is empty.
185-
return None
183+
except ConnectionAbortedError:
184+
# Discard connections that were aborted before accept().
185+
continue
186+
except (BlockingIOError, InterruptedError):
187+
# Early exit because of a signal or
188+
# the socket accept buffer is empty.
189+
return
186190
except OSError as exc:
187191
# There's nowhere to send the error, so just log it.
188192
if exc.errno in (errno.EMFILE, errno.ENFILE,

0 commit comments

Comments
 (0)
0