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

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

make bitswap commands error out properly offline
This commit is contained in:
Juan Batiz-Benet
2015-05-22 22:54:51 +02:00

View File

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