summaryrefslogtreecommitdiffhomepage
path: root/cmd
diff options
context:
space:
mode:
authorCarl Baldwin <carl@ecbaldwin.net>2019-07-24 09:01:39 -0600
committerFUJITA Tomonori <fujita.tomonori@gmail.com>2019-08-28 09:06:20 +0900
commit1bbbc8b3b268932764dac8f50d41125f0e54fc94 (patch)
treee12a7d803c9142506cd6da1ccc8733c92f96c2b7 /cmd
parent129a00b30d474d28f156b3b8ea2d7371bc52f5ab (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.
Diffstat (limited to 'cmd')
-rw-r--r--cmd/gobgpd/main.go8
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)
}
}
}