api: fix handling interrupted calls
When an API call is interrupted, the relevant coroutine is cancelled - which means it may throw CancelledError. At the same time, cancelled call have related socket already closed (and transport set to None). But QubesDaemonProtocol.respond try to close the transport again, which fails. Fix handling this case.
This commit is contained in:
parent
147bca1648
commit
2f4b4d97e7
@ -307,7 +307,8 @@ class QubesDaemonProtocol(asyncio.Protocol):
|
|||||||
|
|
||||||
# this is reached if from except: blocks; do not put it in finally:,
|
# this is reached if from except: blocks; do not put it in finally:,
|
||||||
# because this will prevent the good case from sending the reply
|
# because this will prevent the good case from sending the reply
|
||||||
self.transport.abort()
|
if self.transport:
|
||||||
|
self.transport.abort()
|
||||||
|
|
||||||
def send_header(self, *args):
|
def send_header(self, *args):
|
||||||
self.transport.write(self.header.pack(*args))
|
self.transport.write(self.header.pack(*args))
|
||||||
|
Loading…
Reference in New Issue
Block a user