]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Torrent.WebseedPeerConns() method (#883) v1.53.2
authorAlex Sharov <AskAlexSharov@gmail.com>
Mon, 4 Dec 2023 11:31:34 +0000 (18:31 +0700)
committeralex.sharov <AskAlexSharov@gmail.com>
Tue, 5 Dec 2023 02:17:27 +0000 (09:17 +0700)
t.go

diff --git a/t.go b/t.go
index 45856cc7acbeaa5988074f74435d078a49111a57..6a4607068aa0154987e9169429bd52f27f6188f9 100644 (file)
--- a/t.go
+++ b/t.go
@@ -274,3 +274,13 @@ func (t *Torrent) PeerConns() []*PeerConn {
        }
        return ret
 }
+
+func (t *Torrent) WebseedPeerConns() []*Peer {
+       t.cl.rLock()
+       defer t.cl.rUnlock()
+       ret := make([]*Peer, 0, len(t.conns))
+       for _, c := range t.webSeeds {
+               ret = append(ret, c)
+       }
+       return ret
+}