Skip to content

Commit

Permalink
fix: skip connected peers
Browse files Browse the repository at this point in the history
  • Loading branch information
trim21 committed Jul 29, 2024
1 parent 0ba733c commit 1f3fab7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions internal/core/p.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,9 +334,10 @@ func (p *Peer) start(skipHandshake bool) {
}()

// make it visible to download
_, loaded := p.d.peers.LoadAndStore(p.Address, p)
_, loaded := p.d.peers.LoadOrStore(p.Address, p)
if loaded {
panic("unexpected connected peer")
// connected peers, just ignore
return
}

go p.ourRequestHandle()
Expand Down

0 comments on commit 1f3fab7

Please sign in to comment.