do not connect to weave port of outbound connection endpoints

There is no point.
This commit is contained in:
Matthias Radestock committed 2015-04-28 16:07:34 +01:00
1 parent 5835838202
commit 61a5640a95
1 file changed
+5 -4
+5 -4
View File
@@ -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))
}
}