diff options
author | Carl Baldwin <carl@ecbaldwin.net> | 2019-07-30 16:18:46 -0600 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@gmail.com> | 2019-08-28 09:06:20 +0900 |
commit | 4e2d646f89f1fb0667a11fe4c32857d4b1de6e93 (patch) | |
tree | da9ffaa17c00091726675e65dffa415a6bf917f6 /cmd | |
parent | ae4e7a0703146539f18021aff635d12ca2d59862 (diff) |
Replace for and select with single for range
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/gobgpd/main.go | 33 |
1 files 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) } } |