if !ok {
return
}
- T = Torrent{cl, t, t.gotMetainfo}
+ T = Torrent{cl, t}
return
}
func (me *Client) Torrents() (ret []Torrent) {
me.mu.Lock()
for _, t := range me.torrents {
- ret = append(ret, Torrent{me, t, t.gotMetainfo})
+ ret = append(ret, Torrent{me, t})
}
me.mu.Unlock()
return
type Torrent struct {
cl *Client
*torrent
- // Closed when the info (.Info()) for the torrent has become available.
- // Using features of Torrent that require the info before it is available
- // will have undefined behaviour.
- GotInfo <-chan struct{}
+}
+
+// Closed when the info (.Info()) for the torrent has become available. Using
+// features of Torrent that require the info before it is available will have
+// undefined behaviour.
+func (t *Torrent) GotInfo() <-chan struct{} {
+ return t.torrent.gotMetainfo
}
func (t *Torrent) Info() *metainfo.Info {