tnetwork.new_interface: clarify how timed out interfaces are closed - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit e4bd445a385e9cd85dfb202c4e597aea4b9e818c DIR parent 64ab8222f77cd0c271da128154dabddf6fddb9ba HTML Author: SomberNight <somber.night@protonmail.com> Date: Thu, 13 Sep 2018 20:50:32 +0200 network.new_interface: clarify how timed out interfaces are closed Diffstat: M electrum/interface.py | 3 +-- M electrum/network.py | 6 ++++++ 2 files changed, 7 insertions(+), 2 deletions(-) --- DIR diff --git a/electrum/interface.py b/electrum/interface.py t@@ -264,8 +264,7 @@ class Interface(PrintError): def mark_ready(self): if self.ready.cancelled(): - self.close() - raise asyncio.CancelledError() + raise GracefulDisconnect('conn establishment was too slow; *ready* future was cancelled') if self.ready.done(): return DIR diff --git a/electrum/network.py b/electrum/network.py t@@ -630,6 +630,12 @@ class Network(PrintError): #import traceback #traceback.print_exc() self.print_error(interface.server, "couldn't launch because", str(e), str(type(e))) + # note: connection_down will not call interface.close() as + # interface is not yet in self.interfaces. OTOH, calling + # interface.close() here will sometimes raise deep inside the + # asyncio internal select.select... instead, interface will close + # itself when it detects the cancellation of interface.ready; + # however this might take several seconds... self.connection_down(interface.server) return finally: