From: Viktor UZLOV Date: Tue, 27 Oct 2020 13:17:27 +0000 (+0300) Subject: fix PortManager X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=04691826793deb56f62a55e081aafb01859f4c1d;p=modules%2Fkernel.git fix PortManager --- diff --git a/bin/PortManager.py b/bin/PortManager.py index 0095b3906..0b05bb134 100644 --- a/bin/PortManager.py +++ b/bin/PortManager.py @@ -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):