diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-03-04 16:12:56 -0800 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-03-07 23:05:46 +0900 |
commit | 74c79d99a87ce626cb7fee2e97396daa822a2514 (patch) | |
tree | c3fb951b66a8330069489ccc23f35be0ce24892f /server/fsm.go | |
parent | bbde43608fc23b6739f84a7df8275c23b99e44be (diff) |
server: clean up recvMessageWithError
better way to avoid blocked on channel.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'server/fsm.go')
-rw-r--r-- | server/fsm.go | 5 |
1 files 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 |