提交 0b73a48b 作者: Matt Bell 提交者: Juan Batiz-Benet

commands/http: Made Handler set request contexts

上级 3f4da97c
...@@ -20,6 +20,8 @@ var Daemon = &cmds.Command{ ...@@ -20,6 +20,8 @@ var Daemon = &cmds.Command{
} }
func daemonFunc(req cmds.Request, res cmds.Response) { func daemonFunc(req cmds.Request, res cmds.Response) {
// TODO: spin up a core.IpfsNode
ctx := req.Context() ctx := req.Context()
lk, err := daemon.Lock(ctx.ConfigRoot) lk, err := daemon.Lock(ctx.ConfigRoot)
...@@ -41,7 +43,7 @@ func daemonFunc(req cmds.Request, res cmds.Response) { ...@@ -41,7 +43,7 @@ func daemonFunc(req cmds.Request, res cmds.Response) {
return return
} }
handler := cmdsHttp.Handler{} handler := cmdsHttp.Handler{*ctx}
http.Handle(cmdsHttp.ApiPath+"/", handler) http.Handle(cmdsHttp.ApiPath+"/", handler)
err = http.ListenAndServe(host, nil) err = http.ListenAndServe(host, nil)
if err != nil { if err != nil {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论