summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2016-04-16 04:44:58 +0000
committerISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2016-04-19 11:12:44 +0000
commit8a71ae649e79b5ca62c1684a81e7c15d9a7b3c16 (patch)
tree14a03ffd985486bb0e5a1bd00512b3a05a0cb98f
parent957e22d05d1a08c57f8d7842c4f3cbbba9b28d88 (diff)
config: use Equal() instead of reflect.DeepEqual()
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
-rw-r--r--config/serve.go6
1 files changed, 2 insertions, 4 deletions
diff --git a/config/serve.go b/config/serve.go
index e88cb74e..72ab1a56 100644
--- a/config/serve.go
+++ b/config/serve.go
@@ -5,7 +5,6 @@ import (
"github.com/spf13/viper"
"os"
"os/signal"
- "reflect"
"syscall"
)
@@ -94,7 +93,7 @@ func UpdateConfig(curC *BgpConfigSet, newC *BgpConfigSet) (*BgpConfigSet, []Neig
if idx := inSlice(n, curC.Neighbors); idx < 0 {
added = append(added, n)
} else {
- if !reflect.DeepEqual(n.ApplyPolicy, curC.Neighbors[idx].ApplyPolicy) {
+ if !n.ApplyPolicy.Equal(&curC.Neighbors[idx].ApplyPolicy) {
updated = append(updated, n)
}
}
@@ -121,8 +120,7 @@ func CheckPolicyDifference(currentPolicy *RoutingPolicy, newPolicy *RoutingPolic
result = false
} else {
if currentPolicy != nil && newPolicy != nil {
- // TODO: reconsider the way of policy object comparison
- result = !reflect.DeepEqual(*currentPolicy, *newPolicy)
+ result = !currentPolicy.Equal(newPolicy)
} else {
result = true
}