fix(cmd/id) determine offline-ness with `!node.OnlineMode()`
It's better to have one mechanism for determining whether we're offline and to improve the SnR of this mechanism over time. We presently have too many arbitrary heuristics for determining whether we're running in offline mode. TRTTD is to use polymorphism to eliminate these conditional checks. (instantiate the node with offline versions of routing, network, etc.) It'll clean up the core constructor, make it easier to create ephemeral nodes, and eliminate a class of errors. @whyrusleeping @jbenet License: MIT Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
Brian Tiger Chow committed
Dec 1, 2014 at 05:52 UTC
3bdb36614ed1962997ea1b34561402731ccdc61b
1 file changed
+2
-1
core/commands/id.go
+2
-1
@@ -60,7 +60,8 @@ if no peer is specified, prints out local peers info.
60
}
61
62
ctx, _ := context.WithTimeout(context.TODO(), time.Second*5)
63
- if node.Routing == nil {
63
+ // TODO handle offline mode with polymorphism instead of conditionals
64
+ if !node.OnlineMode() {
65
return nil, errors.New(offlineIdErrorMessage)
66
}
67