Corenet API: Review fixes

License: MIT
Signed-off-by: Łukasz Magiera <magik6k@gmail.com>
This commit is contained in:
Łukasz Magiera 2017-06-01 20:11:46 +02:00
parent e0bd4a1188
commit e66e8bbe96
2 changed files with 8 additions and 11 deletions

View File

@ -465,7 +465,7 @@ var corenetCloseCmd = &cmds.Command{
useHandlerID := false
if !closeAll && len(req.Arguments()) == 0 {
res.SetError(errors.New(" handlerID nor stream protocol"), cmds.ErrNormal)
res.SetError(errors.New("no handlerID nor stream protocol specified"), cmds.ErrNormal)
return
} else if !closeAll {
@ -479,11 +479,11 @@ var corenetCloseCmd = &cmds.Command{
}
if closeAll || useHandlerID {
for _, s := range n.Corenet.Streams.Streams {
if !closeAll && handlerID != s.HandlerID {
for _, stream := range n.Corenet.Streams.Streams {
if !closeAll && handlerID != stream.HandlerID {
continue
}
s.Close()
stream.Close()
if !closeAll {
break
}
@ -491,19 +491,16 @@ var corenetCloseCmd = &cmds.Command{
}
if closeAll || !useHandlerID {
for _, a := range n.Corenet.Apps.Apps {
if !closeAll && a.Protocol != proto {
for _, app := range n.Corenet.Apps.Apps {
if !closeAll && app.Protocol != proto {
continue
}
a.Close()
app.Close()
if !closeAll {
break
}
}
}
if len(req.Arguments()) != 1 {
}
},
}

View File

@ -47,7 +47,7 @@ ADVANCED COMMANDS
pin Pin objects to local storage
repo Manipulate the IPFS repository
stats Various operational stats
exp Experimental commands
corenet Libp2p stream mounting
filestore Manage the filestore (experimental)
NETWORK COMMANDS