From 4e2d646f89f1fb0667a11fe4c32857d4b1de6e93 Mon Sep 17 00:00:00 2001 From: Carl Baldwin Date: Tue, 30 Jul 2019 16:18:46 -0600 Subject: Replace for and select with single for range --- cmd/gobgpd/main.go | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/cmd/gobgpd/main.go b/cmd/gobgpd/main.go index dc2f4fc0..994e35bc 100644 --- a/cmd/gobgpd/main.go +++ b/cmd/gobgpd/main.go @@ -182,28 +182,25 @@ func main() { }).Info("Finished reading the config file") c := config.ApplyInitialConfig(bgpServer, initialConfig, opts.GracefulRestart) - for { - select { - case sig := <-sigCh: - if sig != syscall.SIGHUP { - stopServer(bgpServer, opts.UseSdNotify) - return - } + for sig := range sigCh { + if sig != syscall.SIGHUP { + stopServer(bgpServer, opts.UseSdNotify) + return + } + log.WithFields(log.Fields{ + "Topic": "Config", + }).Info("Reload the config file") + newConfig, err := config.ReadConfigFile(opts.ConfigFile, opts.ConfigType) + if err != nil { log.WithFields(log.Fields{ "Topic": "Config", - }).Info("Reload the config file") - newConfig, err := config.ReadConfigFile(opts.ConfigFile, opts.ConfigType) - if err != nil { - log.WithFields(log.Fields{ - "Topic": "Config", - "Error": err, - }).Warningf("Can't read config file %s", opts.ConfigFile) - continue - } - - c = config.UpdateConfig(bgpServer, c, newConfig) + "Error": err, + }).Warningf("Can't read config file %s", opts.ConfigFile) + continue } + + c = config.UpdateConfig(bgpServer, c, newConfig) } } -- cgit v1.2.3