]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
fix PortManager
authorViktor UZLOV <vuzlov@debian10-01.nnov.opencascade.com>
Tue, 27 Oct 2020 13:17:27 +0000 (16:17 +0300)
committerViktor UZLOV <vuzlov@debian10-01.nnov.opencascade.com>
Tue, 27 Oct 2020 13:17:27 +0000 (16:17 +0300)
bin/PortManager.py

index 0095b39063e548bbd840f4a4c5a1e6188c178480..0b05bb13405d70f26ae5d18dc09885d00d89bd7c 100644 (file)
@@ -107,15 +107,8 @@ def __isPortUsed(port, config):
 
 def __isNetworkConnectionActiveOnPort(port):
   # psutil realization
-  ports =[]
-  template = (AF_INET, SOCK_STREAM, "LISTEN")
-  for c in psutil.net_connections(kind='inet'):
-    if (c.family, c.type, c.status) == template:
-      ports.append(c.laddr.port)
-  if port in ports:
-    return True
-  else:
-    return False
+  return port in [c.laddr.port for c in psutil.net_connections(kind='inet') if \
+      (c.family, c.type, c.status) == (AF_INET, SOCK_STREAM, "LISTEN")]
   #
 
 def getPort(preferredPort=None):