提交 d23bed5b 作者: Konstantin Koroviev

Rename `ContextIsReadyToBeClosed` to `InitDone`

上级 afd497e1
...@@ -269,7 +269,7 @@ func daemonFunc(req cmds.Request, res cmds.Response) { ...@@ -269,7 +269,7 @@ func daemonFunc(req cmds.Request, res cmds.Response) {
} }
// our global interrupt handler can now try to stop the daemon // our global interrupt handler can now try to stop the daemon
close(req.Context().ContextIsReadyToBeClosed) close(req.Context().InitDone)
if rootRedirect != nil { if rootRedirect != nil {
opts = append(opts, rootRedirect) opts = append(opts, rootRedirect)
......
...@@ -137,7 +137,7 @@ func main() { ...@@ -137,7 +137,7 @@ func main() {
// workaround is for the daemon only; other commands are always // workaround is for the daemon only; other commands are always
// ready to be stopped // ready to be stopped
if invoc.cmd != daemonCmd { if invoc.cmd != daemonCmd {
close(invoc.req.Context().ContextIsReadyToBeClosed) close(invoc.req.Context().InitDone)
} }
// ok, finally, run the command invocation. // ok, finally, run the command invocation.
...@@ -482,7 +482,7 @@ func (i *cmdInvocation) setupInterruptHandler() { ...@@ -482,7 +482,7 @@ func (i *cmdInvocation) setupInterruptHandler() {
go func() { go func() {
// wait till the context is ready to be closed // wait till the context is ready to be closed
<-ctx.ContextIsReadyToBeClosed <-ctx.InitDone
// first time, try to shut down. // first time, try to shut down.
......
...@@ -28,9 +28,9 @@ type Context struct { ...@@ -28,9 +28,9 @@ type Context struct {
config *config.Config config *config.Config
LoadConfig func(path string) (*config.Config, error) LoadConfig func(path string) (*config.Config, error)
node *core.IpfsNode node *core.IpfsNode
ConstructNode func() (*core.IpfsNode, error) ConstructNode func() (*core.IpfsNode, error)
ContextIsReadyToBeClosed chan bool InitDone chan bool
} }
// GetConfig returns the config of the current Command exection // 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 ...@@ -288,7 +288,7 @@ func NewRequest(path []string, opts OptMap, args []string, file files.File, cmd
optDefs = make(map[string]Option) 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{}) values := make(map[string]interface{})
req := &request{path, opts, args, file, cmd, ctx, optDefs, values, os.Stdin} req := &request{path, opts, args, file, cmd, ctx, optDefs, values, os.Stdin}
err := req.ConvertOptions() err := req.ConvertOptions()
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论