summaryrefslogtreecommitdiffhomepage
path: root/table/table_manager.go
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2016-11-09 21:11:03 -0800
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2016-11-12 21:21:54 -0800
commit0ef26666ef8e920d3fa0a4ebb9c3c8fea4e6cb36 (patch)
tree8cf03170029be413806a6ef3d73c5eae9ac68ccc /table/table_manager.go
parent6d52e8c1e5d4de4dfea37656b50c71579343b5f7 (diff)
table: use old best path instead of withdrawn paths
Preparation for removing in-memory adj-out. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'table/table_manager.go')
-rw-r--r--table/table_manager.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/table/table_manager.go b/table/table_manager.go
index 4b52e745..ae00d3ce 100644
--- a/table/table_manager.go
+++ b/table/table_manager.go
@@ -185,9 +185,9 @@ func (manager *TableManager) DeleteVrf(name string) ([]*Path, error) {
return msgs, nil
}
-func (manager *TableManager) calculate(ids []string, destinations []*Destination) (map[string][]*Path, []*Path, [][]*Path) {
- withdrawn := make([]*Path, 0, len(destinations))
+func (manager *TableManager) calculate(ids []string, destinations []*Destination) (map[string][]*Path, map[string][]*Path, [][]*Path) {
best := make(map[string][]*Path, len(ids))
+ old := make(map[string][]*Path, len(ids))
emptyDsts := make([]*Destination, 0, len(destinations))
var multi [][]*Path
@@ -200,11 +200,11 @@ func (manager *TableManager) calculate(ids []string, destinations []*Destination
"Topic": "table",
"Key": dst.GetNlri().String(),
}).Debug("Processing destination")
- paths, w, m := dst.Calculate(ids)
+ paths, olds, m := dst.Calculate(ids)
for id, path := range paths {
best[id] = append(best[id], path)
+ old[id] = append(old[id], olds[id])
}
- withdrawn = append(withdrawn, w...)
if m != nil {
multi = append(multi, m)
}
@@ -218,10 +218,10 @@ func (manager *TableManager) calculate(ids []string, destinations []*Destination
t := manager.Tables[dst.Family()]
t.deleteDest(dst)
}
- return best, withdrawn, multi
+ return best, old, multi
}
-func (manager *TableManager) DeletePathsByPeer(ids []string, info *PeerInfo, rf bgp.RouteFamily) (map[string][]*Path, []*Path, [][]*Path) {
+func (manager *TableManager) DeletePathsByPeer(ids []string, info *PeerInfo, rf bgp.RouteFamily) (map[string][]*Path, map[string][]*Path, [][]*Path) {
if t, ok := manager.Tables[rf]; ok {
dsts := t.DeleteDestByPeer(info)
return manager.calculate(ids, dsts)
@@ -229,7 +229,7 @@ func (manager *TableManager) DeletePathsByPeer(ids []string, info *PeerInfo, rf
return nil, nil, nil
}
-func (manager *TableManager) ProcessPaths(ids []string, pathList []*Path) (map[string][]*Path, []*Path, [][]*Path) {
+func (manager *TableManager) ProcessPaths(ids []string, pathList []*Path) (map[string][]*Path, map[string][]*Path, [][]*Path) {
m := make(map[string]bool, len(pathList))
dsts := make([]*Destination, 0, len(pathList))
for _, path := range pathList {