From 1bbbc8b3b268932764dac8f50d41125f0e54fc94 Mon Sep 17 00:00:00 2001 From: Carl Baldwin Date: Wed, 24 Jul 2019 09:01:39 -0600 Subject: Improve logic around applying configuration The initial configuration is only applied once right at the very beginning. Everything after that is an update. This makes that clearer. --- cmd/gobgpd/main.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'cmd') diff --git a/cmd/gobgpd/main.go b/cmd/gobgpd/main.go index 0e288461..e8d9df4b 100644 --- a/cmd/gobgpd/main.go +++ b/cmd/gobgpd/main.go @@ -474,6 +474,8 @@ func main() { loop := func() { var c *config.BgpConfigSet + initialConfig := <-configCh + c = applyInitialConfig(bgpServer, initialConfig, opts.GracefulRestart) for { select { case <-sigCh: @@ -483,11 +485,7 @@ func main() { } return case newConfig := <-configCh: - if c == nil { - c = applyInitialConfig(bgpServer, newConfig, opts.GracefulRestart) - } else { - c = updateConfig(bgpServer, c, newConfig) - } + c = updateConfig(bgpServer, c, newConfig) } } } -- cgit v1.2.3