@cryptotaxi247 / kubo / commits / 59178057a

fix: use EmitOnce where only single response is to be sent

Part of #4818 License: MIT Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>

Jakub Sztandera committed Mar 16, 2018 at 10:17 UTC 59178057a2d8ed5e01f24578481b8ba92ed9c0ac
2 files changed +3 -3
core/commands/commands.go
+1 -1
@@ -71,7 +71,7 @@ func CommandsCmd(root *cmds.Command) *cmds.Command {
71 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) {
72 rootCmd := cmd2outputCmd("ipfs", root)
73 rootCmd.showOpts, _ = req.Options[flagsOptionName].(bool)
74 - err := res.Emit(&rootCmd)
74 + err := cmds.EmitOnce(res, &rootCmd)
75 if err != nil {
76 log.Error(err)
77 }
core/commands/files.go
+2 -2
@@ -151,7 +151,7 @@ var filesStatCmd = &cmds.Command{
151 }
152
153 if !withLocal {
154 - res.Emit(o)
154 + cmds.EmitOnce(res, o)
155 return
156 }
157
@@ -161,7 +161,7 @@ var filesStatCmd = &cmds.Command{
161 o.Local = local
162 o.SizeLocal = sizeLocal
163
164 - res.Emit(o)
164 + cmds.EmitOnce(res, o)
165 },
166 Encoders: cmds.EncoderMap{
167 cmds.Text: cmds.MakeEncoder(func(req *cmds.Request, w io.Writer, v interface{}) error {