]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Provide HTTP pprof via envpprof package
authorMatt Joiner <anacrolix@gmail.com>
Thu, 29 Jan 2015 03:51:23 +0000 (14:51 +1100)
committerMatt Joiner <anacrolix@gmail.com>
Thu, 29 Jan 2015 03:51:23 +0000 (14:51 +1100)
cmd/dht-get-peers/main.go
cmd/torrent/main.go
cmd/torrentfs/main.go

index 75d52e094b74d03428b48a889ca4195213e2d57b..40adb32ef2f1e3349499906c36a2520d539acfbc 100644 (file)
@@ -9,6 +9,8 @@ import (
        "os"
        "os/signal"
 
+       _ "github.com/anacrolix/envpprof"
+
        "bitbucket.org/anacrolix/go.torrent/dht"
        "bitbucket.org/anacrolix/go.torrent/util"
        _ "bitbucket.org/anacrolix/go.torrent/util/profile"
@@ -129,7 +131,6 @@ func setupSignals() {
 }
 
 func main() {
-       util.LoggedHTTPServe("")
        seen := make(map[util.CompactPeer]struct{})
 getPeers:
        for {
index 121a7b837671a59717f43edadb7b0863149481f1..54a541ce14fc1098974ac008713af7b0fce5b34f 100644 (file)
@@ -10,16 +10,16 @@ import (
        "os"
        "strings"
 
+       _ "github.com/anacrolix/envpprof"
+
        "github.com/anacrolix/libtorgo/metainfo"
 
        "bitbucket.org/anacrolix/go.torrent"
-       "bitbucket.org/anacrolix/go.torrent/util"
 )
 
 var (
        downloadDir = flag.String("downloadDir", "", "directory to store download torrent data")
        testPeer    = flag.String("testPeer", "", "bootstrap peer address")
-       httpAddr    = flag.String("httpAddr", "localhost:6061", "http serve address")
        // TODO: Check the default torrent listen port.
        listenAddr      = flag.String("listenAddr", ":50007", "incoming connection address")
        disableTrackers = flag.Bool("disableTrackers", false, "disable trackers")
@@ -30,9 +30,6 @@ var (
 func main() {
        log.SetFlags(log.LstdFlags | log.Lshortfile)
        flag.Parse()
-       if *httpAddr != "" {
-               util.LoggedHTTPServe(*httpAddr)
-       }
        client, err := torrent.NewClient(&torrent.Config{
                DataDir:         *downloadDir,
                DisableTrackers: *disableTrackers,
index b8a82535ab4ebb6940f76688b449f90267db8801..328e65dd11fabfb5b3e1bccebf4df1c190f68dfc 100644 (file)
@@ -13,7 +13,8 @@ import (
        "syscall"
        "time"
 
-       "bitbucket.org/anacrolix/go.torrent/util"
+       _ "github.com/anacrolix/envpprof"
+
        "bitbucket.org/anacrolix/go.torrent/util/dirwatch"
 
        "bazil.org/fuse"
@@ -35,7 +36,6 @@ var (
 
        disableTrackers = flag.Bool("disableTrackers", false, "disables trackers")
        testPeer        = flag.String("testPeer", "", "the address for a test peer")
-       httpAddr        = flag.String("httpAddr", "localhost:0", "HTTP server bind address")
        readaheadBytes  = flag.Int64("readaheadBytes", 10*1024*1024, "bytes to readahead in each torrent from the last read piece")
        listenAddr      = flag.String("listenAddr", ":6882", "incoming connection address")
 
@@ -90,9 +90,6 @@ func main() {
                os.Exit(2)
        }
        log.SetFlags(log.LstdFlags | log.Lshortfile)
-       if *httpAddr != "" {
-               util.LoggedHTTPServe(*httpAddr)
-       }
        conn, err := fuse.Mount(*mountDir)
        if err != nil {
                log.Fatal(err)