From: Mukund Sivaraman Date: Thu, 14 Jun 2012 07:05:17 +0000 (+0530) Subject: [1828] Close MsgQ socket in except block X-Git-Tag: trac2351_base~226^2~42^2~1^2~18 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d96e91d14a55046b741dbc49eaa1b5fac5efc8d0;p=thirdparty%2Fkea.git [1828] Close MsgQ socket in except block --- diff --git a/src/bin/msgq/msgq.py.in b/src/bin/msgq/msgq.py.in index 333ae896d8..58b1d87229 100755 --- a/src/bin/msgq/msgq.py.in +++ b/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: diff --git a/src/bin/msgq/tests/msgq_test.py b/src/bin/msgq/tests/msgq_test.py index 4059ea99ef..cc078f41e8 100644 --- a/src/bin/msgq/tests/msgq_test.py +++ b/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): """