From 02863c581d653fd4bedcfd0da991e27943c95149 Mon Sep 17 00:00:00 2001 From: Carl Baldwin Date: Wed, 24 Jul 2019 09:01:23 -0600 Subject: Move assignement of current config to the end Now that `c` is no longer referenced in the block above, its assignement can be moved to later. This allows consolidating the two assignements into one and moving them to the very end to magic the logic clearer. --- cmd/gobgpd/main.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'cmd/gobgpd') diff --git a/cmd/gobgpd/main.go b/cmd/gobgpd/main.go index 569c2daa..8abcc072 100644 --- a/cmd/gobgpd/main.go +++ b/cmd/gobgpd/main.go @@ -236,7 +236,6 @@ func main() { var updatePolicy bool if c == nil { - c = newConfig if err := bgpServer.StartBgp(context.Background(), &api.StartBgpRequest{ Global: config.NewGlobalFromConfigStruct(&newConfig.Global), }); err != nil { @@ -372,7 +371,6 @@ func main() { assignGlobalpolicy(bgpServer, &newConfig.Global.ApplyPolicy.Config) updatePolicy = true } - c = newConfig } for _, pg := range addedPg { log.Infof("PeerGroup %s is added", pg.Config.PeerGroupName) @@ -447,6 +445,7 @@ func main() { log.Warn(err) } } + c = newConfig } } } -- cgit v1.2.3