|
|
@ -13,6 +13,7 @@ for i in interfaces: |
|
|
|
i.send([('blockchain.numblocks.subscribe',[])]) |
|
|
|
else: |
|
|
|
servers.remove(i.server) |
|
|
|
i.status = "unreachable" |
|
|
|
|
|
|
|
for i in interfaces: |
|
|
|
while True: |
|
|
@ -23,11 +24,12 @@ for i in interfaces: |
|
|
|
|
|
|
|
if r.get('method') == 'blockchain.numblocks.subscribe': |
|
|
|
results.append((i.host, r.get('result'))) |
|
|
|
i.status = "ok" |
|
|
|
servers.remove(i.server) |
|
|
|
break |
|
|
|
|
|
|
|
for s in servers: |
|
|
|
print "%30s "%s, "timed out" |
|
|
|
i.status = "timed out" |
|
|
|
|
|
|
|
from collections import defaultdict |
|
|
|
d = defaultdict(int) |
|
|
@ -36,6 +38,9 @@ for e in results: |
|
|
|
v = d.values() |
|
|
|
numblocks = d.keys()[v.index(max(v))] |
|
|
|
|
|
|
|
for i in interfaces: |
|
|
|
print i.host, i.status |
|
|
|
|
|
|
|
for s,n in results: |
|
|
|
print "%30s %d "%(s, n), "ok" if abs(n-numblocks)<2 else "lagging" |
|
|
|
|
|
|
|