]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Add Torrent.Closed
authorMatt Joiner <anacrolix@gmail.com>
Wed, 30 Nov 2016 07:02:39 +0000 (18:02 +1100)
committerMatt Joiner <anacrolix@gmail.com>
Wed, 30 Nov 2016 07:02:39 +0000 (18:02 +1100)
torrent.go

index b9aefae3d8a2068efb503f13a226c0148605b394..68cfb05bedb82d0136ac8cf920eea25a05ae21ca 100644 (file)
@@ -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{