Skip to content

Commit

Permalink
torrent.KnownSwarm: keep client lock when iterating over connections (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
veshij authored Jan 17, 2024
1 parent 867996b commit 192f4e8
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions torrent.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,8 @@ func (t *Torrent) KnownSwarm() (ks []PeerInfo) {
}

// Add active peers to the list
t.cl.rLock()
defer t.cl.rUnlock()
for conn := range t.conns {
ks = append(ks, PeerInfo{
Id: conn.PeerID,
Expand Down

0 comments on commit 192f4e8

Please sign in to comment.