diff options
author | Carl Baldwin <carl@ecbaldwin.net> | 2019-07-30 16:16:38 -0600 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@gmail.com> | 2019-08-28 09:06:20 +0900 |
commit | ae4e7a0703146539f18021aff635d12ca2d59862 (patch) | |
tree | b9b2f91f8f6847eea25c8dd7af13b3ec556f7501 /cmd/gobgpd/main.go | |
parent | 102a5f79d01bfb0da7cb495b03bd732c39f7090b (diff) |
Remove loop function
Diffstat (limited to 'cmd/gobgpd/main.go')
-rw-r--r-- | cmd/gobgpd/main.go | 58 |
1 files changed, 27 insertions, 31 deletions
diff --git a/cmd/gobgpd/main.go b/cmd/gobgpd/main.go index 1bdcb449..dc2f4fc0 100644 --- a/cmd/gobgpd/main.go +++ b/cmd/gobgpd/main.go @@ -170,45 +170,41 @@ func main() { signal.Notify(sigCh, syscall.SIGHUP) - loop := func() { - initialConfig, err := config.ReadConfigFile(opts.ConfigFile, opts.ConfigType) - if err != nil { - log.WithFields(log.Fields{ - "Topic": "Config", - "Error": err, - }).Fatalf("Can't read config file %s", opts.ConfigFile) - } + initialConfig, err := config.ReadConfigFile(opts.ConfigFile, opts.ConfigType) + if err != nil { log.WithFields(log.Fields{ "Topic": "Config", - }).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 - } + "Error": err, + }).Fatalf("Can't read config file %s", opts.ConfigFile) + } + log.WithFields(log.Fields{ + "Topic": "Config", + }).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 + } + 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) } } - - loop() } func stopServer(bgpServer *server.BgpServer, useSdNotify bool) { |