mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2026-02-11 23:51:07 +00:00
Bail as soon as we know there is a port error
This commit is contained in:
@ -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))
|
||||||
|
|||||||
Reference in New Issue
Block a user