diff options
author | Carl Baldwin <carl@ecbaldwin.net> | 2019-07-24 09:02:26 -0600 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@gmail.com> | 2019-08-28 09:06:20 +0900 |
commit | 102a5f79d01bfb0da7cb495b03bd732c39f7090b (patch) | |
tree | abd30c124afcabbfc89c94e16ead0522785121ac /internal/pkg/config | |
parent | 5d7bf46000f8cae950e9e0c4d9a7a0295e88c7ac (diff) |
Move ReadConfigFileOnSighup to gobgpd main
Reloading the config file on SIGHUP is behavior specific to gobgpd.
Attempts to expose it through the config API was awkward and could
make the api more confusing to use. This change moves that
functionality up into the gobgpd main and out of the library.
Diffstat (limited to 'internal/pkg/config')
-rw-r--r-- | internal/pkg/config/serve.go | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/internal/pkg/config/serve.go b/internal/pkg/config/serve.go index c1525525..1fe71332 100644 --- a/internal/pkg/config/serve.go +++ b/internal/pkg/config/serve.go @@ -1,10 +1,6 @@ package config import ( - "os" - "os/signal" - "syscall" - log "github.com/sirupsen/logrus" "github.com/spf13/viper" ) @@ -45,44 +41,6 @@ func ReadConfigfile(path, format string) (*BgpConfigSet, error) { return config, nil } -func ReadConfigfileServe(path, format string, configCh chan *BgpConfigSet) { - sigCh := make(chan os.Signal, 1) - signal.Notify(sigCh, syscall.SIGHUP) - - cnt := 0 - for { - c, err := ReadConfigfile(path, format) - if err != nil { - goto ERROR - } - if cnt == 0 { - log.WithFields(log.Fields{ - "Topic": "Config", - }).Info("Finished reading the config file") - } - cnt++ - configCh <- c - goto NEXT - ERROR: - if cnt == 0 { - log.WithFields(log.Fields{ - "Topic": "Config", - "Error": err, - }).Fatalf("Can't read config file %s", path) - } else { - log.WithFields(log.Fields{ - "Topic": "Config", - "Error": err, - }).Warningf("Can't read config file %s", path) - } - NEXT: - <-sigCh - log.WithFields(log.Fields{ - "Topic": "Config", - }).Info("Reload the config file") - } -} - func ConfigSetToRoutingPolicy(c *BgpConfigSet) *RoutingPolicy { return &RoutingPolicy{ DefinedSets: c.DefinedSets, |