mirror of
https://github.com/python/cpython.git
synced 2025-12-04 16:43:27 +00:00
Issue #13215: multiprocessing.Connection: don't hammer the remote end with
retries in case of ECONNREFUSED.
This commit is contained in:
parent
e532456965
commit
e6eabd4345
1 changed files with 1 additions and 15 deletions
|
|
@ -608,21 +608,7 @@ def SocketClient(address):
|
||||||
'''
|
'''
|
||||||
family = address_type(address)
|
family = address_type(address)
|
||||||
with socket.socket( getattr(socket, family) ) as s:
|
with socket.socket( getattr(socket, family) ) as s:
|
||||||
t = _init_timeout()
|
|
||||||
|
|
||||||
while 1:
|
|
||||||
try:
|
|
||||||
s.connect(address)
|
s.connect(address)
|
||||||
except socket.error as e:
|
|
||||||
if e.args[0] != errno.ECONNREFUSED or _check_timeout(t):
|
|
||||||
debug('failed to connect to address %s', address)
|
|
||||||
raise
|
|
||||||
time.sleep(0.01)
|
|
||||||
else:
|
|
||||||
break
|
|
||||||
else:
|
|
||||||
raise
|
|
||||||
|
|
||||||
fd = duplicate(s.fileno())
|
fd = duplicate(s.fileno())
|
||||||
conn = Connection(fd)
|
conn = Connection(fd)
|
||||||
return conn
|
return conn
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue