From 04691826793deb56f62a55e081aafb01859f4c1d Mon Sep 17 00:00:00 2001 From: Viktor UZLOV Date: Tue, 27 Oct 2020 16:17:27 +0300 Subject: [PATCH] fix PortManager --- bin/PortManager.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) 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): -- 2.39.2