mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2026-02-12 16:10:57 +00:00
swarm listen done
This commit is contained in:
@ -76,7 +76,6 @@ class Swarm(INetwork):
|
|||||||
# Have conn handler delegate to stream handler
|
# Have conn handler delegate to stream handler
|
||||||
# Call listener listen with the multiaddr
|
# Call listener listen with the multiaddr
|
||||||
# Map multiaddr to listener
|
# Map multiaddr to listener
|
||||||
|
|
||||||
for multiaddr_str in args:
|
for multiaddr_str in args:
|
||||||
if multiaddr_str in self.listeners:
|
if multiaddr_str in self.listeners:
|
||||||
return True
|
return True
|
||||||
@ -87,7 +86,7 @@ class Swarm(INetwork):
|
|||||||
def conn_handler(reader, writer):
|
def conn_handler(reader, writer):
|
||||||
# Upgrade reader/write to a net_stream and pass to appropriate stream handler (using multiaddr)
|
# Upgrade reader/write to a net_stream and pass to appropriate stream handler (using multiaddr)
|
||||||
raw_conn = RawConnection(multiaddr_dict.host, multiaddr_dict.port, reader, writer)
|
raw_conn = RawConnection(multiaddr_dict.host, multiaddr_dict.port, reader, writer)
|
||||||
muxed_conn = self.upgrader.upgrade_connection(raw_conn)
|
muxed_conn = self.upgrader.upgrade_connection(raw_conn, False)
|
||||||
|
|
||||||
# TODO: make generic protocols work
|
# TODO: make generic protocols work
|
||||||
muxed_stream, stream_id, protocol_id = muxed_conn.accept_stream()
|
muxed_stream, stream_id, protocol_id = muxed_conn.accept_stream()
|
||||||
|
|||||||
@ -24,5 +24,4 @@ class TransportUpgrader(object):
|
|||||||
# Default to mplex
|
# Default to mplex
|
||||||
|
|
||||||
# TODO do exchange to determine multiplexer
|
# TODO do exchange to determine multiplexer
|
||||||
|
|
||||||
return MuxedConn(conn, initiator)
|
return MuxedConn(conn, initiator)
|
||||||
|
|||||||
Reference in New Issue
Block a user