Commit c8cb8d9c authored by Juan Batiz-Benet's avatar Juan Batiz-Benet

Merge pull request #1278 from ipfs/fix/bs-cmd-offline

make bitswap commands error out properly offline
parents 10c36282 648526d8
......@@ -38,6 +38,12 @@ Print out all blocks currently on the bitswap wantlist for the local peer`,
res.SetError(err, cmds.ErrNormal)
return
}
if !nd.OnlineMode() {
res.SetError(errNotOnline, cmds.ErrClient)
return
}
bs, ok := nd.Exchange.(*bitswap.Bitswap)
if !ok {
res.SetError(u.ErrCast(), cmds.ErrNormal)
......@@ -78,6 +84,11 @@ var bitswapStatCmd = &cmds.Command{
return
}
if !nd.OnlineMode() {
res.SetError(errNotOnline, cmds.ErrClient)
return
}
bs, ok := nd.Exchange.(*bitswap.Bitswap)
if !ok {
res.SetError(u.ErrCast(), cmds.ErrNormal)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment