diff options
author | Carl Baldwin <carl@ecbaldwin.net> | 2019-07-24 09:02:14 -0600 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@gmail.com> | 2019-08-28 09:06:20 +0900 |
commit | ed1aef36e72157ae981671baaa2fd54fdbeea7f2 (patch) | |
tree | 801aea3e1c44e7f4edb7c857f3c27adc527c55b0 /cmd | |
parent | f9b1f86a0a105d4ee63cc8757115cd62d4a4f84b (diff) |
Split creation of config reading channel
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/gobgpd/main.go | 10 |
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) |