Commit 7816a0c3 authored by Moul's avatar Moul
Browse files

[mod] return boolean values from check_port().

No more exit from withing the f() to avoid 'network'
command which would found a wrong port in a peer document
to exit the program.
parent e5517001
#!/usr/bin/env python3
from sys import exit
from silkaj.network_tools import check_port, best_node
from silkaj.silkaj import cli, manage_cmd
if __name__ == '__main__':
ep, cli_args = cli()
check_port(ep["port"])
if not check_port(ep["port"]):
exit(1)
best_node(ep, 1)
manage_cmd(ep, cli_args)
......@@ -151,11 +151,11 @@ def check_port(port):
port = int(port)
except:
print("Port must be an integer", file=stderr)
exit(1)
return False
if (port < 0 or port > 65536):
print("Wrong port number", file=stderr)
exit(1)
return 1
return False
return True
def get_current_block(ep):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment