From: YenForYang Date: Wed, 15 Sep 2021 00:14:07 +0000 (-0500) Subject: Inlineable `(*Torrent).AddPeers()` (#622) X-Git-Tag: v1.32.0~57 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=d00ba917c04be2e3f2703414f1cc8f93470e0ce7;p=btrtrc.git Inlineable `(*Torrent).AddPeers()` (#622) --- diff --git a/t.go b/t.go index 3f65d48b..aae6812b 100644 --- a/t.go +++ b/t.go @@ -243,11 +243,11 @@ func (t *Torrent) Files() []*File { return *t.files } -func (t *Torrent) AddPeers(pp []PeerInfo) int { - cl := t.cl - cl.lock() - defer cl.unlock() - return t.addPeers(pp) +func (t *Torrent) AddPeers(pp []PeerInfo) (n int) { + t.cl.lock() + n = t.addPeers(pp) + t.cl.unlock() + return } // Marks the entire torrent for download. Requires the info first, see