提交 1159abd8 作者: Steven Allen

cmds: can't call SetError after SetOutput

License: MIT
Signed-off-by: 's avatarSteven Allen <steven@stebalien.com>
上级 699b2c4b
......@@ -174,9 +174,6 @@ var findProvidersDhtCmd = &cmds.Command{
return
}
outChan := make(chan interface{})
res.SetOutput((<-chan interface{})(outChan))
events := make(chan *notif.QueryEvent)
ctx := notif.RegisterForQueryEvents(req.Context(), events)
......@@ -186,6 +183,9 @@ var findProvidersDhtCmd = &cmds.Command{
return
}
outChan := make(chan interface{})
res.SetOutput((<-chan interface{})(outChan))
pchan := dht.FindProvidersAsync(ctx, c, numProviders)
go func() {
defer close(outChan)
......@@ -535,18 +535,18 @@ Different key types can specify other 'best' rules.
return
}
outChan := make(chan interface{})
res.SetOutput((<-chan interface{})(outChan))
events := make(chan *notif.QueryEvent)
ctx := notif.RegisterForQueryEvents(req.Context(), events)
dhtkey, err := escapeDhtKey(req.Arguments()[0])
if err != nil {
res.SetError(err, cmdkit.ErrNormal)
return
}
outChan := make(chan interface{})
res.SetOutput((<-chan interface{})(outChan))
events := make(chan *notif.QueryEvent)
ctx := notif.RegisterForQueryEvents(req.Context(), events)
go func() {
defer close(outChan)
for e := range events {
......@@ -650,9 +650,6 @@ NOTE: A value may not exceed 2048 bytes.
return
}
outChan := make(chan interface{})
res.SetOutput((<-chan interface{})(outChan))
events := make(chan *notif.QueryEvent)
ctx := notif.RegisterForQueryEvents(req.Context(), events)
......@@ -662,6 +659,9 @@ NOTE: A value may not exceed 2048 bytes.
return
}
outChan := make(chan interface{})
res.SetOutput((<-chan interface{})(outChan))
data := req.Arguments()[1]
go func() {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论