Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
df70fe4a
Commit
df70fe4a
authored
9 years ago
by
Tommi Virtanen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Serve expvars and pprof on the API port
parent
b1183099
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
0 deletions
+16
-0
cmd/ipfs/daemon.go
cmd/ipfs/daemon.go
+16
-0
No files found.
cmd/ipfs/daemon.go
View file @
df70fe4a
package
main
import
(
_
"expvar"
"fmt"
"net/http"
_
"net/http/pprof"
"os"
"strings"
...
...
@@ -76,6 +79,17 @@ the port as you would other services or database (firewall, authenticated proxy,
Run
:
daemonFunc
,
}
// defaultMux tells mux to serve path using the default muxer. This is
// mostly useful to hook up things that register in the default muxer,
// and don't provide a convenient http.Handler entry point, such as
// expvar and http/pprof.
func
defaultMux
(
path
string
)
func
(
node
*
core
.
IpfsNode
,
mux
*
http
.
ServeMux
)
(
*
http
.
ServeMux
,
error
)
{
return
func
(
node
*
core
.
IpfsNode
,
mux
*
http
.
ServeMux
)
(
*
http
.
ServeMux
,
error
)
{
mux
.
Handle
(
path
,
http
.
DefaultServeMux
)
return
mux
,
nil
}
}
func
daemonFunc
(
req
cmds
.
Request
,
res
cmds
.
Response
)
{
// let the user know we're going.
fmt
.
Printf
(
"Initializing daemon...
\n
"
)
...
...
@@ -281,6 +295,8 @@ func daemonFunc(req cmds.Request, res cmds.Response) {
corehttp
.
WebUIOption
,
gateway
.
ServeOption
(),
corehttp
.
VersionOption
(),
defaultMux
(
"/debug/vars"
),
defaultMux
(
"/debug/pprof/"
),
}
if
rootRedirect
!=
nil
{
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment