mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-05-06 08:59:15 +00:00
chore(core): add unexpected fallback write for small messages
This commit is contained in:
parent
f2459189fc
commit
35d862f8b4
@ -479,6 +479,17 @@ class Channel:
|
|||||||
from trezor.enums import FailureType
|
from trezor.enums import FailureType
|
||||||
from trezor.messages import Failure
|
from trezor.messages import Failure
|
||||||
|
|
||||||
|
if length <= len(self.buffer):
|
||||||
|
# Fallback write - Write buffer is locked, using backup buffer instead
|
||||||
|
noise_payload_len = memory_manager.encode_into_buffer(
|
||||||
|
self.buffer, msg, session_id
|
||||||
|
)
|
||||||
|
task = self._write_and_encrypt(noise_payload_len, fallback=True)
|
||||||
|
if task is not None:
|
||||||
|
await task
|
||||||
|
return
|
||||||
|
|
||||||
|
# Message cannot be written - not even in fallback mode, killing channel
|
||||||
if __debug__ and utils.ALLOW_DEBUG_MESSAGES:
|
if __debug__ and utils.ALLOW_DEBUG_MESSAGES:
|
||||||
self._log("Failed to get write buffer, killing channel.")
|
self._log("Failed to get write buffer, killing channel.")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user