Skip to content

Commit 648526d

Browse files
committedMay 22, 2015
make bitswap commands error out properly offline
1 parent eff73cc commit 648526d

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed
 

‎core/commands/bitswap.go

+11
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ Print out all blocks currently on the bitswap wantlist for the local peer`,
3838
res.SetError(err, cmds.ErrNormal)
3939
return
4040
}
41+
42+
if !nd.OnlineMode() {
43+
res.SetError(errNotOnline, cmds.ErrClient)
44+
return
45+
}
46+
4147
bs, ok := nd.Exchange.(*bitswap.Bitswap)
4248
if !ok {
4349
res.SetError(u.ErrCast(), cmds.ErrNormal)
@@ -78,6 +84,11 @@ var bitswapStatCmd = &cmds.Command{
7884
return
7985
}
8086

87+
if !nd.OnlineMode() {
88+
res.SetError(errNotOnline, cmds.ErrClient)
89+
return
90+
}
91+
8192
bs, ok := nd.Exchange.(*bitswap.Bitswap)
8293
if !ok {
8394
res.SetError(u.ErrCast(), cmds.ErrNormal)

0 commit comments

Comments
 (0)
Please sign in to comment.