1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-06-30 01:52:26 +08:00

cmds: can't call SetError after SetOutput

License: MIT
Signed-off-by: Steven Allen <steven@stebalien.com>
This commit is contained in:
Steven Allen
2018-01-25 18:02:59 -08:00
parent 699b2c4bb8
commit 1159abd83e

View File

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