From 0fddc286e6906854162c5e5af8cbcafd31bbdebb Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Wed, 1 Apr 2015 14:32:42 +1100 Subject: [PATCH] cmd/torrentfs: Tidy --- cmd/torrentfs/main.go | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) 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() } } }() -- 2.48.1