electrum

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

commit 6aefaf7b3ea45f7b57f35f89b094a915c804638f
parent 302ce7c15b518886978e30060d57d7865fe3304e
Author: ThomasV <thomasv@electrum.org>
Date:   Sat, 17 Oct 2015 07:07:10 +0200

populate network.connecting before the thread is started (fixes KeyError in self.connecting.pop)

Diffstat:
Mlib/network.py | 8++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/network.py b/lib/network.py @@ -186,7 +186,7 @@ class Network(util.DaemonThread): self.interface = None self.interfaces = {} self.auto_connect = self.config.get('auto_connect', False) - self.connecting = {} + self.connecting = set() self.socket_queue = Queue.Queue() self.start_network(deserialize_server(self.default_server)[2], deserialize_proxy(self.config.get('proxy'))) @@ -327,8 +327,8 @@ class Network(util.DaemonThread): if server == self.default_server: self.print_error("connecting to %s as new interface" % server) self.set_status('connecting') + self.connecting.add(server) c = Connection(server, self.socket_queue, self.config.path) - self.connecting[server] = c def start_random_interface(self): exclude_set = self.disconnected_servers.union(set(self.interfaces)) @@ -368,7 +368,7 @@ class Network(util.DaemonThread): self.close_interface(interface) assert self.interface is None assert not self.interfaces - self.connecting = {} + self.connecting = set() # Get a new queue - no old pending connections thanks! self.socket_queue = Queue.Queue() @@ -580,7 +580,7 @@ class Network(util.DaemonThread): # Responses to connection attempts? while not self.socket_queue.empty(): server, socket = self.socket_queue.get() - self.connecting.pop(server) + self.connecting.remove(server) if socket: self.new_interface(server, socket) else: