1
0
mirror of https://github.com/dkmstr/openuds.git synced 2025-03-11 00:58:39 +03:00

Fixed tunnel logging errors

This commit is contained in:
Adolfo Gómez García 2024-01-16 17:16:36 +01:00
parent 7966bdae26
commit 38f766ce3e
No known key found for this signature in database
GPG Key ID: DD1ABF20724CDA23
2 changed files with 4 additions and 3 deletions

View File

@ -244,15 +244,14 @@ class TunnelProtocol(asyncio.Protocol):
self.clean_timeout() # Stop timeout
logger.info('COMMAND: TEST')
self.transport.write(consts.RESPONSE_OK)
self.close_connection()
return
if command in (consts.COMMAND_STAT, consts.COMMAND_INFO):
# This is an stats requests
self.clean_timeout() # Stop timeout
try:
self.process_stats(full=command == consts.COMMAND_STAT)
except Exception as e:
logger.error('ERROR processing stats: %s', e.args[0] if e.args else e)
self.close_connection()
return
raise Exception('Invalid command')
except Exception:
@ -326,7 +325,7 @@ class TunnelProtocol(asyncio.Protocol):
self.runner(data) # send data to current runner (command or proxy)
def connection_lost(self, exc: typing.Optional[Exception]) -> None:
if exc: # Log if there is an exception
if exc and self.notify_ticket: # Log if there is an exception and is not testing...
logger.error('CONNECTION LOST: %s', exc)
# Ensure close other side if not server_side
if self.client:

View File

@ -72,6 +72,8 @@ class TunnelClientProtocol(asyncio.Protocol):
def connection_lost(self, exc: typing.Optional[Exception]) -> None:
# Ensure close other side if not server_side
if exc:
logger.error('CLIENT CONNECTION LOST: %s', exc)
try:
self.receiver.close_connection()
except Exception: