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.animInverted = False
self.ui.progressBar.setInvertedAppearance(self.animInverted)
self.animTimer.start(40)
if self.animTimer:
self.animTimer.start(40)
def stopAnim(self):
self.ui.progressBar.invertedAppearance = False # type: ignore
self.animTimer.stop()
if self.animTimer:
self.animTimer.stop()
def getVersion(self):
try:

View File

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

View File

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