commit 0f44ebac5589b129d39ef3377818b77664362105
parent 25ccd2541ad774fef89eb3cd67169bffbdc9bd7c
Author: ThomasV <thomasv@gitorious>
Date: Sat, 22 Mar 2014 11:04:52 +0100
handle timeout in peers script
Diffstat:
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/scripts/peers b/scripts/peers
@@ -19,6 +19,7 @@ r = q.get(timeout=10000)
peers = parse_servers(r.get('result'))
peers = filter_protocol(peers,'s')
+print "Contacting %d servers"%len(peers)
# start interfaces
config = SimpleConfig()
interfaces = map ( lambda server: Interface(server, config), peers )
@@ -27,12 +28,17 @@ reached_servers = []
for i in interfaces: i.start(q)
while peers:
- i = q.get(timeout=10)
+ try:
+ i = q.get(timeout=3)
+ except:
+ break
peers.remove(i.server)
if i.is_connected:
i.send([('blockchain.headers.subscribe',[])], lambda i,x: results_queue.put((i,x)))
reached_servers.append(i.server)
+print "%d servers could be reached"%len(reached_servers)
+
def analyze(results):
out = {}
dd = {}