summaryrefslogtreecommitdiffhomepage
path: root/cmd
diff options
context:
space:
mode:
authorCarl Baldwin <carl@ecbaldwin.net>2019-07-24 09:02:14 -0600
committerFUJITA Tomonori <fujita.tomonori@gmail.com>2019-08-28 09:06:20 +0900
commited1aef36e72157ae981671baaa2fd54fdbeea7f2 (patch)
tree801aea3e1c44e7f4edb7c857f3c27adc527c55b0 /cmd
parentf9b1f86a0a105d4ee63cc8757115cd62d4a4f84b (diff)
Split creation of config reading channel
Diffstat (limited to 'cmd')
-rw-r--r--cmd/gobgpd/main.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/cmd/gobgpd/main.go b/cmd/gobgpd/main.go
index ab42e71b..68ea0cac 100644
--- a/cmd/gobgpd/main.go
+++ b/cmd/gobgpd/main.go
@@ -122,8 +122,8 @@ func main() {
log.SetFormatter(&log.JSONFormatter{})
}
- configCh := make(chan *internal_cfg.BgpConfigSet)
if opts.Dry {
+ configCh := make(chan *internal_cfg.BgpConfigSet)
go internal_cfg.ReadConfigfileServe(opts.ConfigFile, opts.ConfigType, configCh)
c := <-configCh
if opts.LogLevel == "debug" {
@@ -156,10 +156,14 @@ func main() {
}
}
- if opts.ConfigFile != "" {
- go internal_cfg.ReadConfigfileServe(opts.ConfigFile, opts.ConfigType, configCh)
+ if opts.ConfigFile == "" {
+ <-sigCh
+ stopServer(bgpServer, opts.UseSdNotify)
+ return
}
+ configCh := make(chan *internal_cfg.BgpConfigSet)
+ go internal_cfg.ReadConfigfileServe(opts.ConfigFile, opts.ConfigType, configCh)
loop := func() {
initialConfig := <-configCh
c := config.ApplyInitialConfig(bgpServer, initialConfig, opts.GracefulRestart)