server: mark address attempted on attempt rather than upon connection

We should mark addresses as attempted when we attempt to connect to
them, not once we establish a connection with said address.
This commit is contained in:
Wilmer Paulino 2019-10-10 12:03:47 -04:00
parent 988181ef23
commit 06baabe5da
No known key found for this signature in database
GPG key ID: 6DF57B9F9514972F

View file

@ -2032,7 +2032,6 @@ func (s *server) outboundPeerConnected(c *connmgr.ConnReq, conn net.Conn) {
sp.isWhitelisted = isWhitelisted(conn.RemoteAddr())
sp.AssociateConnection(conn)
go s.peerDoneHandler(sp)
s.addrManager.Attempt(sp.NA())
}
// peerDoneHandler handles peer disconnects by notifiying the server that it's
@ -2802,6 +2801,9 @@ func newServer(listenAddrs, agentBlacklist, agentWhitelist []string,
continue
}
// Mark an attempt for the valid address.
s.addrManager.Attempt(addr.NetAddress())
addrString := addrmgr.NetAddressKey(addr.NetAddress())
return addrStringToNetAddr(addrString)
}