]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Client.Torrent(InfoHash)
authorMatt Joiner <anacrolix@gmail.com>
Thu, 26 Feb 2015 05:10:55 +0000 (16:10 +1100)
committerMatt Joiner <anacrolix@gmail.com>
Thu, 26 Feb 2015 05:10:55 +0000 (16:10 +1100)
client.go

index 9a89761246791f9f5a898d8d651b691b77166946..22b0177f079e427b7f2b16bea45747592385b39f 100644 (file)
--- a/client.go
+++ b/client.go
@@ -2260,6 +2260,14 @@ func (cl *Client) verifyPiece(t *torrent, index pp.Integer) {
        cl.pieceHashed(t, index, sum == p.Hash)
 }
 
+func (cl *Client) Torrent(ih InfoHash) (t Torrent, ok bool) {
+       cl.mu.Lock()
+       defer cl.mu.Unlock()
+       t.torrent, ok = cl.torrents[ih]
+       t.cl = cl
+       return
+}
+
 func (me *Client) Torrents() (ret []Torrent) {
        me.mu.Lock()
        for _, t := range me.torrents {