diff options
author | Carl Baldwin <carl@ecbaldwin.net> | 2019-07-24 09:01:39 -0600 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@gmail.com> | 2019-08-28 09:06:20 +0900 |
commit | 1bbbc8b3b268932764dac8f50d41125f0e54fc94 (patch) | |
tree | e12a7d803c9142506cd6da1ccc8733c92f96c2b7 | |
parent | 129a00b30d474d28f156b3b8ea2d7371bc52f5ab (diff) |
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.
-rw-r--r-- | cmd/gobgpd/main.go | 8 |
1 files changed, 3 insertions, 5 deletions
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) } } } |