From 2d4fee4a16be87e322e555002a40ffad35592331 Mon Sep 17 00:00:00 2001 From: Jorropo Date: Sat, 29 Feb 2020 10:48:15 +0100 Subject: [PATCH] Changing QCapableConn.Transport() to return QTransport. --- transport/transport.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/transport/transport.go b/transport/transport.go index 0371c726..6ae8942d 100644 --- a/transport/transport.go +++ b/transport/transport.go @@ -39,9 +39,7 @@ var AcceptTimeout = 60 * time.Second // CapableConn provides accessors for the local and remote multiaddrs used to // establish the connection and an accessor for the underlying Transport. type CapableConn interface { - mux.MuxedConn - network.ConnSecurity - network.ConnMultiaddrs + BaseCapableConn // Transport returns the transport to which this connection belongs. Transport() Transport @@ -75,11 +73,21 @@ type CapableConn interface { // // QCapableConn embed CapableConn but with `Quality() uint32` support. type QCapableConn interface { - CapableConn + BaseCapableConn // Quality returns the Quality we can expect from the connection to this peer. // That must be deterministic and fast. Quality() uint32 + + // Transport returns the transport to which this connection belongs. + Transport() QTransport +} + +// CapableConnBase is used to build `CapableConn` and `QCapableConn` +type BaseCapableConn interface { + mux.MuxedConn + network.ConnSecurity + network.ConnMultiaddrs } // Score is used by transport to returns expectation about connection