From 8a71ae649e79b5ca62c1684a81e7c15d9a7b3c16 Mon Sep 17 00:00:00 2001 From: ISHIDA Wataru Date: Sat, 16 Apr 2016 04:44:58 +0000 Subject: config: use Equal() instead of reflect.DeepEqual() Signed-off-by: ISHIDA Wataru --- config/serve.go | 6 ++---- 1 file 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 } -- cgit v1.2.3