electrum

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

commit 0b201d98ab379c625193e54cadd6ae18cdf3826b
parent e13e42a00c84d4a1aa9afc1e69c0caf176dddd6e
Author: ThomasV <electrumdev@gmail.com>
Date:   Fri, 22 May 2015 08:13:14 +0200

Merge pull request #1230 from kyuupichan/switch-random-if

Remove interfaces in one place only
Diffstat:
Mlib/network.py | 13++++---------
1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/lib/network.py b/lib/network.py @@ -354,13 +354,9 @@ class Network(util.DaemonThread): def switch_to_random_interface(self): - while self.interfaces: - i = random.choice(self.interfaces.values()) - if i.is_connected(): - self.switch_to_interface(i.server) - break - else: - self.remove_interface(i) + if self.interfaces: + server = random.choice(self.interfaces.keys()) + self.switch_to_interface(server) def switch_to_interface(self, server): '''Switch to server as our interface, it must be in self.interfaces''' @@ -508,8 +504,7 @@ class Network(util.DaemonThread): # main interface if not self.is_connected(): if self.config.get('auto_cycle'): - if self.interfaces: - self.switch_to_random_interface() + self.switch_to_random_interface() else: if self.default_server in self.interfaces.keys(): self.switch_to_interface(self.default_server)