From 7e1329f48604f857f433af2c6f33d66769912b69 Mon Sep 17 00:00:00 2001 From: Jorropo Date: Tue, 3 Mar 2020 21:10:32 +0100 Subject: [PATCH] Removing `transport.Score.IsQuality` to avoid excessive redial. We don't want to dial the same peer again and again, allowing transport to not return an expected quality means we must try to dial each time. --- go.mod | 116 +++++++++++++++++++++++++++++++++++++++++ go.sum | 1 + transport/transport.go | 12 ++--- 3 files changed, 121 insertions(+), 8 deletions(-) diff --git a/go.mod b/go.mod index 7022bc16..786926a0 100644 --- a/go.mod +++ b/go.mod @@ -19,3 +19,119 @@ require ( ) go 1.13 + +replace github.com/libp2p/go-addr-util => ../go-addr-util + +replace github.com/libp2p/go-buffer-pool => ../go-buffer-pool + +replace github.com/libp2p/go-conn-security-multistream => ../go-conn-security-multistream + +replace github.com/libp2p/go-eventbus => ../go-eventbus + +replace github.com/libp2p/go-flow-metrics => ../go-flow-metrics + +replace github.com/libp2p/go-libp2p => ../go-libp2p + +replace github.com/libp2p/go-libp2p-autonat => ../go-libp2p-autonat + +replace github.com/libp2p/go-libp2p-autonat-svc => ../go-libp2p-autonat-svc + +replace github.com/libp2p/go-libp2p-blankhost => ../go-libp2p-blankhost + +replace github.com/libp2p/go-libp2p-circuit => ../go-libp2p-circuit + +replace github.com/libp2p/go-libp2p-connmgr => ../go-libp2p-connmgr + +replace github.com/libp2p/go-libp2p-consensus => ../go-libp2p-consensus + +replace github.com/libp2p/go-libp2p-daemon => ../go-libp2p-daemon + +replace github.com/libp2p/go-libp2p-discovery => ../go-libp2p-discovery + +replace github.com/libp2p/go-libp2p-examples => ../go-libp2p-examples + +replace github.com/libp2p/go-libp2p-gorpc => ../go-libp2p-gorpc + +replace github.com/libp2p/go-libp2p-introspection => ../go-libp2p-introspection + +replace github.com/libp2p/go-libp2p-kad-dht => ../go-libp2p-kad-dht + +replace github.com/libp2p/go-libp2p-kbucket => ../go-libp2p-kbucket + +replace github.com/libp2p/go-libp2p-loggables => ../go-libp2p-loggables + +replace github.com/libp2p/go-libp2p-mplex => ../go-libp2p-mplex + +replace github.com/libp2p/go-libp2p-nat => ../go-libp2p-nat + +replace github.com/libp2p/go-libp2p-netutil => ../go-libp2p-netutil + +replace github.com/libp2p/go-libp2p-noise => ../go-libp2p-noise + +replace github.com/libp2p/go-libp2p-peerstore => ../go-libp2p-peerstore + +replace github.com/libp2p/go-libp2p-pnet => ../go-libp2p-pnet + +replace github.com/libp2p/go-libp2p-pubsub => ../go-libp2p-pubsub + +replace github.com/libp2p/go-libp2p-pubsub-router => ../go-libp2p-pubsub-router + +replace github.com/libp2p/go-libp2p-pubsub-tracer => ../go-libp2p-pubsub-tracer + +replace github.com/libp2p/go-libp2p-quic-transport => ../go-libp2p-quic-transport + +replace github.com/libp2p/go-libp2p-raft => ../go-libp2p-raft + +replace github.com/libp2p/go-libp2p-record => ../go-libp2p-record + +replace github.com/libp2p/go-libp2p-routing-helpers => ../go-libp2p-routing-helpers + +replace github.com/libp2p/go-libp2p-secio => ../go-libp2p-secio + +replace github.com/libp2p/go-libp2p-swarm => ../go-libp2p-swarm + +replace github.com/libp2p/go-libp2p-testing => ../go-libp2p-testing + +replace github.com/libp2p/go-libp2p-tls => ../go-libp2p-tls + +replace github.com/libp2p/go-libp2p-transport-upgrader => ../go-libp2p-transport-upgrader + +replace github.com/libp2p/go-libp2p-webrtc-direct => ../go-libp2p-webrtc-direct + +replace github.com/libp2p/go-libp2p-yamux => ../go-libp2p-yamux + +replace github.com/libp2p/go-maddr-filter => ../go-maddr-filter + +replace github.com/libp2p/go-mplex => ../go-mplex + +replace github.com/libp2p/go-msgio => ../go-msgio + +replace github.com/multiformats/go-multiaddr => ../go-multiaddr + +replace github.com/multiformats/go-multiaddr-dns => ../go-multiaddr-dns + +replace github.com/multiformats/go-multiaddr-fmt => ../go-multiaddr-fmt + +replace github.com/multiformats/go-multiaddr-net => ../go-multiaddr-net + +replace github.com/multiformats/go-multistream => ../go-multistream + +replace github.com/libp2p/go-nat => ../go-nat + +replace github.com/libp2p/go-reuseport => ../go-reuseport + +replace github.com/libp2p/go-reuseport-transport => ../go-reuseport-transport + +replace github.com/libp2p/go-sockaddr => ../go-sockaddr + +replace github.com/libp2p/go-stream-muxer-multistream => ../go-stream-muxer-multistream + +replace github.com/libp2p/go-tcp-transport => ../go-tcp-transport + +replace github.com/libp2p/go-utp-transport => ../go-utp-transport + +replace github.com/Jorropo/go-webrtc-aside-transport => ../go-webrtc-aside-transport + +replace github.com/libp2p/go-ws-transport => ../go-ws-transport + +replace github.com/libp2p/go-yamux => ../go-yamux diff --git a/go.sum b/go.sum index 034ee22c..8348504a 100644 --- a/go.sum +++ b/go.sum @@ -89,6 +89,7 @@ github.com/multiformats/go-multihash v0.0.13 h1:06x+mk/zj1FoMsgNejLpy6QTvJqlSt/B github.com/multiformats/go-multihash v0.0.13/go.mod h1:VdAWLKTwram9oKAatUcLxBNUjdtcVwxObEQBtRfuyjc= github.com/multiformats/go-varint v0.0.1 h1:TR/0rdQtnNxuN2IhiB639xC3tWM4IUi7DkTBVTdGW/M= github.com/multiformats/go-varint v0.0.1/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= +github.com/multiformats/go-varint v0.0.2/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= github.com/multiformats/go-varint v0.0.5 h1:XVZwSo04Cs3j/jS0uAEPpT3JY6DzMcVLLoWOSnCxOjg= github.com/multiformats/go-varint v0.0.5/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= diff --git a/transport/transport.go b/transport/transport.go index 0c9de98e..49773ad6 100644 --- a/transport/transport.go +++ b/transport/transport.go @@ -96,16 +96,12 @@ type BaseCapableConn interface { network.ConnMultiaddrs } -// Score is used by transport to returns expectation about connection +// Score is used by transport to returns expectation about connection, might be +// different than what the connection actualy return but that DEPREACATED. +// (that will cause weird cancel issue) type Score struct { - // Score of the future connection, must not change once the connection is - // actualy created + // Score of the future connection. Quality uint32 - // True if quality was actualy calculable (it may only be calculable with an - // open connection). - // Note: if IsQuality == true swarm will be able to cancel the dial if a - // better transport is found. - IsQuality bool // Number of file descriptor expected to be open. Fd uint8 }