From f8b074f69694cf746ec1fdb2e35fe133fb651711 Mon Sep 17 00:00:00 2001 From: Matthias Radestock Date: Wed, 30 Sep 2015 11:03:20 +0100 Subject: [PATCH] a better way to clean up after established connections ...than 3db4e86 --- router/connection_maker.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/router/connection_maker.go b/router/connection_maker.go index 5cb11771..1514b5e0 100644 --- a/router/connection_maker.go +++ b/router/connection_maker.go @@ -99,7 +99,11 @@ func (cm *ConnectionMaker) ConnectionAborted(address string, err error) { func (cm *ConnectionMaker) ConnectionCreated(conn Connection) { cm.actionChan <- func() bool { - cm.connections[conn.RemoteTCPAddr()] = conn + address := conn.RemoteTCPAddr() + cm.connections[address] = conn + if conn.Outbound() { + delete(cm.targets, address) + } return false } } @@ -189,7 +193,6 @@ func (cm *ConnectionMaker) ourConnections() (PeerNameSet, map[string]struct{}) { ourInboundIPs = make(map[string]struct{}) ) for address, conn := range cm.connections { - delete(cm.targets, address) ourConnectedPeers[conn.Remote().Name] = void if conn.Outbound() { continue