Merge pull request #672 from Arceliar/bugfix

check if an error was returned by Core._init and return it if so
This commit is contained in:
Neil Alexander 2020-04-01 08:48:16 +01:00 committed by GitHub
commit 52491d63ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -12,9 +12,9 @@ import (
"net" "net"
"os" "os"
"github.com/cheggaaa/pb/v3"
"github.com/yggdrasil-network/yggdrasil-go/src/address" "github.com/yggdrasil-network/yggdrasil-go/src/address"
"github.com/yggdrasil-network/yggdrasil-go/src/crypto" "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") var numHosts = flag.Int("hosts", 1, "number of host vars to generate")
@ -30,7 +30,7 @@ type keySet struct {
func main() { func main() {
flag.Parse() flag.Parse()
bar := pb.StartNew(*keyTries * 2 + *numHosts) bar := pb.StartNew(*keyTries*2 + *numHosts)
if *numHosts > *keyTries { if *numHosts > *keyTries {
println("Can't generate less keys than hosts.") println("Can't generate less keys than hosts.")

View File

@ -160,7 +160,10 @@ func (c *Core) _start(nc *config.NodeConfig, log *log.Logger) (*config.NodeState
} }
c.log.Infoln("Starting up...") 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 { if err := c.link.init(c); err != nil {
c.log.Errorln("Failed to start link interfaces") c.log.Errorln("Failed to start link interfaces")