Commit 5cb66fe0 authored by Esad Akar's avatar Esad Akar Committed by GitHub

fix: carry over existing failedAttempts after disconnect (#1857)

parent 1052e690
...@@ -857,7 +857,11 @@ func (k *Kad) Disconnected(peer p2p.Peer) { ...@@ -857,7 +857,11 @@ func (k *Kad) Disconnected(peer p2p.Peer) {
k.connectedPeers.Remove(peer.Address, po) k.connectedPeers.Remove(peer.Address, po)
k.waitNextMu.Lock() k.waitNextMu.Lock()
k.waitNext[peer.Address.ByteString()] = retryInfo{tryAfter: time.Now().Add(timeToRetry), failedAttempts: 0} newInfo := retryInfo{tryAfter: time.Now().Add(timeToRetry), failedAttempts: 0}
if info, ok := k.waitNext[peer.Address.ByteString()]; ok {
newInfo.failedAttempts = info.failedAttempts
}
k.waitNext[peer.Address.ByteString()] = newInfo
k.waitNextMu.Unlock() k.waitNextMu.Unlock()
if err := k.collector.Record( if err := k.collector.Record(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment