summaryrefslogtreecommitdiffhomepage
path: root/table/destination.go
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2017-04-25 13:26:45 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2017-04-27 16:00:54 +0900
commitaa5a11501251da31a542553c0abcb81d5857b924 (patch)
treebb1dca2a3f408211532532d664b36002ca8a8ffd /table/destination.go
parent6faa02f93c91022420bd53631973a96ed5938f2a (diff)
table: avoid cloning path for withdraw
when a peer having lots of routes goes down, the cloning paths consume too much memory. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'table/destination.go')
-rw-r--r--table/destination.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/table/destination.go b/table/destination.go
index 50d779df..2216abca 100644
--- a/table/destination.go
+++ b/table/destination.go
@@ -234,7 +234,7 @@ func (dd *Destination) validatePath(path *Path) {
//
// Modifies destination's state related to stored paths. Removes withdrawn
// paths from known paths. Also, adds new paths to known paths.
-func (dest *Destination) Calculate(ids []string) (map[string]*Path, map[string]*Path, []*Path) {
+func (dest *Destination) Calculate(ids []string, peerDown bool) (map[string]*Path, map[string]*Path, []*Path) {
bestList := make(map[string]*Path, len(ids))
oldList := make(map[string]*Path, len(ids))
oldKnownPathList := dest.knownPathList
@@ -272,6 +272,13 @@ func (dest *Destination) Calculate(ids []string) (map[string]*Path, map[string]*
if old == nil {
return nil, nil
}
+ if peerDown {
+ // withdraws were generated by peer
+ // down so paths are not in knowpath
+ // or adjin.
+ old.IsWithdraw = true
+ return old, old
+ }
return old.Clone(true), old
}
return best, old