1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-06-25 23:21:54 +08:00

Rename ContextIsReadyToBeClosed to InitDone

This commit is contained in:
Konstantin Koroviev
2015-03-12 11:42:07 +02:00
parent afd497e194
commit d23bed5baa
3 changed files with 7 additions and 7 deletions

View File

@ -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)

View File

@ -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() {
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.

View File

@ -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
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()