summaryrefslogtreecommitdiffhomepage
path: root/table/table.go
diff options
context:
space:
mode:
authorNaoto Hanaue <hanaue.naoto@po.ntts.co.jp>2016-03-24 21:06:13 +0900
committerNaoto Hanaue <hanaue.naoto@po.ntts.co.jp>2016-03-25 16:11:31 +0900
commite9b32cb56e78c77e368f751db39f89ae1a5ffcb1 (patch)
treef09affbccc0447106e7bdf8205942586152e0a4e /table/table.go
parent506d03c92f4c0918673390cb4cd24e181e3a3f6a (diff)
table: initialize the destinations when the destinations is empty
In the current implementation, the destinations map management area in the table has not been initialized even if destinations removed all. Therefore, to explicitly initialize the destinations.
Diffstat (limited to 'table/table.go')
-rw-r--r--table/table.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/table/table.go b/table/table.go
index ecc067b4..5c19c2e4 100644
--- a/table/table.go
+++ b/table/table.go
@@ -122,6 +122,9 @@ func (t *Table) deleteDestByNlri(nlri bgp.AddrPrefixInterface) *Destination {
dest := destinations[t.tableKey(nlri)]
if dest != nil {
delete(destinations, t.tableKey(nlri))
+ if len(destinations) == 0 {
+ t.destinations = make(map[string]*Destination)
+ }
}
return dest
}
@@ -129,6 +132,9 @@ func (t *Table) deleteDestByNlri(nlri bgp.AddrPrefixInterface) *Destination {
func (t *Table) deleteDest(dest *Destination) {
destinations := t.GetDestinations()
delete(destinations, t.tableKey(dest.GetNlri()))
+ if len(destinations) == 0 {
+ t.destinations = make(map[string]*Destination)
+ }
}
func (t *Table) validatePath(path *Path) {