From cc267fad9e6410705420af220d73d25d288e8a58 Mon Sep 17 00:00:00 2001 From: Carl Baldwin Date: Fri, 26 Apr 2019 16:14:56 -0600 Subject: Consolidate duplicate code blocks both updating peer groups There were only two differences: 1) the first block updates `updatePolicy` and 2) the log statements are a little bit different (`pg.State` vs `pg.Config` and `%v` vs `%s`). To be consistent with the other blocks above it, changed to use `pg.Config` rather than `pg.State`. --- cmd/gobgpd/main.go | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'cmd/gobgpd') diff --git a/cmd/gobgpd/main.go b/cmd/gobgpd/main.go index 06b38b88..546b4e47 100644 --- a/cmd/gobgpd/main.go +++ b/cmd/gobgpd/main.go @@ -391,7 +391,7 @@ func main() { } } for _, pg := range updatedPg { - log.Infof("PeerGroup %v is updated", pg.State.PeerGroupName) + log.Infof("PeerGroup %s is updated", pg.Config.PeerGroupName) if u, err := bgpServer.UpdatePeerGroup(context.Background(), &api.UpdatePeerGroupRequest{ PeerGroup: config.NewPeerGroupFromConfigStruct(&pg), }); err != nil { @@ -400,14 +400,6 @@ func main() { updatePolicy = updatePolicy || u.NeedsSoftResetIn } } - for _, pg := range updatedPg { - log.Infof("PeerGroup %s is updated", pg.Config.PeerGroupName) - if _, err := bgpServer.UpdatePeerGroup(context.Background(), &api.UpdatePeerGroupRequest{ - PeerGroup: config.NewPeerGroupFromConfigStruct(&pg), - }); err != nil { - log.Warn(err) - } - } for _, dn := range newConfig.DynamicNeighbors { log.Infof("Dynamic Neighbor %s is added to PeerGroup %s", dn.Config.Prefix, dn.Config.PeerGroup) if err := bgpServer.AddDynamicNeighbor(context.Background(), &api.AddDynamicNeighborRequest{ -- cgit v1.2.3