From: Matt Joiner Date: Fri, 19 Feb 2021 01:58:20 +0000 (+1100) Subject: Close all peer types when Torrent closed X-Git-Tag: v1.26.0-alpha~15 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=28f17be267020b5300a80ab7465ff0a532227b27;p=btrtrc.git Close all peer types when Torrent closed --- diff --git a/torrent.go b/torrent.go index b30da881..92c13e2f 100644 --- a/torrent.go +++ b/torrent.go @@ -742,9 +742,9 @@ func (t *Torrent) close() (err error) { t.storage.Close() t.storageLock.Unlock() } - for conn := range t.conns { - conn.close() - } + t.iterPeers(func(p *Peer) { + p.close() + }) t.pex.Reset() t.cl.event.Broadcast() t.pieceStateChanges.Close()