Browse Source

[1828] Close MsgQ socket in except block

Mukund Sivaraman 13 years ago
parent
commit
d96e91d14a
2 changed files with 1 additions and 1 deletions
  1. 1 0
      src/bin/msgq/msgq.py.in
  2. 0 1
      src/bin/msgq/tests/msgq_test.py

+ 1 - 0
src/bin/msgq/msgq.py.in

@@ -177,6 +177,7 @@ class MsgQ:
             # (note this is a catch-all, but we reraise it)
             if os.path.exists(self.socket_file):
                 os.remove(self.socket_file)
+            self.listen_socket.close()
             raise e
 
         if self.poller:

+ 0 - 1
src/bin/msgq/tests/msgq_test.py

@@ -111,7 +111,6 @@ class TestSubscriptionManager(unittest.TestCase):
     def test_open_socket_bad(self):
         msgq = MsgQ("/does/not/exist")
         self.assertRaises(socket.error, msgq.setup)
-        msgq.listen_socket.close()
 
 class SendNonblock(unittest.TestCase):
     """