From: Kean Johnston Date: Thu, 24 Oct 2013 15:49:06 +0000 (+0200) Subject: [433] Use a local variable rather than one larger in scope X-Git-Tag: bind10-1.2.0beta1-release~102^2~38^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d67f893b43f1c293d7342dbd02a6cbf044d3a201;p=thirdparty%2Fkea.git [433] Use a local variable rather than one larger in scope As per review, don't use self._session for the check to see if there is an existing message queue running. Rather, use a localally scoped variable that will get cleaned up when the function exits. --- diff --git a/src/bin/msgq/msgq.py.in b/src/bin/msgq/msgq.py.in index a28d97eaa4..7346f7edd0 100755 --- a/src/bin/msgq/msgq.py.in +++ b/src/bin/msgq/msgq.py.in @@ -275,16 +275,14 @@ class MsgQ: # connect to the existing socket to see if there is an existing # msgq running. Only if that fails do we remove the file and # attempt to create a new socket. - existing_msgq = True + existing_msgq = None try: - self._session = isc.cc.Session(self.socket_file) + existing_msgq = isc.cc.Session(self.socket_file) except isc.cc.session.SessionError: - existing_msgq = False - - self._session.close() - self._session = None + existing_msgq = None if existing_msgq: + existing_msgq.close() logger.fatal(MSGQ_ALREADY_RUNNING) raise MsgQRunningError("b10-msgq already running")