torrent.KnownSwarm: keep client lock when iterating over connections (#893)
This commit is contained in:
parent
867996b876
commit
192f4e8f7e
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue