Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 2 additions & 0 deletions Lib/asyncio/proactor_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -858,6 +858,8 @@ def loop(f=None):
if self.is_closed():
return
f = self._proactor.accept(sock)
except ConnectionResetError:
self.call_soon(loop)
except OSError as exc:
if sock.fileno() != -1:
self.call_exception_handler({
Expand Down
11 changes: 10 additions & 1 deletion Lib/asyncio/windows_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,16 @@ def accept(self, listener):
ov.AcceptEx(listener.fileno(), conn.fileno())

def finish_accept(trans, key, ov):
ov.getresult()
try:
ov.getresult()
except OSError as exc:
# 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)
raise
# Use SO_UPDATE_ACCEPT_CONTEXT so getsockname() etc work.
buf = struct.pack('@P', listener.fileno())
conn.setsockopt(socket.SOL_SOCKET,
Expand Down
Loading