fix: only block peer if we have the id, and the maps were flipped
This commit is contained in:
parent
fc10a265a7
commit
ab53dbdf08
|
@ -239,16 +239,18 @@ func (p *P2PImpl) ConnectToNode(connectionUris []*url.URL, retried bool, fromPee
|
||||||
p.outgoingPeerFailures.Put(idString, counter)
|
p.outgoingPeerFailures.Put(idString, counter)
|
||||||
|
|
||||||
if counter >= p.maxOutgoingPeerFailures {
|
if counter >= p.maxOutgoingPeerFailures {
|
||||||
fromPeerId, err := fromPeer.Id().ToString()
|
if fromPeer != nil {
|
||||||
if err != nil {
|
fromPeerId, err := fromPeer.Id().ToString()
|
||||||
return err
|
if err != nil {
|
||||||
}
|
return err
|
||||||
p.outgoingPeerBlocklist.Put(fromPeerId, true)
|
}
|
||||||
p.incomingPeerBlockList.Put(idString, true)
|
p.incomingPeerBlockList.Put(fromPeerId, true)
|
||||||
err = fromPeer.End()
|
err = fromPeer.End()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
p.outgoingPeerBlocklist.Put(idString, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in New Issue