summaryrefslogtreecommitdiffstats
path: root/Lib/multiprocessing/connection.py
diff options
context:
space:
mode:
authorRichard Oudkerk <shibturn@gmail.com>2012-07-27 13:05:46 (GMT)
committerRichard Oudkerk <shibturn@gmail.com>2012-07-27 13:05:46 (GMT)
commite4b9938d77950811a47fb673ecb4d4554a4efec1 (patch)
tree4e88901bac0a84717364acfa97131d10f9d47a51 /Lib/multiprocessing/connection.py
parent4f947dd97057ac528f9b9173934ae746fb9ece34 (diff)
downloadcpython-e4b9938d77950811a47fb673ecb4d4554a4efec1.zip
cpython-e4b9938d77950811a47fb673ecb4d4554a4efec1.tar.gz
cpython-e4b9938d77950811a47fb673ecb4d4554a4efec1.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/connection.py')
-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 a02793f..4421ac5 100644
--- a/Lib/multiprocessing/connection.py
+++ b/Lib/multiprocessing/connection.py
@@ -186,6 +186,8 @@ if sys.platform != 'win32':
'''
if duplex:
s1, s2 = socket.socketpair()
+ s1.setblocking(True)
+ s2.setblocking(True)
c1 = _multiprocessing.Connection(os.dup(s1.fileno()))
c2 = _multiprocessing.Connection(os.dup(s2.fileno()))
s1.close()
@@ -251,6 +253,7 @@ class SocketListener(object):
self._socket = socket.socket(getattr(socket, family))
try:
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()
@@ -269,6 +272,7 @@ class SocketListener(object):
def accept(self):
s, self._last_accepted = self._socket.accept()
+ s.setblocking(True)
fd = duplicate(s.fileno())
conn = _multiprocessing.Connection(fd)
s.close()
@@ -286,6 +290,7 @@ def SocketClient(address):
'''
family = address_type(address)
s = socket.socket( getattr(socket, family) )
+ s.setblocking(True)
t = _init_timeout()
while 1: