Commit 15bbfb15 authored by Jeromy's avatar Jeromy

if no context set in request, use context.TODO()

License: MIT
Signed-off-by: default avatarJeromy <jeromyj@gmail.com>
parent 2b99f038
...@@ -13,6 +13,8 @@ import ( ...@@ -13,6 +13,8 @@ import (
cmds "github.com/ipfs/go-ipfs/commands" cmds "github.com/ipfs/go-ipfs/commands"
config "github.com/ipfs/go-ipfs/repo/config" config "github.com/ipfs/go-ipfs/repo/config"
context "github.com/ipfs/go-ipfs/Godeps/_workspace/src/golang.org/x/net/context"
) )
const ( const (
...@@ -35,6 +37,14 @@ func NewClient(address string) Client { ...@@ -35,6 +37,14 @@ func NewClient(address string) Client {
func (c *client) Send(req cmds.Request) (cmds.Response, error) { func (c *client) Send(req cmds.Request) (cmds.Response, error) {
if req.Context() == nil {
log.Warningf("no context set in request")
err := req.SetRootContext(context.TODO())
if err != nil {
return nil, err
}
}
// save user-provided encoding // save user-provided encoding
previousUserProvidedEncoding, found, err := req.Option(cmds.EncShort).String() previousUserProvidedEncoding, found, err := req.Option(cmds.EncShort).String()
if err != nil { if err != nil {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment