From ed1aef36e72157ae981671baaa2fd54fdbeea7f2 Mon Sep 17 00:00:00 2001 From: Carl Baldwin Date: Wed, 24 Jul 2019 09:02:14 -0600 Subject: Split creation of config reading channel --- cmd/gobgpd/main.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'cmd') 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) -- cgit v1.2.3