Issue #8184: multiprocessing: On Windows, don't set SO_REUSEADDR on Connection

sockets, and set FILE_FLAG_FIRST_PIPE_INSTANCE on named pipes, to make sure two
listeners can't bind to the same socket/pipe (or any existing socket/pipe).
This commit is contained in:
Charles-François Natali 2012-02-08 21:15:58 +01:00
parent 1aa54a417d
commit ed4a8fc095
4 changed files with 26 additions and 3 deletions

View file

@ -1779,6 +1779,17 @@ class _TestConnection(BaseTestCase):
self.assertRaises(RuntimeError, reduction.recv_handle, conn)
p.join()
class _TestListener(BaseTestCase):
ALLOWED_TYPES = ('processes')
def test_multiple_bind(self):
for family in self.connection.families:
l = self.connection.Listener(family=family)
self.addCleanup(l.close)
self.assertRaises(OSError, self.connection.Listener,
l.address, family)
class _TestListenerClient(BaseTestCase):
ALLOWED_TYPES = ('processes', 'threads')
@ -1799,6 +1810,7 @@ class _TestListenerClient(BaseTestCase):
self.assertEqual(conn.recv(), 'hello')
p.join()
l.close()
#
# Test of sending connection and socket objects between processes
#