mirror of
https://github.com/cwinfo/yggdrasil-map
synced 2024-11-25 02:01:35 +00:00
fix sendGraph
This commit is contained in:
parent
55ec38f776
commit
646d8d74e5
@ -52,7 +52,9 @@ def main():
|
|||||||
get_peer_queue.put(k)
|
get_peer_queue.put(k)
|
||||||
|
|
||||||
for i in range(8):
|
for i in range(8):
|
||||||
threading.Thread(target=worker, args=[nodes, get_peer_queue, result_queue]).start()
|
t = threading.Thread(target=worker, args=[nodes, get_peer_queue, result_queue])
|
||||||
|
t.daemon = True
|
||||||
|
t.start()
|
||||||
|
|
||||||
for i in range(len(nodes)):
|
for i in range(len(nodes)):
|
||||||
peers, node_ip = result_queue.get()
|
peers, node_ip = result_queue.get()
|
||||||
@ -174,13 +176,13 @@ def get_edges_for_peers(edges, peers, node_ip):
|
|||||||
A = peer_ip
|
A = peer_ip
|
||||||
B = node_ip
|
B = node_ip
|
||||||
|
|
||||||
edge = { 'A': A,
|
edge = { 'a': A,
|
||||||
'B': B }
|
'b': B }
|
||||||
|
|
||||||
if A not in edges:
|
if A not in edges:
|
||||||
edges[A] = []
|
edges[A] = []
|
||||||
|
|
||||||
if not([True for edge in edges[A] if edge['B'] == B]):
|
if not([True for edge in edges[A] if edge['b'] == B]):
|
||||||
edges[A] += [edge]
|
edges[A] += [edge]
|
||||||
|
|
||||||
|
|
||||||
|
@ -48,11 +48,11 @@ def insert_graph_data(config, data, mail, ip, version):
|
|||||||
if len(nodes) == 0 or len(edges) == 0:
|
if len(nodes) == 0 or len(edges) == 0:
|
||||||
return 'No valid nodes or edges'
|
return 'No valid nodes or edges'
|
||||||
|
|
||||||
uploaded_by = ip
|
uploaded_by = ip
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with NodeDB(config) as db:
|
with NodeDB(config) as db:
|
||||||
db.insert_graph(nodes, edges, uploaded_by)
|
db.insert_graph(nodes, edges, uploaded_by)
|
||||||
except Exception:
|
except Exception:
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
return 'Database failure'
|
return 'Database failure'
|
||||||
|
Loading…
Reference in New Issue
Block a user