refactor: simplify fastdp initialisation

This commit is contained in:
Matthias Radestock committed 2016-01-02 13:17:28 +00:00
1 parent 75d9e95b15
commit 13f37edb64
1 file changed
+5 -10
+5 -10
View File
@@ -162,7 +162,7 @@ func main() {
} }
config.ProtocolMinVersion = byte(protocolMinVersion) config.ProtocolMinVersion = byte(protocolMinVersion)
var fastDPOverlay weave.NetworkOverlay overlays := weave.NewOverlaySwitch()
if datapathName != "" { if datapathName != "" {
// A datapath name implies that "Bridge" and "Overlay" // A datapath name implies that "Bridge" and "Overlay"
// packet handling use fast datapath, although other // packet handling use fast datapath, although other
@@ -176,8 +176,11 @@ func main() {
checkFatal(err) checkFatal(err)
networkConfig.Bridge = fastdp.Bridge() 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 != "" { if ifaceName != "" {
// -iface can coexist with -datapath, because // -iface can coexist with -datapath, because
@@ -205,14 +208,6 @@ func main() {
Log.Println("Communication between peers via untrusted networks is encrypted.") 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 routerName == "" {
if iface == nil { if iface == nil {
Log.Fatal("Either an interface must be specified with --iface or a name with -name") Log.Fatal("Either an interface must be specified with --iface or a name with -name")