1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-06-03 20:32:14 +08:00

error out swarm filter when no daemon is online

License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
This commit is contained in:
Jeromy
2015-07-10 13:10:22 -07:00
parent f6f9cae4e4
commit e8d825de25

View File

@ -392,6 +392,11 @@ Filters default to those specified under the "Swarm.AddrFilters" config key.
return
}
if n.PeerHost == nil {
res.SetError(errNotOnline, cmds.ErrNormal)
return
}
snet, ok := n.PeerHost.Network().(*swarm.Network)
if !ok {
res.SetError(errors.New("failed to cast network to swarm network"), cmds.ErrNormal)
@ -434,6 +439,11 @@ add your filters to the ipfs config file.
return
}
if n.PeerHost == nil {
res.SetError(errNotOnline, cmds.ErrNormal)
return
}
snet, ok := n.PeerHost.Network().(*swarm.Network)
if !ok {
res.SetError(errors.New("failed to cast network to swarm network"), cmds.ErrNormal)