From 1bfa1f1ba543020734ac994521db21f37c20798a Mon Sep 17 00:00:00 2001 From: Alex Haynes Date: Sun, 11 Nov 2018 19:37:07 -0500 Subject: [PATCH] upgrade connection --- network/swarm.py | 2 +- transport/upgrader.py | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/network/swarm.py b/network/swarm.py index 6dcdcb4..ba17b9b 100644 --- a/network/swarm.py +++ b/network/swarm.py @@ -43,7 +43,7 @@ class Swarm(INetwork): raw_conn = self.transport.dial(first_addr) # 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 self.connections[peer_id] = muxed_conn diff --git a/transport/upgrader.py b/transport/upgrader.py index e70d437..3d2c0a8 100644 --- a/transport/upgrader.py +++ b/transport/upgrader.py @@ -1,3 +1,5 @@ +from muxer.mplex.muxed_connection import MuxedConn + class TransportUpgrader(object): def __init__(self, secOpt, muxerOpt): @@ -14,11 +16,14 @@ class TransportUpgrader(object): def upgrade_security(self): pass - def upgrade_connection(self, conn): + def upgrade_connection(self, conn, initiator): """ upgrade raw connection to muxed connection """ # For PoC, no security # Default to mplex - pass + + # TODO do exchange to determine multiplexer + + return MuxedConn(conn, initiator) \ No newline at end of file