diff --git a/lib/network.py b/lib/network.py index b6c121c68..fdcd7552b 100644 --- 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 index 6d0da06ae..4605af897 100755 --- 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