mirror of
https://github.com/btcsuite/btcd.git
synced 2025-01-19 05:33:36 +01:00
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
@ -1563,7 +1563,7 @@ func (s *server) handleUpdatePeerHeights(state *peerState, umsg updatePeerHeight
|
||||
// handleAddPeerMsg deals with adding new peers. It is invoked from the
|
||||
// peerHandler goroutine.
|
||||
func (s *server) handleAddPeerMsg(state *peerState, sp *serverPeer) bool {
|
||||
if sp == nil {
|
||||
if sp == nil || !sp.Connected() {
|
||||
return false
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user