1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-01-10 15:30:55 +00:00

fix(core): update comments, refactor debug log in session context

[no changelog]
This commit is contained in:
M1nd3r 2025-01-06 16:06:08 +01:00
parent 7d59d23f65
commit a785f83af0
2 changed files with 7 additions and 10 deletions

View File

@ -214,7 +214,7 @@ if utils.USE_THP:
) -> ThpNewSession | Failure: ) -> ThpNewSession | Failure:
""" """
Creates a new `ThpSession` based on the provided parameters and returns a Creates a new `ThpSession` based on the provided parameters and returns a
`ThpNewSession` message containing the new session ID. `Success` message on success.
Returns an appropriate `Failure` message if session creation fails. Returns an appropriate `Failure` message if session creation fails.
""" """

View File

@ -37,7 +37,12 @@ class GenericSessionContext(Context):
async def handle(self) -> None: async def handle(self) -> None:
if __debug__ and utils.ALLOW_DEBUG_MESSAGES: if __debug__ and utils.ALLOW_DEBUG_MESSAGES:
self._handle_debug() log.debug(
__name__,
"handle - start (channel_id (bytes): %s, session_id: %d)",
get_bytes_as_str(self.channel_id),
self.session_id,
)
next_message: Message | None = None next_message: Message | None = None
@ -58,14 +63,6 @@ class GenericSessionContext(Context):
if __debug__: if __debug__:
log.exception(__name__, exc) log.exception(__name__, exc)
def _handle_debug(self) -> None:
log.debug(
__name__,
"handle - start (channel_id (bytes): %s, session_id: %d)",
get_bytes_as_str(self.channel_id),
self.session_id,
)
async def _handle_message( async def _handle_message(
self, self,
next_message: Message | None, next_message: Message | None,