Bail as soon as we know there is a port error

This commit is contained in:
Alex Stokes 2019-08-02 10:21:41 -07:00
parent 7a0fa7dd37
commit 430b4e2f89
No known key found for this signature in database
GPG Key ID: 51CE1721B245C086

View File

@ -46,8 +46,6 @@ async def run(port, destination):
host.set_stream_handler(PROTOCOL_ID, stream_handler)
if not port:
raise RuntimeError("was not able to find the actual local port")
print(
"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()
if not args.port:
raise RuntimeError("was not able to determine a local port")
loop = asyncio.get_event_loop()
try:
asyncio.ensure_future(run(args.port, args.destination))