commit d140383d036c9b77db4bb93885e97f21d0344600
parent 4446cf44c732f7829279599cda18ebb8d56d7c15
Author: ecdsa <ecdsa@github>
Date: Mon, 16 Dec 2013 19:59:35 +0100
exit wait_until_connected() when all servers have been tried
Diffstat:
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/lib/network.py b/lib/network.py
@@ -177,7 +177,8 @@ class Network(threading.Thread):
def wait_until_connected(self):
"wait until connection status is known"
if self.config.get('auto_cycle'):
- while not self.is_connected():
+ # self.random_server() returns None if all servers have been tried
+ while not self.is_connected() and self.random_server():
time.sleep(0.1)
else:
self.interface.connect_event.wait()
diff --git a/scripts/peers b/scripts/peers
@@ -3,11 +3,11 @@
import time, electrum
electrum.set_verbosity(False) # default is True
-network = electrum.Network({'verbose':False})
+network = electrum.Network({'auto_cycle':True})
network.register_callback('peers',lambda: electrum.print_json(network.irc_servers.keys()))
if not network.start(wait=True):
- print "Not connected [%s]"% network.interface.server
+ print "Not connected"
exit(1)
print "Connected to", network.interface.server