From 13f37edb64db030ca70704d2eb437383d7abc5e3 Mon Sep 17 00:00:00 2001 From: Matthias Radestock Date: Sat, 2 Jan 2016 12:59:05 +0000 Subject: [PATCH] refactor: simplify fastdp initialisation --- prog/weaver/main.go | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/prog/weaver/main.go b/prog/weaver/main.go index f264198e..68a257aa 100644 --- a/prog/weaver/main.go +++ b/prog/weaver/main.go @@ -162,7 +162,7 @@ func main() { } config.ProtocolMinVersion = byte(protocolMinVersion) - var fastDPOverlay weave.NetworkOverlay + overlays := weave.NewOverlaySwitch() if datapathName != "" { // A datapath name implies that "Bridge" and "Overlay" // packet handling use fast datapath, although other @@ -176,8 +176,11 @@ func main() { checkFatal(err) networkConfig.Bridge = fastdp.Bridge() - fastDPOverlay = fastdp.Overlay() + overlays.Add("fastdp", fastdp.Overlay()) } + sleeve := weave.NewSleeveOverlay(config.Port) + overlays.Add("sleeve", sleeve) + overlays.SetCompatOverlay(sleeve) if ifaceName != "" { // -iface can coexist with -datapath, because @@ -205,14 +208,6 @@ func main() { Log.Println("Communication between peers via untrusted networks is encrypted.") } - overlays := weave.NewOverlaySwitch() - if fastDPOverlay != nil { - overlays.Add("fastdp", fastDPOverlay) - } - sleeve := weave.NewSleeveOverlay(config.Port) - overlays.Add("sleeve", sleeve) - overlays.SetCompatOverlay(sleeve) - if routerName == "" { if iface == nil { Log.Fatal("Either an interface must be specified with --iface or a name with -name")