]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Inlineable `(*Torrent).AddPeers()` (#622)
authorYenForYang <YenForYang@users.noreply.github.com>
Wed, 15 Sep 2021 00:14:07 +0000 (19:14 -0500)
committerGitHub <noreply@github.com>
Wed, 15 Sep 2021 00:14:07 +0000 (10:14 +1000)
t.go

diff --git a/t.go b/t.go
index 3f65d48ba88f76521d4ac3bdea42164024d79646..aae6812baf24a056f0527ca557555f141a123a8d 100644 (file)
--- 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