network: don't reconnect to peers with identical ID
This commit is contained in:
parent
fdd5276d3e
commit
b5fb43bac9
1 changed files with 6 additions and 2 deletions
|
@ -235,8 +235,12 @@ func (s *Server) run() {
|
||||||
"peerCount": s.PeerCount(),
|
"peerCount": s.PeerCount(),
|
||||||
}).Warn("peer disconnected")
|
}).Warn("peer disconnected")
|
||||||
addr := drop.peer.PeerAddr().String()
|
addr := drop.peer.PeerAddr().String()
|
||||||
|
if drop.reason == errIdenticalID {
|
||||||
|
s.discovery.RegisterBadAddr(addr)
|
||||||
|
} else {
|
||||||
s.discovery.UnregisterConnectedAddr(addr)
|
s.discovery.UnregisterConnectedAddr(addr)
|
||||||
s.discovery.BackFill(addr)
|
s.discovery.BackFill(addr)
|
||||||
|
}
|
||||||
updatePeersConnectedMetric(s.PeerCount())
|
updatePeersConnectedMetric(s.PeerCount())
|
||||||
} else {
|
} else {
|
||||||
// else the peer is already gone, which can happen
|
// else the peer is already gone, which can happen
|
||||||
|
|
Loading…
Reference in a new issue