From af7a0d34643e5f3a0327d4fef74aefd9956b5636 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Wed, 30 Nov 2016 18:02:39 +1100 Subject: [PATCH] Add Torrent.Closed --- torrent.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/torrent.go b/torrent.go index b9aefae3..68cfb05b 100644 --- a/torrent.go +++ b/torrent.go @@ -115,6 +115,11 @@ type Torrent struct { stats TorrentStats } +// Returns a channel that is closed when the Torrent is closed. +func (t *Torrent) Closed() <-chan struct{} { + return t.closed.LockedChan(&t.cl.mu) +} + func (t *Torrent) setChunkSize(size pp.Integer) { t.chunkSize = size t.chunkPool = &sync.Pool{ -- 2.50.0