mirror of
https://github.com/python/cpython.git
synced 2025-08-02 16:13:13 +00:00
[3.11] gh-91227: Ignore ERROR_PORT_UNREACHABLE in proactor recvfrom() (GH-32011) (GH-117210)
(cherry picked from commit f11d0d8be8
)
Co-authored-by: Erik Soma <stillusingirc@gmail.com>
This commit is contained in:
parent
a3a0ce1b2f
commit
6261322e26
5 changed files with 165 additions and 0 deletions
|
@ -513,6 +513,10 @@ class IocpProactor:
|
|||
try:
|
||||
return ov.getresult()
|
||||
except OSError as exc:
|
||||
# WSARecvFrom will report ERROR_PORT_UNREACHABLE when the same
|
||||
# socket is used to send to an address that is not listening.
|
||||
if exc.winerror == _overlapped.ERROR_PORT_UNREACHABLE:
|
||||
return b'', None
|
||||
if exc.winerror in (_overlapped.ERROR_NETNAME_DELETED,
|
||||
_overlapped.ERROR_OPERATION_ABORTED):
|
||||
raise ConnectionResetError(*exc.args)
|
||||
|
@ -533,6 +537,10 @@ class IocpProactor:
|
|||
try:
|
||||
return ov.getresult()
|
||||
except OSError as exc:
|
||||
# WSARecvFrom will report ERROR_PORT_UNREACHABLE when the same
|
||||
# socket is used to send to an address that is not listening.
|
||||
if exc.winerror == _overlapped.ERROR_PORT_UNREACHABLE:
|
||||
return 0, None
|
||||
if exc.winerror in (_overlapped.ERROR_NETNAME_DELETED,
|
||||
_overlapped.ERROR_OPERATION_ABORTED):
|
||||
raise ConnectionResetError(*exc.args)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue