From 8c1ba905a06cc6025eceb904364e0616fcdcf4d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Wed, 30 Aug 2017 12:52:21 +0200 Subject: [PATCH] api: do not fail events when listener is cancelled in the meantime Raising any error from event handler will abort further handlers of this event. --- qubes/api/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/qubes/api/__init__.py b/qubes/api/__init__.py index 5e3df07c..b5e38175 100644 --- a/qubes/api/__init__.py +++ b/qubes/api/__init__.py @@ -325,6 +325,8 @@ class QubesDaemonProtocol(asyncio.Protocol): self.transport.write(content.encode('utf-8')) def send_event(self, subject, event, **kwargs): + if self.transport is None: + return self.event_sent = True self.send_header(0x31)