Fix awaits and debug output

M1nd3r/thp5
M1nd3r 2 months ago committed by M1nd3r
parent 948ca80a8b
commit e876b2023c

@ -116,7 +116,7 @@ async def _handle_single_message(
__name__,
"%s:%x receive: <%s>",
ctx.iface.iface_num(),
ctx.session_id,
int.from_bytes(ctx.session_id, "big"),
msg_type,
)
@ -232,8 +232,8 @@ async def handle_session(
msg = next_msg
next_msg = None
# Set ctx.session_id to the value msg.session_id
ctx.session_id = msg.session_id
# Set ctx.session_id to the value msg.session_id
ctx.session_id = msg.session_id
try:
next_msg = await _handle_single_message(

@ -103,7 +103,7 @@ class Context:
__name__,
"%s:%x expect: %s",
self.iface.iface_num(),
self.session_id,
int.from_bytes(self.session_id, "big"),
expected_type.MESSAGE_NAME if expected_type else expected_types,
)
@ -126,7 +126,7 @@ class Context:
__name__,
"%s:%x read: %s",
self.iface.iface_num(),
self.session_id,
int.from_bytes(self.session_id, "big"),
expected_type.MESSAGE_NAME,
)
@ -142,7 +142,7 @@ class Context:
__name__,
"%s:%x write: %s",
self.iface.iface_num(),
self.session_id,
int.from_bytes(self.session_id, "big"),
msg.MESSAGE_NAME,
)

@ -159,7 +159,7 @@ async def read_message_or_init_packet(
continue
# 3: Send ACK in response
_sendAck(iface, cid, sync_bit) # TODO await
await _sendAck(iface, cid, sync_bit)
THP.sync_set_receive_expected_bit(session, 1 - sync_bit)
return await _handle_allocated(ctrl_byte, session, payload)
@ -307,7 +307,7 @@ async def _handle_broadcast(iface: WireInterface, ctrl_byte, report) -> Message
)
checksum = _compute_checksum_bytes(response_header.to_bytes() + response_data)
write_to_wire(iface, response_header, response_data + checksum) # TODO await
await write_to_wire(iface, response_header, response_data + checksum)
async def _handle_allocated(ctrl_byte, session: SessionThpCache, payload) -> Message:

Loading…
Cancel
Save