Browse Source

interface: check if future already done in handle_disconnect

future could get cancelled in network.py in which case set_result raised
dependabot/pip/contrib/deterministic-build/ecdsa-0.13.3
SomberNight 6 years ago
parent
commit
935ab9a12f
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 3
      electrum/interface.py

3
electrum/interface.py

@ -336,7 +336,8 @@ class Interface(Logger):
self.logger.debug(f"(disconnect) trace for {repr(e)}", exc_info=True) self.logger.debug(f"(disconnect) trace for {repr(e)}", exc_info=True)
finally: finally:
await self.network.connection_down(self) await self.network.connection_down(self)
self.got_disconnected.set_result(1) if not self.got_disconnected.done():
self.got_disconnected.set_result(1)
# if was not 'ready' yet, schedule waiting coroutines: # if was not 'ready' yet, schedule waiting coroutines:
self.ready.cancel() self.ready.cancel()
return wrapper_func return wrapper_func

Loading…
Cancel
Save