torrent.go | 5 +++++ diff --git a/torrent.go b/torrent.go index b9aefae3d8a2068efb503f13a226c0148605b394..68cfb05bedb82d0136ac8cf920eea25a05ae21ca 100644 --- a/torrent.go +++ b/torrent.go @@ -115,6 +115,11 @@ // Torrent-level statistics. 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{