summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--config/serve.go19
1 files changed, 12 insertions, 7 deletions
diff --git a/config/serve.go b/config/serve.go
index a3beea30..d1f88788 100644
--- a/config/serve.go
+++ b/config/serve.go
@@ -12,24 +12,29 @@ type BgpConfigSet struct {
}
func ReadConfigfileServe(path string, configCh chan BgpConfigSet, reloadCh chan bool) {
+ cnt := 0
for {
<-reloadCh
b := Bgp{}
+ p := RoutingPolicy{}
md, err := toml.DecodeFile(path, &b)
if err == nil {
err = SetDefaultConfigValues(md, &b)
- }
- if err != nil {
- log.Fatal("can't read config file ", path, ", ", err)
+ if err == nil {
+ _, err = toml.DecodeFile(path, &p)
+ }
}
- p := RoutingPolicy{}
- md, err = toml.DecodeFile(path, &p)
if err != nil {
- log.Fatal("can't read config file ", path, ", ", err)
+ if cnt == 0 {
+ log.Fatal("can't read config file ", path, ", ", err)
+ } else {
+ log.Warning("can't read config file ", path, ", ", err)
+ continue
+ }
}
-
+ cnt++
bgpConfig := BgpConfigSet{Bgp: b, Policy: p}
configCh <- bgpConfig
}