client.go | 5 +++++ cmd/torrentfs/main.go | 3 +++ diff --git a/client.go b/client.go index ed037c6cfcf0c803b2a4f95365faefdde5eed85c..981d4d224b584e611f260a49066938d22d320d36 100644 --- a/client.go +++ b/client.go @@ -491,6 +491,11 @@ if cfg == nil { cfg = &Config{} } + defer func() { + if err != nil { + cl = nil + } + }() cl = &Client{ noUpload: cfg.NoUpload, disableTrackers: cfg.DisableTrackers, diff --git a/cmd/torrentfs/main.go b/cmd/torrentfs/main.go index a7e786ae3fa2a7327f5ec55dba66466381cb8afd..03edc8570c5ba20b5dca49746de39ad534c04282 100644 --- a/cmd/torrentfs/main.go +++ b/cmd/torrentfs/main.go @@ -103,6 +103,9 @@ // DownloadStrategy: torrent.NewResponsiveDownloadStrategy(*readaheadBytes), ListenAddr: *listenAddr, NoUpload: true, // Ensure that uploads are responsive. }) + if err != nil { + log.Fatal(err) + } http.DefaultServeMux.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) { client.WriteStatus(w) })