From 74c79d99a87ce626cb7fee2e97396daa822a2514 Mon Sep 17 00:00:00 2001 From: FUJITA Tomonori Date: Fri, 4 Mar 2016 16:12:56 -0800 Subject: [PATCH] server: clean up recvMessageWithError better way to avoid blocked on channel. Signed-off-by: FUJITA Tomonori --- server/fsm.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server/fsm.go b/server/fsm.go index 0e5e7e90..01fc01c4 100644 --- a/server/fsm.go +++ b/server/fsm.go @@ -645,8 +645,9 @@ func (h *FSMHandler) recvMessageWithError() (*FsmMsg, error) { // if the lenght of h.holdTimerResetCh // isn't zero, the timer will be reset // soon anyway. - if len(h.holdTimerResetCh) == 0 { - h.holdTimerResetCh <- true + select { + case h.holdTimerResetCh <- true: + default: } if m.Header.Type == bgp.BGP_MSG_KEEPALIVE { return nil, nil