From: Alex Sharov Date: Mon, 4 Dec 2023 11:31:34 +0000 (+0700) Subject: Torrent.WebseedPeerConns() method (#883) X-Git-Tag: v1.52.7 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=39e605a5e7712813e0750c423ab734dd5e6eeaf2;p=btrtrc.git Torrent.WebseedPeerConns() method (#883) --- diff --git a/t.go b/t.go index 45856cc7..6a460706 100644 --- 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 +}