diff options
author | Jesse Noller <jnoller@gmail.com> | 2009-03-30 16:37:36 (GMT) |
---|---|---|
committer | Jesse Noller <jnoller@gmail.com> | 2009-03-30 16:37:36 (GMT) |
commit | c5d28a0b034401ba9eb40aa5b8813845b3b4bb7a (patch) | |
tree | f0314ae44e5bb750236aa81d6e0c6313098c0efe /Lib | |
parent | 6ae7a7d13d2f1497b197f7d1c798536e3abd8b7a (diff) | |
download | cpython-c5d28a0b034401ba9eb40aa5b8813845b3b4bb7a.zip cpython-c5d28a0b034401ba9eb40aa5b8813845b3b4bb7a.tar.gz cpython-c5d28a0b034401ba9eb40aa5b8813845b3b4bb7a.tar.bz2 |
Merge 70717 to 30maint
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/multiprocessing/connection.py | 1 | ||||
-rw-r--r-- | Lib/test/test_multiprocessing.py | 24 |
2 files changed, 25 insertions, 0 deletions
diff --git a/Lib/multiprocessing/connection.py b/Lib/multiprocessing/connection.py index 1c4d48e..5e94fed 100644 --- a/Lib/multiprocessing/connection.py +++ b/Lib/multiprocessing/connection.py @@ -214,6 +214,7 @@ class SocketListener(object): ''' def __init__(self, address, family, backlog=1): self._socket = socket.socket(getattr(socket, family)) + self._socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) self._socket.bind(address) self._socket.listen(backlog) self._address = self._socket.getsockname() diff --git a/Lib/test/test_multiprocessing.py b/Lib/test/test_multiprocessing.py index 0f91c97..33f3bf3 100644 --- a/Lib/test/test_multiprocessing.py +++ b/Lib/test/test_multiprocessing.py @@ -1190,6 +1190,30 @@ class _TestRemoteManager(BaseTestCase): del queue manager.shutdown() +class _TestManagerRestart(BaseTestCase): + + def _putter(self, address, authkey): + manager = QueueManager( + address=address, authkey=authkey, serializer=SERIALIZER) + manager.connect() + queue = manager.get_queue() + queue.put('hello world') + + def test_rapid_restart(self): + authkey = os.urandom(32) + manager = QueueManager( + address=('localhost', 9999), authkey=authkey, serializer=SERIALIZER) + manager.start() + + p = self.Process(target=self._putter, args=(manager.address, authkey)) + p.start() + queue = manager.get_queue() + self.assertEqual(queue.get(), 'hello world') + manager.shutdown() + manager = QueueManager( + address=('localhost', 9999), authkey=authkey, serializer=SERIALIZER) + manager.start() + # # # |