[NOD-717] Fix nodes getting stuck in an infinite loop in addrManager.getAddress (#624)

* [NOD-717] Fix nodes getting stuck in an infinite loop in addrManager.getAddress.

* [NOD-717] Rename ResetFailedAttempts -> NotifyConnectionRequestComplete.
This commit is contained in:
stasatdaglabs 2020-02-06 18:17:10 +02:00 committed by GitHub
parent 3dd7dc4496
commit 5b8ab63890
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View File

@ -336,7 +336,6 @@ out:
conns[connReq.id] = connReq
log.Debugf("Connected to %s", connReq)
connReq.retryCount = 0
cm.failedAttempts = 0
delete(pending, connReq.id)
@ -429,6 +428,13 @@ out:
log.Trace("Connection handler done")
}
// NotifyConnectionRequestComplete notifies the connection
// manager that a peer had been successfully connected and
// marked as good.
func (cm *ConnManager) NotifyConnectionRequestComplete() {
cm.failedAttempts = 0
}
// NewConnReq creates a new connection request and connects to the
// corresponding address.
func (cm *ConnManager) NewConnReq() {

View File

@ -688,6 +688,9 @@ func (s *Server) handleAddPeerMsg(state *peerState, sp *Peer) bool {
}
}
// Notify the connection manager.
s.connManager.NotifyConnectionRequestComplete()
return true
}