lnd: make the http profiling server optional w/ a config param

This commit is contained in:
Olaoluwa Osuntokun committed 2016-06-21 13:12:51 -07:00
1 parent c5f97a17d5
commit cad0d54e43
2 files changed
+31 -14

No files matched your search

+10 -7
View File
@@ -46,13 +46,16 @@ func main() {
return
}
go func() {
listenAddr := net.JoinHostPort("", "5009")
profileRedirect := http.RedirectHandler("/debug/pprof",
http.StatusSeeOther)
http.Handle("/", profileRedirect)
fmt.Println(http.ListenAndServe(listenAddr, nil))
}()
// Enable http profiling server if requested.
if cfg.Profile != "" {
go func() {
listenAddr := net.JoinHostPort("", cfg.Profile)
profileRedirect := http.RedirectHandler("/debug/pprof",
http.StatusSeeOther)
http.Handle("/", profileRedirect)
fmt.Println(http.ListenAndServe(listenAddr, nil))
}()
}
// Open the channeldb, which is dedicated to storing channel, and
// network related meta-data.