From f588522b66fd80145b86c1e85c5cd92b91fb0cb9 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Thu, 26 Feb 2015 16:10:55 +1100 Subject: [PATCH] Client.Torrent(InfoHash) --- client.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/client.go b/client.go index 9a897612..22b0177f 100644 --- 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 { -- 2.48.1