Don't crash if Yggdrasil is started with no router adapter

This commit is contained in:
Neil Alexander 2019-03-29 08:38:09 +00:00
parent dd05a7f2a8
commit a830521078
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
3 changed files with 14 additions and 8 deletions

View file

@ -248,10 +248,10 @@ func main() {
// Setup the Yggdrasil node itself. The node{} type includes a Core, so we
// don't need to create this manually.
n := node{}
// Now that we have a working configuration, we can now actually start
// Yggdrasil. This will start the router, switch, DHT node, TCP and UDP
// sockets, TUN/TAP adapter and multicast discovery port.
// Before we start the node, set the TUN/TAP to be our router adapter
n.core.SetRouterAdapter(&n.tuntap)
// Now start Yggdrasil - this starts the DHT, router, switch and other core
// components needed for Yggdrasil to operate
state, err := n.core.Start(cfg, logger)
if err != nil {
logger.Errorln("An error occurred during startup")