@cryptotaxi247 / kubo / commits / dfe2b1676

cmds/id: use req context -- dont timeout unnecessarily

commands should last as long as the user keeps the cmd going

Juan Batiz-Benet committed Mar 7, 2015 at 09:23 UTC dfe2b1676395f205f074e7be54cf5e241c277f12
1 file changed +1 -4
core/commands/id.go
+1 -4
@@ -7,10 +7,8 @@ import (
7 "errors"
8 "io"
9 "strings"
10 - "time"
10
11 b58 "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-base58"
13 - "github.com/jbenet/go-ipfs/Godeps/_workspace/src/golang.org/x/net/context"
12
13 cmds "github.com/jbenet/go-ipfs/commands"
14 core "github.com/jbenet/go-ipfs/core"
@@ -81,14 +79,13 @@ ipfs id supports the format option for output with the following keys:
79 return
80 }
81
84 - ctx, _ := context.WithTimeout(context.TODO(), time.Second*5)
82 // TODO handle offline mode with polymorphism instead of conditionals
83 if !node.OnlineMode() {
84 res.SetError(errors.New(offlineIdErrorMessage), cmds.ErrClient)
85 return
86 }
87
91 - p, err := node.Routing.FindPeer(ctx, id)
88 + p, err := node.Routing.FindPeer(req.Context().Context, id)
89 if err == kb.ErrLookupFailure {
90 res.SetError(errors.New(offlineIdErrorMessage), cmds.ErrClient)
91 return