From 5856fe44297cb4248356671bc7a7f9c3bf17b699 Mon Sep 17 00:00:00 2001 From: FUJITA Tomonori Date: Mon, 26 Aug 2019 10:26:07 +0900 Subject: table: kill GetPathListByPeer() when a peer is down, use paths in its adj table instead of searching for the global table. Signed-off-by: FUJITA Tomonori --- internal/pkg/table/adj.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'internal/pkg/table/adj.go') diff --git a/internal/pkg/table/adj.go b/internal/pkg/table/adj.go index 95fbf6af..acb2c07b 100644 --- a/internal/pkg/table/adj.go +++ b/internal/pkg/table/adj.go @@ -106,13 +106,18 @@ func (adj *AdjRib) Accepted(rfList []bgp.RouteFamily) int { return count } -func (adj *AdjRib) Drop(rfList []bgp.RouteFamily) { +func (adj *AdjRib) Drop(rfList []bgp.RouteFamily) []*Path { + l := make([]*Path, 0, adj.Count(rfList)) for _, rf := range rfList { if _, ok := adj.table[rf]; ok { + for _, p := range adj.table[rf] { + l = append(l, p.Clone(true)) + } adj.table[rf] = make(map[string]*Path) adj.accepted[rf] = 0 } } + return l } func (adj *AdjRib) DropStale(rfList []bgp.RouteFamily) []*Path { -- cgit v1.2.3