Browse Source

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.
Marek Marczykowski-Górecki 6 years ago
parent
commit
8c1ba905a0
1 changed files with 2 additions and 0 deletions
  1. 2 0
      qubes/api/__init__.py

+ 2 - 0
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)