summaryrefslogtreecommitdiffstats
path: root/Lib/multiprocessing
diff options
context:
space:
mode:
authorRichard Oudkerk <shibturn@gmail.com>2012-07-27 13:19:00 (GMT)
committerRichard Oudkerk <shibturn@gmail.com>2012-07-27 13:19:00 (GMT)
commitb15e622bb884085a01a0095fb611005680ed68f7 (patch)
treeeef859348e8033b7d63831e199a327a4676b412d /Lib/multiprocessing
parent46874ad367c2f3fdd47b2c8cb4b405bbcb2ed14a (diff)
downloadcpython-b15e622bb884085a01a0095fb611005680ed68f7.zip
cpython-b15e622bb884085a01a0095fb611005680ed68f7.tar.gz
cpython-b15e622bb884085a01a0095fb611005680ed68f7.tar.bz2
Issue #6056: Make multiprocessing use setblocking(True) on the sockets it uses.
Original patch by J Derek Wilson.
Diffstat (limited to 'Lib/multiprocessing')
-rw-r--r--Lib/multiprocessing/connection.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/multiprocessing/connection.py b/Lib/multiprocessing/connection.py
index e5694e3..fbbd5d9 100644
--- a/Lib/multiprocessing/connection.py
+++ b/Lib/multiprocessing/connection.py
@@ -497,6 +497,8 @@ if sys.platform != 'win32':
'''
if duplex:
s1, s2 = socket.socketpair()
+ s1.setblocking(True)
+ s2.setblocking(True)
c1 = Connection(s1.detach())
c2 = Connection(s2.detach())
else:
@@ -561,6 +563,7 @@ class SocketListener(object):
if os.name == 'posix':
self._socket.setsockopt(socket.SOL_SOCKET,
socket.SO_REUSEADDR, 1)
+ self._socket.setblocking(True)
self._socket.bind(address)
self._socket.listen(backlog)
self._address = self._socket.getsockname()
@@ -579,6 +582,7 @@ class SocketListener(object):
def accept(self):
s, self._last_accepted = self._socket.accept()
+ s.setblocking(True)
return Connection(s.detach())
def close(self):
@@ -593,6 +597,7 @@ def SocketClient(address):
'''
family = address_type(address)
with socket.socket( getattr(socket, family) ) as s:
+ s.setblocking(True)
s.connect(address)
return Connection(s.detach())