From 7a314afb3114f246801defc3b879f8d94fd022d0 Mon Sep 17 00:00:00 2001 From: Arceliar Date: Tue, 31 Mar 2020 18:14:20 -0500 Subject: [PATCH] check if an error was returned by Core._init and return it if so --- contrib/ansible/genkeys.go | 4 ++-- src/yggdrasil/core.go | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/contrib/ansible/genkeys.go b/contrib/ansible/genkeys.go index 1d7c222d..681431b5 100644 --- a/contrib/ansible/genkeys.go +++ b/contrib/ansible/genkeys.go @@ -12,9 +12,9 @@ import ( "net" "os" + "github.com/cheggaaa/pb/v3" "github.com/yggdrasil-network/yggdrasil-go/src/address" "github.com/yggdrasil-network/yggdrasil-go/src/crypto" - "github.com/cheggaaa/pb/v3" ) var numHosts = flag.Int("hosts", 1, "number of host vars to generate") @@ -30,7 +30,7 @@ type keySet struct { func main() { flag.Parse() - bar := pb.StartNew(*keyTries * 2 + *numHosts) + bar := pb.StartNew(*keyTries*2 + *numHosts) if *numHosts > *keyTries { println("Can't generate less keys than hosts.") diff --git a/src/yggdrasil/core.go b/src/yggdrasil/core.go index 98a5c6e1..d88b787d 100644 --- a/src/yggdrasil/core.go +++ b/src/yggdrasil/core.go @@ -160,7 +160,10 @@ func (c *Core) _start(nc *config.NodeConfig, log *log.Logger) (*config.NodeState } c.log.Infoln("Starting up...") - c._init() + if err := c._init(); err != nil { + c.log.Errorln("Failed to initialize core") + return nil, err + } if err := c.link.init(c); err != nil { c.log.Errorln("Failed to start link interfaces")