]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
Revert "[1828] Make code safer in case socket.socket() raises an exception"
authorMukund Sivaraman <muks@isc.org>
Mon, 18 Jun 2012 18:37:04 +0000 (00:07 +0530)
committerMukund Sivaraman <muks@isc.org>
Mon, 18 Jun 2012 18:37:04 +0000 (00:07 +0530)
This reverts commit e295b40a31dedb3671705ab44c2683624f3d541c.

src/bin/xfrout/xfrout.py.in

index 89bf701f893d0dfc944a2838a4719905777c32ff..23303333ace352ea117996c0323b48172afc3423 100755 (executable)
@@ -804,13 +804,13 @@ class UnixSockServer(socketserver_mixin.NoPollMixIn,
         '''Check whether the socket file 'sock_file' exists and
         is being used by one running xfrout process. If it is,
         return True, or else return False. '''
-        try:
-            with socket.socket(socket.AF_UNIX) as sock:
+        with socket.socket(socket.AF_UNIX) as sock:
+            try:
                 sock.connect(sock_file)
-        except socket.error as err:
-            return False
-        else:
-            return True
+            except socket.error as err:
+                return False
+            else:
+                return True
 
     def shutdown(self):
         self._write_sock.send(b"shutdown") #terminate the xfrout session thread