chat.py very little code refactor. (#112)

That was an useless duplicate
This commit is contained in:
Jorropo 2019-01-31 05:54:55 +01:00 committed by Robert Zajac
parent 9b6d61ca63
commit 82d08a3b14

View File

@ -33,8 +33,8 @@ async def write_data(stream):
async def run(port, destination): async def run(port, destination):
if not destination:
host = await new_node(transport_opt=["/ip4/127.0.0.1/tcp/%s" % port]) host = await new_node(transport_opt=["/ip4/127.0.0.1/tcp/%s" % port])
if not destination:
async def stream_handler(stream): async def stream_handler(stream):
asyncio.ensure_future(read_data(stream)) asyncio.ensure_future(read_data(stream))
@ -56,7 +56,6 @@ async def run(port, destination):
print("\nWaiting for incoming connection\n\n") print("\nWaiting for incoming connection\n\n")
else: else:
host = await new_node(transport_opt=["/ip4/127.0.0.1/tcp/%s" % port])
m = multiaddr.Multiaddr(destination) m = multiaddr.Multiaddr(destination)
info = info_from_p2p_addr(m) info = info_from_p2p_addr(m)