From: Oleg Guba Date: Wed, 17 Jan 2024 11:06:31 +0000 (-0800) Subject: torrent.KnownSwarm: keep client lock when iterating over connections (#893) X-Git-Tag: v1.53.3~2 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=192f4e8f7e92d7c9cd8039286ed8859cc1073876;p=btrtrc.git torrent.KnownSwarm: keep client lock when iterating over connections (#893) --- diff --git a/torrent.go b/torrent.go index 2d0cce2e..0b1baba5 100644 --- a/torrent.go +++ b/torrent.go @@ -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,