From ae88f8856834898d876a10fa7aa51dbaba466a2c Mon Sep 17 00:00:00 2001 From: ISHIDA Wataru Date: Tue, 26 Apr 2016 15:26:28 +0000 Subject: [PATCH] table: flag IsWithdraw down after use paths in Destination.knownPathList are referenced by peer's adj-rib-in when there was no policy modification applied to avoid unnecessary copy. Here in Destination.explicitWithdraw(), we are using Path.IsWithdraw as a flag to signify which path stays in knownPathList and which not. Since the paths are referenced by peer's adj-rib-in, we must flag this down after use. Signed-off-by: ISHIDA Wataru --- table/destination.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/table/destination.go b/table/destination.go index 0e195f83..7cca1b37 100644 --- a/table/destination.go +++ b/table/destination.go @@ -316,8 +316,12 @@ func (dest *Destination) explicitWithdraw() paths { // We have a match if the source are same. if path.GetSource().Equal(withdraw.GetSource()) { isFound = true + // this path is referenced in peer's adj-rib-in + // when there was no policy modification applied. + // we sould flag IsWithdraw down after use to avoid + // a path with IsWithdraw flag exists in adj-rib-in path.IsWithdraw = true - matches = append(matches, path) + matches = append(matches, withdraw) } } @@ -335,6 +339,8 @@ func (dest *Destination) explicitWithdraw() paths { if !path.IsWithdraw { newKnownPaths = append(newKnownPaths, path) } + // here we flag IsWithdraw down + path.IsWithdraw = false } dest.knownPathList = newKnownPaths