8000 gh-93821: Fix bug that accepting a socket connection and ERROR_NETNAME_DELETED occurs causes serving socket to be closed by StanHatko · Pull Request #124032 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-93821: Fix bug that accepting a socket connection and ERROR_NETNAME_DELETED occurs causes serving socket to be closed #124032

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Omit unnecessary winerror check and improve comment
No need for checking winerror present as windows_events.py only imported on Windows (with check near top).

Make comment more clear as to purpose of this patch.
  • Loading branch information
StanHatko authored Sep 13, 2024
commit a5fcc88b56922761a0dfd8f5978f2926ca54a328
7 changes: 3 additions & 4 deletions Lib/asyncio/windows_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,10 +556,9 @@ def finish_accept(trans, key, ov):
try:
ov.getresult()
except OSError as exc:
# Fix bug when accepting a socket connection and ERROR_NETNAME_DELETED
# occurs, leads this into a closing of the serving socket.
if hasattr(exc, 'winerror') and exc.winerror in (
_overlapped.ERROR_NETNAME_DELETED,
# If ERROR_NETNAME_DELETED or ERROR_OPERATION_ABORTED occur,
# do not close the serving socket.
if exc.winerror in (_overlapped.ERROR_NETNAME_DELETED,
_overlapped.ERROR_OPERATION_ABORTED):
conn.close()
raise ConnectionResetError(*exc.args)
Expand Down
Loading
0