5
0
mirror of https://github.com/cwinfo/yggdrasil-map synced 2024-12-29 02:55:40 +00:00

Merge pull request #9 from kyrias/sG-fixes

sendGraph: Only print each fetch line when given -v
This commit is contained in:
Michał Zieliński 2015-11-22 11:10:50 +01:00
commit 079796d999

View File

@ -31,6 +31,7 @@ cjdns_password = 'NONE'
import sys
import traceback
import json
import argparse
import requests
@ -42,6 +43,12 @@ import queue
import threading
def main():
parser = argparse.ArgumentParser(description='Submit nodes and links to fc00')
parser.add_argument('-v', '--verbose', help='increase output verbosity',
dest='verbose', action='store_true')
parser.set_defaults(verbose=False)
args = parser.parse_args()
con = connect()
nodes = dump_node_store(con)
@ -54,7 +61,8 @@ def main():
get_peer_queue.put(k)
for i in range(8):
t = threading.Thread(target=worker, args=[nodes, get_peer_queue, result_queue])
t = threading.Thread(target=worker, args=[nodes, get_peer_queue, result_queue,
args.verbose])
t.daemon = True
t.start()
@ -65,7 +73,7 @@ def main():
send_graph(nodes, edges)
sys.exit(0)
def worker(nodes, get_peer_queue, result):
def worker(nodes, get_peer_queue, result, verbose=False):
con = connect()
while True:
@ -75,7 +83,8 @@ def worker(nodes, get_peer_queue, result):
return
node = nodes[k]
print('fetch', node)
if verbose:
print('fetch', node)
node_ip = node['ip']
peers = get_peers(con, node['path'])