]> granicus.if.org Git - python/commitdiff
fix leaking sockets
authorBenjamin Peterson <benjamin@python.org>
Sun, 31 Oct 2010 17:34:34 +0000 (17:34 +0000)
committerBenjamin Peterson <benjamin@python.org>
Sun, 31 Oct 2010 17:34:34 +0000 (17:34 +0000)
Lib/test/test_asyncore.py

index 545046825257da85e54c8679f08ce9e04146b40c..57e759dffe09327e078f9d82f8644eed7fd2aa4a 100644 (file)
@@ -564,6 +564,7 @@ class BaseTestAPI(unittest.TestCase):
                 asyncore.dispatcher.handle_accept(self)
 
             def handle_accepted(self, sock, addr):
+                sock.close()
                 self.flag = True
 
         server = TestListener()
@@ -721,6 +722,7 @@ class BaseTestAPI(unittest.TestCase):
             s = asyncore.dispatcher(socket.socket())
             self.assertFalse(s.socket.getsockopt(socket.SOL_SOCKET,
                                                  socket.SO_REUSEADDR))
+            s.socket.close()
             s.create_socket(socket.AF_INET, socket.SOCK_STREAM)
             s.set_reuse_addr()
             self.assertTrue(s.socket.getsockopt(socket.SOL_SOCKET,