mirror of
https://github.com/ipfs/kubo.git
synced 2025-07-01 10:49:24 +08:00
Merge pull request #1278 from ipfs/fix/bs-cmd-offline
make bitswap commands error out properly offline
This commit is contained in:
@ -38,6 +38,12 @@ Print out all blocks currently on the bitswap wantlist for the local peer`,
|
|||||||
res.SetError(err, cmds.ErrNormal)
|
res.SetError(err, cmds.ErrNormal)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !nd.OnlineMode() {
|
||||||
|
res.SetError(errNotOnline, cmds.ErrClient)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
bs, ok := nd.Exchange.(*bitswap.Bitswap)
|
bs, ok := nd.Exchange.(*bitswap.Bitswap)
|
||||||
if !ok {
|
if !ok {
|
||||||
res.SetError(u.ErrCast(), cmds.ErrNormal)
|
res.SetError(u.ErrCast(), cmds.ErrNormal)
|
||||||
@ -78,6 +84,11 @@ var bitswapStatCmd = &cmds.Command{
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !nd.OnlineMode() {
|
||||||
|
res.SetError(errNotOnline, cmds.ErrClient)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
bs, ok := nd.Exchange.(*bitswap.Bitswap)
|
bs, ok := nd.Exchange.(*bitswap.Bitswap)
|
||||||
if !ok {
|
if !ok {
|
||||||
res.SetError(u.ErrCast(), cmds.ErrNormal)
|
res.SetError(u.ErrCast(), cmds.ErrNormal)
|
||||||
|
Reference in New Issue
Block a user