5
0
mirror of https://github.com/cwinfo/yggdrasil-map synced 2024-11-22 01:10:28 +00:00

Merge pull request #11 from kyrias/sG-fixes

Skip not_found nodes, don't prefix error with "Error:"
This commit is contained in:
Michał Zieliński 2015-12-01 09:09:55 +01:00
commit 3c90628f74

View File

@ -153,7 +153,12 @@ def get_peers(con, path, nearbyPath=''):
res = con.RouterModule_getPeers(path)
if res['error'] != 'none':
if res['error'] == 'not_found':
print('get_peers: node with path {:s} not found, skipping.'
.format(formatted_path))
return []
elif res['error'] != 'none':
print('get_peers: failed with error `{:s}` on {:s}, trying again. {:d} tries remaining.'
.format(res['error'], formatted_path, retry-i))
elif res['result'] == 'timeout':
@ -164,7 +169,7 @@ def get_peers(con, path, nearbyPath=''):
i += 1
print('get_peers: timed out on final try, skipping {:s}'
print('get_peers: failed on final try, skipping {:s}'
.format(formatted_path))
return []
@ -251,7 +256,7 @@ def send_graph(nodes, edges):
if r.text == 'OK':
print('Done!')
else:
print('Error: {:s}'.format(r.text))
print('{:s}'.format(r.text))
if __name__ == '__main__':
main()