Fix MplexStream error

When receiving a `NewStream`, the message of that packet is the
name of the stream, which should be handled, rather than letting it go
into the message queue.
This commit is contained in:
mhchia
2019-08-26 20:26:22 +08:00
parent 5b122d04b2
commit d59870ebbf
4 changed files with 25 additions and 34 deletions

View File

@ -156,15 +156,10 @@ class Swarm(INetwork):
if not addrs:
raise SwarmException("No known addresses to peer")
multiaddr = addrs[0]
muxed_conn = await self.dial_peer(peer_id)
# Use muxed conn to open stream, which returns
# a muxed stream
# TODO: Remove protocol id from being passed into muxed_conn
# FIXME: Remove multiaddr from being passed into muxed_conn
muxed_stream = await muxed_conn.open_stream(protocol_ids[0], multiaddr)
# Use muxed conn to open stream, which returns a muxed stream
muxed_stream = await muxed_conn.open_stream()
# Perform protocol muxing to determine protocol to use
selected_protocol = await self.multiselect_client.select_one_of(