|
@ -26,16 +26,17 @@ i.stop() |
|
|
|
|
|
|
|
|
print "Contacting %d servers"%len(peers) |
|
|
print "Contacting %d servers"%len(peers) |
|
|
# start interfaces |
|
|
# start interfaces |
|
|
|
|
|
q2 = Queue.Queue() |
|
|
config = SimpleConfig() |
|
|
config = SimpleConfig() |
|
|
interfaces = map ( lambda server: Interface(server, config), peers ) |
|
|
interfaces = map ( lambda server: Interface(server, config), peers ) |
|
|
reached_servers = [] |
|
|
reached_servers = [] |
|
|
for i in interfaces: |
|
|
for i in interfaces: |
|
|
i.start(q) |
|
|
i.start(q2) |
|
|
|
|
|
|
|
|
t0 = time.time() |
|
|
t0 = time.time() |
|
|
while peers: |
|
|
while peers: |
|
|
try: |
|
|
try: |
|
|
i, r = q.get(timeout=1) |
|
|
i, r = q2.get(timeout=1) |
|
|
except: |
|
|
except: |
|
|
if time.time() - t0 > 10: |
|
|
if time.time() - t0 > 10: |
|
|
print "timeout" |
|
|
print "timeout" |
|
|