Added more info to UDSClient and small typo fixed

This commit is contained in:
Adolfo Gómez García 2021-07-01 22:04:24 +02:00
parent e38cd73f30
commit 4be9e9ea69
3 changed files with 12 additions and 4 deletions

View File

@ -128,11 +128,13 @@ class UDSClient(QtWidgets.QMainWindow):
self.anim = 0 self.anim = 0
self.animInverted = False self.animInverted = False
self.ui.progressBar.setInvertedAppearance(self.animInverted) self.ui.progressBar.setInvertedAppearance(self.animInverted)
self.animTimer.start(40) if self.animTimer:
self.animTimer.start(40)
def stopAnim(self): def stopAnim(self):
self.ui.progressBar.invertedAppearance = False # type: ignore self.ui.progressBar.invertedAppearance = False # type: ignore
self.animTimer.stop() if self.animTimer:
self.animTimer.stop()
def getVersion(self): def getVersion(self):
try: try:

View File

@ -93,6 +93,7 @@ class Handler(socketserver.BaseRequestHandler):
class ForwardThread(threading.Thread): class ForwardThread(threading.Thread):
status = 0 # Connecting status = 0 # Connecting
client: typing.Optional[paramiko.SSHClient] client: typing.Optional[paramiko.SSHClient]
fs: typing.Optional[ForwardServer]
def __init__(self, server, port, username, password, localPort, redirectHost, redirectPort, waitTime, fingerPrints): def __init__(self, server, port, username, password, localPort, redirectHost, redirectPort, waitTime, fingerPrints):
threading.Thread.__init__(self) threading.Thread.__init__(self)
@ -180,7 +181,9 @@ class ForwardThread(threading.Thread):
self.timer.cancel() self.timer.cancel()
self.stopEvent.set() self.stopEvent.set()
self.fs.shutdown()
if self.fs:
self.fs.shutdown()
if self.client is not None: if self.client is not None:
self.client.useCount -= 1 # type: ignore self.client.useCount -= 1 # type: ignore

View File

@ -132,12 +132,15 @@ class ForwardServer(socketserver.ThreadingTCPServer):
if self.status == TUNNEL_ERROR: if self.status == TUNNEL_ERROR:
return False return False
logger.debug('Checking tunnel availability')
try: try:
with self.connect() as ssl_socket: with self.connect() as ssl_socket:
ssl_socket.sendall(HANDSHAKE_V1 + b'TEST') ssl_socket.sendall(HANDSHAKE_V1 + b'TEST')
resp = ssl_socket.recv(2) resp = ssl_socket.recv(2)
if resp != b'OK': if resp != b'OK':
raise Exception({'Invalid tunnelresponse: {resp}'}) raise Exception({'Invalid tunnelresponse: {resp}'})
logger.debug('Tunnel is available!')
return True return True
except Exception as e: except Exception as e:
logger.error( logger.error(
@ -220,7 +223,7 @@ class Handler(socketserver.BaseRequestHandler):
if not data: if not data:
break break
self.request.sendall(data) self.request.sendall(data)
logger.debug('Finished tunnel with ticekt %s', self.server.ticket) logger.debug('Finished tunnel with ticket %s', self.server.ticket)
except Exception as e: except Exception as e:
pass pass