diff --git a/cmd/ipfs/daemon.go b/cmd/ipfs/daemon.go index 7ccaf8776..e8794f68a 100644 --- a/cmd/ipfs/daemon.go +++ b/cmd/ipfs/daemon.go @@ -269,7 +269,7 @@ func daemonFunc(req cmds.Request, res cmds.Response) { } // our global interrupt handler can now try to stop the daemon - close(req.Context().ContextIsReadyToBeClosed) + close(req.Context().InitDone) if rootRedirect != nil { opts = append(opts, rootRedirect) diff --git a/cmd/ipfs/main.go b/cmd/ipfs/main.go index 69050804c..7696fad99 100644 --- a/cmd/ipfs/main.go +++ b/cmd/ipfs/main.go @@ -137,7 +137,7 @@ func main() { // workaround is for the daemon only; other commands are always // ready to be stopped if invoc.cmd != daemonCmd { - close(invoc.req.Context().ContextIsReadyToBeClosed) + close(invoc.req.Context().InitDone) } // ok, finally, run the command invocation. @@ -482,7 +482,7 @@ func (i *cmdInvocation) setupInterruptHandler() { go func() { // wait till the context is ready to be closed - <-ctx.ContextIsReadyToBeClosed + <-ctx.InitDone // first time, try to shut down. diff --git a/commands/request.go b/commands/request.go index 6a5e05775..e7f9d4e33 100644 --- a/commands/request.go +++ b/commands/request.go @@ -28,9 +28,9 @@ type Context struct { config *config.Config LoadConfig func(path string) (*config.Config, error) - node *core.IpfsNode - ConstructNode func() (*core.IpfsNode, error) - ContextIsReadyToBeClosed chan bool + node *core.IpfsNode + ConstructNode func() (*core.IpfsNode, error) + InitDone chan bool } // GetConfig returns the config of the current Command exection @@ -288,7 +288,7 @@ func NewRequest(path []string, opts OptMap, args []string, file files.File, cmd optDefs = make(map[string]Option) } - ctx := Context{Context: context.TODO(), ContextIsReadyToBeClosed: make(chan bool)} + ctx := Context{Context: context.TODO(), InitDone: make(chan bool)} values := make(map[string]interface{}) req := &request{path, opts, args, file, cmd, ctx, optDefs, values, os.Stdin} err := req.ConvertOptions()