From 04680f4bbfe29d971a9f86a170bb0be337eaf3ba Mon Sep 17 00:00:00 2001 From: Jan Pochyla Date: Tue, 3 Apr 2018 20:38:36 +0200 Subject: [PATCH] src/trezor/wire: clean up after workflows --- src/trezor/wire/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/trezor/wire/__init__.py b/src/trezor/wire/__init__.py index fef1ac53bc..3f9f441c66 100644 --- a/src/trezor/wire/__init__.py +++ b/src/trezor/wire/__init__.py @@ -3,6 +3,7 @@ import protobuf from trezor import log from trezor import loop from trezor import messages +from trezor import utils from trezor import workflow from . import codec_v1 @@ -119,12 +120,14 @@ async def session_handler(iface, sid): except KeyError: handler, args = unexpected_msg, () + m = utils.unimport_begin() w = handler(ctx, reader, *args) try: workflow.onstart(w) await w finally: workflow.onclose(w) + utils.unimport_end(m) except UnexpectedMessageError as exc: # retry with opened reader from the exception