server: clean up recvMessageWithError

better way to avoid blocked on channel.

Signed-off-by: FUJITA Tomonori <[email protected]>
This commit is contained in:
FUJITA Tomonori
2016-03-07 23:05:46 +09:00
parent bbde43608f
commit 74c79d99a8
+3 -2
View File
@@ -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