cpython: 434301d9f664 (original) (raw)

Mercurial > cpython

changeset 74828:434301d9f664

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). [#8184]

Charles-François Natali neologix@free.fr
date Wed, 08 Feb 2012 21:15:58 +0100
parents 58bd6a58365d
children ca377b89ab6b
files Lib/multiprocessing/connection.py Lib/test/test_multiprocessing.py Misc/NEWS Modules/_multiprocessing/win32_functions.c
diffstat 4 files changed, 26 insertions(+), 3 deletions(-)[+] [-] Lib/multiprocessing/connection.py 11 Lib/test/test_multiprocessing.py 12 Misc/NEWS 5 Modules/_multiprocessing/win32_functions.c 1

line wrap: on

line diff

--- a/Lib/multiprocessing/connection.py +++ b/Lib/multiprocessing/connection.py @@ -544,7 +544,8 @@ else: obsize, ibsize = 0, BUFSIZE h1 = win32.CreateNamedPipe(

@@ -576,7 +577,10 @@ class SocketListener(object): def init(self, address, family, backlog=1): self._socket = socket.socket(getattr(socket, family)) try:

@@ -630,7 +634,8 @@ if sys.platform == 'win32': def init(self, address, backlog=None): self._address = address handle = win32.CreateNamedPipe(

--- a/Lib/test/test_multiprocessing.py +++ b/Lib/test/test_multiprocessing.py @@ -1779,6 +1779,17 @@ class _TestConnection(BaseTestCase): self.assertRaises(RuntimeError, reduction.recv_handle, conn) p.join() +class _TestListener(BaseTestCase): +

+

+ 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

#

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -472,6 +472,11 @@ Library

--- a/Modules/_multiprocessing/win32_functions.c +++ b/Modules/_multiprocessing/win32_functions.c @@ -784,6 +784,7 @@ create_win32_namespace(void) WIN32_CONSTANT(F_DWORD, ERROR_PIPE_BUSY); WIN32_CONSTANT(F_DWORD, ERROR_PIPE_CONNECTED); WIN32_CONSTANT(F_DWORD, ERROR_SEM_TIMEOUT);