mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-18 20:38:10 +00:00
src/trezor/wire: clean up after workflows
This commit is contained in:
parent
b38d6870eb
commit
04680f4bbf
@ -3,6 +3,7 @@ import protobuf
|
|||||||
from trezor import log
|
from trezor import log
|
||||||
from trezor import loop
|
from trezor import loop
|
||||||
from trezor import messages
|
from trezor import messages
|
||||||
|
from trezor import utils
|
||||||
from trezor import workflow
|
from trezor import workflow
|
||||||
|
|
||||||
from . import codec_v1
|
from . import codec_v1
|
||||||
@ -119,12 +120,14 @@ async def session_handler(iface, sid):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
handler, args = unexpected_msg, ()
|
handler, args = unexpected_msg, ()
|
||||||
|
|
||||||
|
m = utils.unimport_begin()
|
||||||
w = handler(ctx, reader, *args)
|
w = handler(ctx, reader, *args)
|
||||||
try:
|
try:
|
||||||
workflow.onstart(w)
|
workflow.onstart(w)
|
||||||
await w
|
await w
|
||||||
finally:
|
finally:
|
||||||
workflow.onclose(w)
|
workflow.onclose(w)
|
||||||
|
utils.unimport_end(m)
|
||||||
|
|
||||||
except UnexpectedMessageError as exc:
|
except UnexpectedMessageError as exc:
|
||||||
# retry with opened reader from the exception
|
# retry with opened reader from the exception
|
||||||
|
Loading…
Reference in New Issue
Block a user