server: prevent adding peers if already disconnected
This addresses an issue where the server ends up tracking a peer that has been disconnected due to it processing a peer's `done` message before its `add` message.
This commit is contained in:
parent
769c4e152f
commit
baeb789a7d
1 changed files with 1 additions and 1 deletions
|
@ -1563,7 +1563,7 @@ func (s *server) handleUpdatePeerHeights(state *peerState, umsg updatePeerHeight
|
||||||
// handleAddPeerMsg deals with adding new peers. It is invoked from the
|
// handleAddPeerMsg deals with adding new peers. It is invoked from the
|
||||||
// peerHandler goroutine.
|
// peerHandler goroutine.
|
||||||
func (s *server) handleAddPeerMsg(state *peerState, sp *serverPeer) bool {
|
func (s *server) handleAddPeerMsg(state *peerState, sp *serverPeer) bool {
|
||||||
if sp == nil {
|
if sp == nil || !sp.Connected() {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue