Bail as soon as we know there is a port error
This commit is contained in:
parent
7a0fa7dd37
commit
430b4e2f89
|
@ -46,8 +46,6 @@ async def run(port, destination):
|
||||||
|
|
||||||
host.set_stream_handler(PROTOCOL_ID, stream_handler)
|
host.set_stream_handler(PROTOCOL_ID, stream_handler)
|
||||||
|
|
||||||
if not port:
|
|
||||||
raise RuntimeError("was not able to find the actual local port")
|
|
||||||
|
|
||||||
print(
|
print(
|
||||||
"Run './examples/chat/chat.py -p %s -d /ip4/%s/tcp/%s/p2p/%s' on another console.\n"
|
"Run './examples/chat/chat.py -p %s -d /ip4/%s/tcp/%s/p2p/%s' on another console.\n"
|
||||||
|
@ -97,6 +95,9 @@ def main():
|
||||||
)
|
)
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
if not args.port:
|
||||||
|
raise RuntimeError("was not able to determine a local port")
|
||||||
|
|
||||||
loop = asyncio.get_event_loop()
|
loop = asyncio.get_event_loop()
|
||||||
try:
|
try:
|
||||||
asyncio.ensure_future(run(args.port, args.destination))
|
asyncio.ensure_future(run(args.port, args.destination))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user