mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2026-02-12 16:10:57 +00:00
@ -43,7 +43,7 @@ class Swarm(INetwork):
|
|||||||
raw_conn = self.transport.dial(first_addr)
|
raw_conn = self.transport.dial(first_addr)
|
||||||
|
|
||||||
# Use upgrader to upgrade raw conn to muxed conn
|
# Use upgrader to upgrade raw conn to muxed conn
|
||||||
muxed_conn = self.upgrader.upgrade_connection(raw_conn)
|
muxed_conn = self.upgrader.upgrade_connection(raw_conn, True)
|
||||||
|
|
||||||
# Store muxed connection in connections
|
# Store muxed connection in connections
|
||||||
self.connections[peer_id] = muxed_conn
|
self.connections[peer_id] = muxed_conn
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
from muxer.mplex.muxed_connection import MuxedConn
|
||||||
|
|
||||||
class TransportUpgrader(object):
|
class TransportUpgrader(object):
|
||||||
|
|
||||||
def __init__(self, secOpt, muxerOpt):
|
def __init__(self, secOpt, muxerOpt):
|
||||||
@ -14,10 +16,13 @@ class TransportUpgrader(object):
|
|||||||
def upgrade_security(self):
|
def upgrade_security(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def upgrade_connection(self, conn):
|
def upgrade_connection(self, conn, initiator):
|
||||||
"""
|
"""
|
||||||
upgrade raw connection to muxed connection
|
upgrade raw connection to muxed connection
|
||||||
"""
|
"""
|
||||||
# For PoC, no security
|
# For PoC, no security
|
||||||
# Default to mplex
|
# Default to mplex
|
||||||
pass
|
|
||||||
|
# TODO do exchange to determine multiplexer
|
||||||
|
|
||||||
|
return MuxedConn(conn, initiator)
|
||||||
|
|||||||
Reference in New Issue
Block a user