From ca832f94bbb1c8e0cecfd7118366a48159512e23 Mon Sep 17 00:00:00 2001 From: FUJITA Tomonori Date: Tue, 9 Jun 2015 21:20:07 +0900 Subject: server: kill peerMsg Peers send and receive messages via channels, which could lead to a deadlock. With this patch, multiple goroutines are used for network I/Os per peer but one goroutine handle all ribs (including the global rib). So there is no messages via channels between peers. Signed-off-by: FUJITA Tomonori --- table/table_manager.go | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'table/table_manager.go') diff --git a/table/table_manager.go b/table/table_manager.go index 3d52fce7..eb4a20bf 100644 --- a/table/table_manager.go +++ b/table/table_manager.go @@ -139,6 +139,10 @@ func NewTableManager(owner string, rfList []bgp.RouteFamily) *TableManager { return t } +func (manager *TableManager) OwnerName() string { + return manager.owner +} + func (manager *TableManager) calculate(destinationList []Destination) ([]Path, error) { newPaths := make([]Path, 0) @@ -159,7 +163,7 @@ func (manager *TableManager) calculate(destinationList []Destination) ([]Path, e } destination.setBestPathReason(reason) - currentBestPath := destination.getBestPath() + currentBestPath := destination.GetBestPath() if newBestPath != nil && currentBestPath == newBestPath { // best path is not changed @@ -192,7 +196,7 @@ func (manager *TableManager) calculate(destinationList []Destination) ([]Path, e "next_hop": currentBestPath.GetNexthop().String(), }).Debug("best path is lost") - p := destination.getBestPath() + p := destination.GetBestPath() newPaths = append(newPaths, p.Clone(true)) } destination.setBestPath(nil) @@ -218,7 +222,7 @@ func (manager *TableManager) calculate(destinationList []Destination) ([]Path, e destination.setBestPath(newBestPath) } - if len(destination.getKnownPathList()) == 0 && destination.getBestPath() == nil { + if len(destination.getKnownPathList()) == 0 && destination.GetBestPath() == nil { rf := destination.getRouteFamily() t := manager.Tables[rf] deleteDest(t, destination) @@ -259,7 +263,7 @@ func (manager *TableManager) GetPathList(rf bgp.RouteFamily) []Path { } var paths []Path for _, dest := range manager.Tables[rf].GetDestinations() { - paths = append(paths, dest.getBestPath()) + paths = append(paths, dest.GetBestPath()) } return paths } @@ -360,10 +364,11 @@ func (adj *AdjRib) GetOutCount(rf bgp.RouteFamily) int { return len(adj.adjRibOut[rf]) } -func (adj *AdjRib) DropAllIn(rf bgp.RouteFamily) { +func (adj *AdjRib) DropAll(rf bgp.RouteFamily) { if _, ok := adj.adjRibIn[rf]; ok { // replace old one adj.adjRibIn[rf] = make(map[string]*ReceivedRoute) + adj.adjRibOut[rf] = make(map[string]*ReceivedRoute) } } -- cgit v1.2.3