From 1a96b48b49bb1d38b36aad1c6532e9228c6b27b2 Mon Sep 17 00:00:00 2001 From: FUJITA Tomonori Date: Tue, 27 Jan 2015 18:39:22 +0900 Subject: cli: show the duration since state changed Signed-off-by: FUJITA Tomonori --- server/peer.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'server') diff --git a/server/peer.go b/server/peer.go index bc8bb10c..51893421 100644 --- a/server/peer.go +++ b/server/peer.go @@ -300,6 +300,8 @@ func (peer *Peer) loop() error { peer.sendMessages(table.CreateUpdateMsgFromPaths(pathList)) peer.fsm.peerConfig.BgpNeighborCommonState.Uptime = time.Now() peer.fsm.peerConfig.BgpNeighborCommonState.EstablishedCount++ + } else { + peer.fsm.peerConfig.BgpNeighborCommonState.Downtime = time.Now() } sameState := true @@ -325,7 +327,6 @@ func (peer *Peer) loop() error { sameState = false if oldState == bgp.BGP_FSM_ESTABLISHED { t := time.Now() - peer.fsm.peerConfig.BgpNeighborCommonState.Downtime = t if t.Sub(peer.fsm.peerConfig.BgpNeighborCommonState.Uptime) < FLOP_THRESHOLD { peer.fsm.peerConfig.BgpNeighborCommonState.Flops++ } -- cgit v1.2.3