Skip to content

Commit

Permalink
server: prevent adding peers if already disconnected
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
wpaulino committed Oct 14, 2019
1 parent 769c4e1 commit baeb789
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit baeb789

Please sign in to comment.