1
0
mirror of https://github.com/dkmstr/openuds.git synced 2024-12-22 13:34:04 +03:00

fixed bad ssl handshake management

This commit is contained in:
Adolfo Gómez García 2023-05-21 16:49:04 +02:00
parent 2c77d361d7
commit 084e0cc2a0
No known key found for this signature in database
GPG Key ID: DD1ABF20724CDA23
2 changed files with 8 additions and 3 deletions

View File

@ -97,6 +97,9 @@ class Proxy:
logger.error('ERROR on %s:%s: %s', src_ip, src_port, e) logger.error('ERROR on %s:%s: %s', src_ip, src_port, e)
if tun: if tun:
tun.close_connection() tun.close_connection()
# Also, ensure socket is closed
if source:
del source
logger.debug('Proxy finished') logger.debug('Proxy finished')

View File

@ -275,10 +275,12 @@ class TunnelProtocol(asyncio.Protocol):
def close_connection(self): def close_connection(self):
try: try:
self.clean_timeout() # If a timeout is set, clean it self.clean_timeout() # If a timeout is set, clean it
if not self.transport.is_closing(): if not self.transport.is_closing(): # Attribute may alreade not be set
self.transport.close() self.transport.close()
except Exception: # nosec: best effort except AttributeError: # not initialized transport, fine...
pass # Ignore errors pass
except Exception as e: # nosec: best effort
logger.error('ERROR closing connection: %s', e)
def notify_end(self): def notify_end(self):
if self.notify_ticket: if self.notify_ticket: