diff --git a/bin/silkaj b/bin/silkaj index 8394050d9a71b9133f3d029189621874c78de066..85c767516763d6b5255969915cce641c70d9fe96 100755 --- a/bin/silkaj +++ b/bin/silkaj @@ -9,5 +9,5 @@ if __name__ == '__main__': ep, cli_args = cli() if not check_port(ep["port"]): exit(1) - best_node(ep, 1) + best_node(ep, True) manage_cmd(ep, cli_args) diff --git a/silkaj/commands.py b/silkaj/commands.py index 9625a75eed4adf742f79e35223bff7644589eac0..b6bd6b437fa37c2f2c1e28f4c4edbc09924927fa 100644 --- a/silkaj/commands.py +++ b/silkaj/commands.py @@ -110,7 +110,7 @@ def network_info(ep, discover): print("Getting informations about nodes:") while (i < len(endpoints)): print("{0:.0f}%".format(i/len(endpoints) * 100, 1), end=" ") - best_ep = best_node(endpoints[i], 0) + best_ep = best_node(endpoints[i], False) print(best_ep if best_ep is None else endpoints[i][best_ep], end=" ") print(endpoints[i]["port"]) try: diff --git a/silkaj/network_tools.py b/silkaj/network_tools.py index d0482307cf78dd81362a82b17894dade6a451e47..ebfba4d4544fe267a7f2014bc61c135b3ed0c5da 100644 --- a/silkaj/network_tools.py +++ b/silkaj/network_tools.py @@ -19,7 +19,7 @@ def discover_peers(ep, discover): for i, ep in enumerate(endpoints): if discover: print("{0:.0f}%".format(i / len(endpoints) * 100)) - if best_node(ep, 0) is None: + if best_node(ep, False) is None: endpoints.remove(ep) elif discover: endpoints = recursive_discovering(endpoints, ep) @@ -33,7 +33,7 @@ def recursive_discovering(endpoints, ep): """ news = parse_endpoints(get_request(ep, "network/peers")["peers"]) for new in news: - if best_node(new, 0) is not None and new not in endpoints: + if best_node(new, False) is not None and new not in endpoints: endpoints.append(new) recursive_discovering(endpoints, new) return endpoints @@ -100,7 +100,7 @@ def check_ip(address): def get_request(ep, path): - address = best_node(ep, 0) + address = best_node(ep, False) if address is None: return address url = "http://" + ep[address] + ":" + ep["port"] + "/" + path @@ -113,7 +113,7 @@ def get_request(ep, path): def post_request(ep, path, postdata): - address = best_node(ep, 0) + address = best_node(ep, False) if address is None: return address url = "http://" + ep[address] + ":" + ep["port"] + "/" + path