]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Move envpprof.Stop to main
authorMatt Joiner <anacrolix@gmail.com>
Fri, 14 May 2021 03:39:01 +0000 (13:39 +1000)
committerMatt Joiner <anacrolix@gmail.com>
Fri, 14 May 2021 05:43:24 +0000 (15:43 +1000)
cmd/torrent/main.go

index a04eb5eabb341125811d8bf91a7a0006630a4ee2..02020e77b30a8feebba5135308dcd7bb55f603b1 100644 (file)
@@ -15,6 +15,7 @@ import (
        "time"
 
        "github.com/alexflint/go-arg"
+       "github.com/anacrolix/envpprof"
        "github.com/anacrolix/missinggo"
        "github.com/anacrolix/torrent/bencode"
        "github.com/davecgh/go-spew/spew"
@@ -23,7 +24,6 @@ import (
 
        "github.com/anacrolix/log"
 
-       "github.com/anacrolix/envpprof"
        "github.com/anacrolix/tagflag"
        "golang.org/x/time/rate"
 
@@ -223,6 +223,7 @@ func exitSignalHandlers(notify *missinggo.SynchronizedEvent) {
 }
 
 func main() {
+       defer envpprof.Stop()
        if err := mainErr(); err != nil {
                log.Printf("error in main: %v", err)
                os.Exit(1)
@@ -273,7 +274,6 @@ func mainErr() error {
 }
 
 func downloadErr() error {
-       defer envpprof.Stop()
        clientConfig := torrent.NewDefaultClientConfig()
        clientConfig.DisableWebseeds = flags.DisableWebseeds
        clientConfig.DisableTCP = !flags.TcpPeers