From: Matt Joiner Date: Wed, 1 Apr 2015 03:32:42 +0000 (+1100) Subject: cmd/torrentfs: Tidy X-Git-Tag: v1.0.0~1219 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=0fddc286e6906854162c5e5af8cbcafd31bbdebb;p=btrtrc.git cmd/torrentfs: Tidy --- diff --git a/cmd/torrentfs/main.go b/cmd/torrentfs/main.go index 03edc857..61a11c2e 100644 --- a/cmd/torrentfs/main.go +++ b/cmd/torrentfs/main.go @@ -99,13 +99,13 @@ func main() { client, err := torrent.NewClient(&torrent.Config{ DataDir: *downloadDir, DisableTrackers: *disableTrackers, - // DownloadStrategy: torrent.NewResponsiveDownloadStrategy(*readaheadBytes), - ListenAddr: *listenAddr, - NoUpload: true, // Ensure that uploads are responsive. + ListenAddr: *listenAddr, + NoUpload: true, // Ensure that downloads are responsive. }) if err != nil { log.Fatal(err) } + // This is naturally exported via GOPPROF=http. http.DefaultServeMux.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) { client.WriteStatus(w) }) @@ -129,13 +129,11 @@ func main() { } } case dirwatch.Removed: - for _, t := range client.Torrents() { - if t.InfoHash != ev.InfoHash { - continue - } - t.Drop() + T, ok := client.Torrent(ev.InfoHash) + if !ok { break } + T.Drop() } } }()