Skip to content

Commit

Permalink
commands/bitswap: use cmds.EmitOnce in single value
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Overbool <overbool.xu@gmail.com>
  • Loading branch information
overbool committed Oct 30, 2018
1 parent dbd1e11 commit 2280247
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions core/commands/bitswap.go
Expand Up @@ -68,12 +68,12 @@ Print out all blocks currently on the bitswap wantlist for the local peer.`,
return err
}
if pid == nd.Identity {
return res.Emit(&KeyList{bs.GetWantlist()})
return cmds.EmitOnce(res, &KeyList{bs.GetWantlist()})
}

return res.Emit(&KeyList{bs.WantlistForPeer(pid)})
return cmds.EmitOnce(res, &KeyList{bs.WantlistForPeer(pid)})
}
return res.Emit(&KeyList{bs.GetWantlist()})
return cmds.EmitOnce(res, &KeyList{bs.GetWantlist()})
},
Encoders: cmds.EncoderMap{
cmds.Text: cmds.MakeTypedEncoder(func(req *cmds.Request, w io.Writer, out *KeyList) error {
Expand Down Expand Up @@ -175,7 +175,7 @@ prints the ledger associated with a given peer.
if err != nil {
return err
}
return res.Emit(bs.LedgerForPeer(partner))
return cmds.EmitOnce(res, bs.LedgerForPeer(partner))
},
Encoders: cmds.EncoderMap{
cmds.Text: cmds.MakeTypedEncoder(func(req *cmds.Request, w io.Writer, out *decision.Receipt) error {
Expand Down

0 comments on commit 2280247

Please sign in to comment.