From 8599e2d320e0e49a3e4175cfa4775164be426e66 Mon Sep 17 00:00:00 2001 From: M1nd3r Date: Tue, 29 Oct 2024 10:11:17 +0100 Subject: [PATCH] wip --- core/src/trezor/wire/thp/channel.py | 7 +++++++ core/src/trezor/wire/thp/transmission_loop.py | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/core/src/trezor/wire/thp/channel.py b/core/src/trezor/wire/thp/channel.py index 4c35682390..4e4c08728e 100644 --- a/core/src/trezor/wire/thp/channel.py +++ b/core/src/trezor/wire/thp/channel.py @@ -355,6 +355,7 @@ class Channel: ENCRYPTED_TRANSPORT, memoryview(self.buffer[:payload_length]) ) ) + utils.print_and_update_alloc("After establishing write task spawn") return None def write_handshake_message(self, ctrl_byte: int, payload: bytes) -> None: @@ -370,6 +371,8 @@ class Channel: async def _write_encrypted_payload_loop( self, ctrl_byte: int, payload: bytes ) -> None: + utils.print_and_update_alloc("Write encrypted payload loop start") + if __debug__ and utils.ALLOW_DEBUG_MESSAGES: log.debug( __name__, @@ -381,12 +384,16 @@ class Channel: ctrl_byte = control_byte.add_seq_bit_to_ctrl_byte(ctrl_byte, sync_bit) header = PacketHeader(ctrl_byte, self.get_channel_id_int(), payload_len) self.transmission_loop = TransmissionLoop(self, header, payload) + utils.print_and_update_alloc("Write encrypted payload loop before transmission") + await self.transmission_loop.start() + utils.print_and_update_alloc("Write encrypted payload loop after transmission") ABP.set_send_seq_bit_to_opposite(self.channel_cache) # Let the main loop be restarted and clear loop, if there is no other # workflow and the state is ENCRYPTED_TRANSPORT + if self._can_clear_loop(): if __debug__ and utils.ALLOW_DEBUG_MESSAGES: log.debug( diff --git a/core/src/trezor/wire/thp/transmission_loop.py b/core/src/trezor/wire/thp/transmission_loop.py index 529499f84f..0c350a36ff 100644 --- a/core/src/trezor/wire/thp/transmission_loop.py +++ b/core/src/trezor/wire/thp/transmission_loop.py @@ -1,7 +1,7 @@ from micropython import const from typing import TYPE_CHECKING -from trezor import loop +from trezor import loop, utils from trezor.wire.thp.thp_messages import PacketHeader from trezor.wire.thp.writer import write_payload_to_wire_and_add_checksum @@ -24,6 +24,7 @@ class TransmissionLoop: self.min_retransmisson_count_achieved: bool = False async def start(self, max_retransmission_count: int = MAX_RETRANSMISSION_COUNT): + utils.print_and_update_alloc("TransmissionLoop - start of start") self.min_retransmisson_count_achieved = False for i in range(max_retransmission_count): if i >= MIN_RETRANSMISSION_COUNT: