summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--cmd/gobgpd/main.go5
-rw-r--r--pkg/config/config.go6
2 files changed, 8 insertions, 3 deletions
diff --git a/cmd/gobgpd/main.go b/cmd/gobgpd/main.go
index 5834a406..794d6e10 100644
--- a/cmd/gobgpd/main.go
+++ b/cmd/gobgpd/main.go
@@ -35,7 +35,6 @@ import (
"google.golang.org/grpc/credentials"
api "github.com/osrg/gobgp/api"
- internal_cfg "github.com/osrg/gobgp/internal/pkg/config"
"github.com/osrg/gobgp/internal/pkg/version"
"github.com/osrg/gobgp/pkg/config"
"github.com/osrg/gobgp/pkg/server"
@@ -169,8 +168,8 @@ func main() {
return
}
- configCh := make(chan *internal_cfg.BgpConfigSet)
- go internal_cfg.ReadConfigfileServe(opts.ConfigFile, opts.ConfigType, configCh)
+ configCh := config.ReadConfigFileOnSighup(opts.ConfigFile, opts.ConfigType)
+
loop := func() {
initialConfig := <-configCh
c := config.ApplyInitialConfig(bgpServer, initialConfig, opts.GracefulRestart)
diff --git a/pkg/config/config.go b/pkg/config/config.go
index b369760b..e6ef0d20 100644
--- a/pkg/config/config.go
+++ b/pkg/config/config.go
@@ -17,6 +17,12 @@ func ReadConfigFile(configFile, configType string) (*config.BgpConfigSet, error)
return config.ReadConfigfile(configFile, configType)
}
+func ReadConfigFileOnSighup(configFile, configType string) chan *config.BgpConfigSet {
+ ch := make(chan *config.BgpConfigSet)
+ go config.ReadConfigfileServe(configFile, configType, ch)
+ return ch
+}
+
func marshalRouteTargets(l []string) ([]*any.Any, error) {
rtList := make([]*any.Any, 0, len(l))
for _, rtString := range l {