From 192f4e8f7e92d7c9cd8039286ed8859cc1073876 Mon Sep 17 00:00:00 2001 From: Oleg Guba Date: Wed, 17 Jan 2024 03:06:31 -0800 Subject: [PATCH] torrent.KnownSwarm: keep client lock when iterating over connections (#893) --- torrent.go | 2 ++ 1 file changed, 2 insertions(+) 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,