mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-29 17:36:38 +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)
|
||||
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)
|
||||
|
Reference in New Issue
Block a user