diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2015-03-19 17:18:16 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-03-19 17:18:16 +0900 |
commit | 9152c24906d712ab1334e22df6d9b48c38cdf665 (patch) | |
tree | 99201b7e5bfb8097fa999b4da701b4182986d79c /server/peer.go | |
parent | 0076c6d4104c1c03715683b11766c69ebfeaee87 (diff) |
table: remove unnecessary distinction of paths
struct Path has a flag which can tell whether the path is withdrawal
path or not. so table.ProcessPaths() needs not to return withdrawal path
and non-withdrawal path separetly.
this removes such unnecessary distinction.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'server/peer.go')
-rw-r--r-- | server/peer.go | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/server/peer.go b/server/peer.go index 2efceeac..c237aff7 100644 --- a/server/peer.go +++ b/server/peer.go @@ -311,18 +311,10 @@ func (peer *Peer) handleREST(restReq *api.RestRequest) { close(restReq.ResponseCh) } -func (peer *Peer) sendUpdateMsgFromPaths(pList []table.Path, wList []table.Path) { - pathList := append([]table.Path(nil), pList...) - pathList = append(pathList, wList...) - - for _, p := range wList { - if !p.IsWithdraw() { - log.Fatal("withdraw pathlist has non withdraw path") - } - } - peer.adjRib.UpdateOut(pathList) +func (peer *Peer) sendUpdateMsgFromPaths(pList []table.Path) { + peer.adjRib.UpdateOut(pList) sendpathList := []table.Path{} - for _, p := range pathList { + for _, p := range pList { if _, ok := peer.rfMap[p.GetRouteFamily()]; ok { sendpathList = append(sendpathList, p) } @@ -333,12 +325,12 @@ func (peer *Peer) sendUpdateMsgFromPaths(pList []table.Path, wList []table.Path) func (peer *Peer) handlePeerMsg(m *peerMsg) { switch m.msgType { case PEER_MSG_PATH: - pList, wList, _ := peer.rib.ProcessPaths(m.msgData.([]table.Path)) - peer.sendUpdateMsgFromPaths(pList, wList) + pList, _ := peer.rib.ProcessPaths(m.msgData.([]table.Path)) + peer.sendUpdateMsgFromPaths(pList) case PEER_MSG_PEER_DOWN: for _, rf := range peer.configuredRFlist() { - pList, wList, _ := peer.rib.DeletePathsforPeer(m.msgData.(*table.PeerInfo), rf) - peer.sendUpdateMsgFromPaths(pList, wList) + pList, _ := peer.rib.DeletePathsforPeer(m.msgData.(*table.PeerInfo), rf) + peer.sendUpdateMsgFromPaths(pList) } } } @@ -356,8 +348,8 @@ func (peer *Peer) handleServerMsg(m *serverMsg) { if _, ok := peer.siblings[d.Address.String()]; ok { delete(peer.siblings, d.Address.String()) for _, rf := range peer.configuredRFlist() { - pList, wList, _ := peer.rib.DeletePathsforPeer(d, rf) - peer.sendUpdateMsgFromPaths(pList, wList) + pList, _ := peer.rib.DeletePathsforPeer(d, rf) + peer.sendUpdateMsgFromPaths(pList) } } else { log.Warning("can not find peer: ", d.Address.String()) |