]> granicus.if.org Git - python/commitdiff
Merge 70717 to 26maint
authorJesse Noller <jnoller@gmail.com>
Mon, 30 Mar 2009 16:19:10 +0000 (16:19 +0000)
committerJesse Noller <jnoller@gmail.com>
Mon, 30 Mar 2009 16:19:10 +0000 (16:19 +0000)
Lib/multiprocessing/connection.py
Lib/test/test_multiprocessing.py
Misc/NEWS

index 1f0565852c3f0526b3b877da6f0bab1683a22647..59beaa0ae3a95cdf0c45394c7def76671123ce71 100644 (file)
@@ -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()
index d4ce4fa2fe8df2d9e21fa3371c7149861b72e5ac..aa4743f1274f85e0d73e2dbfe6f27ab663178f46 100644 (file)
@@ -1188,6 +1188,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()
+
 #
 #
 #
index aca1cc52000e437f4ab801160cc8d9fac2e7dbb9..f882ed922ae7563335a63a83ed78a93afc6f93cc 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -92,6 +92,13 @@ Core and Builtins
 Library
 -------
 
+- Issue #5177: Multiprocessing's SocketListener class now uses 
+  socket.SO_REUSEADDR on all connections so that the user no longer needs
+  to wait 120 seconds for the socket to expire.
+
+- Adjusted _tkinter to compile without warnings when WITH_THREAD is not
+  defined (part of issue #5035).
+
 - Issue #5561: Removed the sys.version_info shortcuts from platform's
   python_version() and python_version_tuple() since they produced different
   output compared to previous Python versions.