electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 6ea04e2d47e39332bae600c7c899ab3ae1b52a81
parent bcde4163314f3b3577f3c61300819ed927b21591
Author: ThomasV <thomasv@gitorious>
Date:   Wed, 10 Jun 2015 18:24:57 +0200

Network: Fix switch_to_interface (check that interface is connected)

Diffstat:
Mlib/network.py | 24++++++++++++++----------
1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/lib/network.py b/lib/network.py @@ -358,18 +358,22 @@ class Network(util.DaemonThread): happen on receipt of the connection notification. Do nothing if server already is our interface.''' self.default_server = server - if server in self.interfaces: - if self.interface != self.interfaces[server]: - self.print_error("switching to", server) - # stop any current interface in order to terminate subscriptions - self.stop_interface() - self.interface = self.interfaces[server] - self.send_subscriptions() - self.set_status('connected') - self.notify('updated') - else: + if server not in self.interfaces: self.print_error("starting %s; will switch once connected" % server) self.start_interface(server) + return + i = self.interfaces[server] + if not i.is_connected(): + # do nothing; we will switch once connected + return + if self.interface != i: + self.print_error("switching to", server) + # stop any current interface in order to terminate subscriptions + self.stop_interface() + self.interface = i + self.send_subscriptions() + self.set_status('connected') + self.notify('updated') def stop_interface(self): if self.interface: