From 94ed82255d6d7cc9d5c7aee9f9c71837bfd2e907 Mon Sep 17 00:00:00 2001 From: FUJITA Tomonori Date: Thu, 22 Jan 2015 16:44:02 +0900 Subject: peer: fix commit a9e55d3bd75fd5dd633fee1ff2c9d45d6d6447ee reggression After became 'establish' state, we have to send update messages to the outstanding channel in _NEW_ fsm. Signed-off-by: FUJITA Tomonori --- server/peer.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/server/peer.go b/server/peer.go index 73aab7e6..3e264fbb 100644 --- a/server/peer.go +++ b/server/peer.go @@ -282,6 +282,13 @@ func (peer *Peer) loop() error { peer.outgoing = make(chan *bgp.BGPMessage, FSM_CHANNEL_LENGTH) h := NewFSMHandler(peer.fsm, incoming, peer.outgoing) + if peer.peerConfig.BgpNeighborCommonState.State == uint32(bgp.BGP_FSM_ESTABLISHED) { + pathList := peer.adjRib.GetOutPathList(peer.rf) + peer.sendMessages(table.CreateUpdateMsgFromPaths(pathList)) + peer.fsm.peerConfig.BgpNeighborCommonState.Uptime = time.Now() + peer.fsm.peerConfig.BgpNeighborCommonState.EstablishedCount++ + } + sameState := true for sameState { select { @@ -303,12 +310,6 @@ func (peer *Peer) loop() error { peer.peerConfig.BgpNeighborCommonState.State = uint32(nextState) peer.fsm.StateChange(nextState) sameState = false - if nextState == bgp.BGP_FSM_ESTABLISHED { - pathList := peer.adjRib.GetOutPathList(peer.rf) - peer.sendMessages(table.CreateUpdateMsgFromPaths(pathList)) - peer.fsm.peerConfig.BgpNeighborCommonState.Uptime = time.Now() - peer.fsm.peerConfig.BgpNeighborCommonState.EstablishedCount++ - } if oldState == bgp.BGP_FSM_ESTABLISHED { t := time.Now() peer.fsm.peerConfig.BgpNeighborCommonState.Downtime = t -- cgit v1.2.3