diff --git a/session.go b/session.go index ca98e16..d9d7cae 100644 --- a/session.go +++ b/session.go @@ -392,8 +392,12 @@ func (s *Session) keepalive() { s.notifyBucket() // force a signal to the recvLoop case <-tickerTimeout.C: if !atomic.CompareAndSwapInt32(&s.dataReady, 1, 0) { - s.Close() - return + // recvLoop main block on bucket == 0, in this case, + // session should not be closed. + if atomic.LoadInt32(&s.bucket) > 0 { + s.Close() + return + } } case <-s.die: return