mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
gh-127529: Correct asyncio's accept_connection
behaviour for handling ConnectionAbortedError
(#127532)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
This commit is contained in:
parent
bb2dfadb92
commit
830e10651b
3 changed files with 36 additions and 3 deletions
|
@ -180,9 +180,13 @@ class BaseSelectorEventLoop(base_events.BaseEventLoop):
|
|||
logger.debug("%r got a new connection from %r: %r",
|
||||
server, addr, conn)
|
||||
conn.setblocking(False)
|
||||
except (BlockingIOError, InterruptedError, ConnectionAbortedError):
|
||||
# Early exit because the socket accept buffer is empty.
|
||||
return None
|
||||
except ConnectionAbortedError:
|
||||
# Discard connections that were aborted before accept().
|
||||
continue
|
||||
except (BlockingIOError, InterruptedError):
|
||||
# Early exit because of a signal or
|
||||
# the socket accept buffer is empty.
|
||||
return
|
||||
except OSError as exc:
|
||||
# There's nowhere to send the error, so just log it.
|
||||
if exc.errno in (errno.EMFILE, errno.ENFILE,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue