]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #18455: multiprocessing should not retry connect() with same socket.
authorRichard Oudkerk <shibturn@gmail.com>
Mon, 15 Jul 2013 17:37:48 +0000 (18:37 +0100)
committerRichard Oudkerk <shibturn@gmail.com>
Mon, 15 Jul 2013 17:37:48 +0000 (18:37 +0100)
Lib/multiprocessing/connection.py
Misc/NEWS

index a05173015107ff42174261ad966ce5c5ba358a33..1a29c36f63919216d707e5edb1eb7e031f4a2ae2 100644 (file)
@@ -294,15 +294,16 @@ def SocketClient(address):
     '''
     Return a connection object connected to the socket given by `address`
     '''
-    family = address_type(address)
-    s = socket.socket( getattr(socket, family) )
-    s.setblocking(True)
+    family = getattr(socket, address_type(address))
     t = _init_timeout()
 
     while 1:
+        s = socket.socket(family)
+        s.setblocking(True)
         try:
             s.connect(address)
         except socket.error, e:
+            s.close()
             if e.args[0] != errno.ECONNREFUSED or _check_timeout(t):
                 debug('failed to connect to address %s', address)
                 raise
index e074d7fc08c0e8f327236c85ee00679500a1631d..0b2dadfb81ecc11be252541731814bbdb30adfe2 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -26,6 +26,8 @@ Core and Builtins
 Library
 -------
 
+- Issue #18455: multiprocessing should not retry connect() with same socket.
+
 - Issue #18101: Tcl.split() now process Unicode strings nested in a tuple as it
   do with byte strings.