From 61a5640a95dec850443af3d7406280bcedfd9f52 Mon Sep 17 00:00:00 2001 From: Matthias Radestock Date: Tue, 28 Apr 2015 16:07:34 +0100 Subject: [PATCH] do not connect to weave port of outbound connection endpoints There is no point. --- router/connection_maker.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/router/connection_maker.go b/router/connection_maker.go index dc93d8f3..c771bc20 100644 --- a/router/connection_maker.go +++ b/router/connection_maker.go @@ -215,12 +215,13 @@ func (cm *ConnectionMaker) addPeerTargets(ourConnectedPeers PeerNameSet, addTarg continue } address := conn.RemoteTCPAddr() - // Try both port of connection and standard port. Don't - // use remote side of inbound connection. if conn.Outbound() { addTarget(address) - } - if ip, _, err := net.SplitHostPort(address); err == nil { + } else if ip, _, err := net.SplitHostPort(address); err == nil { + // There is no point connecting to the (likely + // ephemeral) remote port of an inbound connection + // that some peer has. Let's try to connect to on the + // weave port instead. addTarget(fmt.Sprintf("%s:%d", ip, cm.port)) } }