From 53f7e5add711efa58771030443bf3faa9f9e244d Mon Sep 17 00:00:00 2001 From: FUJITA Tomonori Date: Fri, 28 Aug 2015 15:12:20 +0900 Subject: Revert "table: increase the possibiliby of many NLRIs in one update message" This reverts commit 51494759aded7098e151869e66dd5b2c4d96ecfd. gobgpd still sends too more updates rather than Quagga. Revert this. --- table/table_manager.go | 36 +++--------------------------------- 1 file changed, 3 insertions(+), 33 deletions(-) (limited to 'table/table_manager.go') diff --git a/table/table_manager.go b/table/table_manager.go index 6943101c..75b68b03 100644 --- a/table/table_manager.go +++ b/table/table_manager.go @@ -22,7 +22,6 @@ import ( "github.com/osrg/gobgp/packet" "net" "reflect" - "sort" "time" ) @@ -357,45 +356,16 @@ func (manager *TableManager) GetPathList(rf bgp.RouteFamily) []*Path { return paths } -type paths []*Path - -func (p paths) Len() int { - return len(p) -} - -func (p paths) Swap(i, j int) { - p[i], p[j] = p[j], p[i] -} - -func (p paths) Less(i, j int) bool { - l0 := len(p[i].GetPathAttrs()) - l1 := len(p[j].GetPathAttrs()) - if l0 < l1 { - return true - } - if l0 == l1 { - return p[i].GetAsPathLen() < p[j].GetAsPathLen() - } - return false -} - func (manager *TableManager) GetBestPathList(rf bgp.RouteFamily) []*Path { if _, ok := manager.Tables[rf]; !ok { return []*Path{} } destinations := manager.Tables[rf].GetDestinations() - plist := make([]*Path, 0, len(destinations)) - pathsByPeer := make(map[uint32]paths) + paths := make([]*Path, 0, len(destinations)) for _, dest := range destinations { - path := dest.GetBestPath() - key := path.GetSourceAs() - pathsByPeer[key] = append(pathsByPeer[key], path) - } - for _, v := range pathsByPeer { - sort.Sort(v) - plist = append(plist, v...) + paths = append(paths, dest.GetBestPath()) } - return plist + return paths } // process BGPUpdate message -- cgit v1.2.3