1
0
mirror of https://github.com/dkmstr/openuds.git synced 2025-10-20 11:33:38 +03:00

Fixing tunnel & client for mac

This commit is contained in:
Adolfo Gómez García
2021-07-03 21:48:38 +02:00
parent 9ca3a7cdeb
commit a359ff2263
2 changed files with 18 additions and 5 deletions

View File

@@ -22,8 +22,19 @@ class UdsApplication(QtWidgets.QApplication):
self.lastWindowClosed.connect(self.closeTunnels) # type: ignore
def cleanTunnels(self) -> None:
for k in [i for i, tunnel in enumerate(self.tunnels) if tunnel.poll() is not None]:
del self.tunnels[k]
def isRunning(p: subprocess.Popen):
try:
if p.poll() is None:
return True
except Exception as e:
logger.debug('Got error polling subprocess: %s', e)
return False
for k in [i for i, tunnel in enumerate(self.tunnels) if not isRunning(tunnel)]:
try:
del self.tunnels[k]
except Exception as e:
logger.debug('Error closing tunnel: %s', e)
def closeTunnels(self) -> None:
logger.debug('Closing remaining tunnels')