Browse Source

Revert "[1828] Make code safer in case socket.socket() raises an exception"

This reverts commit e295b40a31dedb3671705ab44c2683624f3d541c.
Mukund Sivaraman 13 years ago
parent
commit
1fafcf498b
1 changed files with 6 additions and 6 deletions
  1. 6 6
      src/bin/xfrout/xfrout.py.in

+ 6 - 6
src/bin/xfrout/xfrout.py.in

@@ -804,13 +804,13 @@ class UnixSockServer(socketserver_mixin.NoPollMixIn,
         '''Check whether the socket file 'sock_file' exists and
         '''Check whether the socket file 'sock_file' exists and
         is being used by one running xfrout process. If it is,
         is being used by one running xfrout process. If it is,
         return True, or else return False. '''
         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)
                 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):
     def shutdown(self):
         self._write_sock.send(b"shutdown") #terminate the xfrout session thread
         self._write_sock.send(b"shutdown") #terminate the xfrout session thread