|
|
|
@ -44,7 +44,8 @@ MAX_PAYLOAD_LEN = const(60000)
|
|
|
|
|
|
|
|
|
|
class Channel(Context):
|
|
|
|
|
def __init__(self, channel_cache: ChannelCache) -> None:
|
|
|
|
|
print("channel.__init__")
|
|
|
|
|
if __debug__:
|
|
|
|
|
log.debug(__name__, "channel initialization")
|
|
|
|
|
iface = _decode_iface(channel_cache.iface)
|
|
|
|
|
super().__init__(iface, channel_cache.channel_id)
|
|
|
|
|
self.channel_cache = channel_cache
|
|
|
|
@ -279,7 +280,9 @@ class Channel(Context):
|
|
|
|
|
self.sessions[session_id].incoming_message.publish(
|
|
|
|
|
MessageWithType(
|
|
|
|
|
message_type,
|
|
|
|
|
self.buffer[INIT_DATA_OFFSET + 3 : message_length - CHECKSUM_LENGTH],
|
|
|
|
|
self.buffer[
|
|
|
|
|
INIT_DATA_OFFSET + 3 : message_length - CHECKSUM_LENGTH - TAG_LENGTH
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
@ -379,7 +382,7 @@ class Channel(Context):
|
|
|
|
|
# CALLED BY WORKFLOW / SESSION CONTEXT
|
|
|
|
|
|
|
|
|
|
async def write(self, msg: protobuf.MessageType, session_id: int = 0) -> None:
|
|
|
|
|
print("channel.write")
|
|
|
|
|
print("channel.write:" + msg.MESSAGE_NAME)
|
|
|
|
|
noise_payload_len = self._encode_into_buffer(msg, session_id)
|
|
|
|
|
await self.write_and_encrypt(self.buffer[:noise_payload_len])
|
|
|
|
|
|
|
|
|
|