From b2fb5477f6565e3558fac442bbb51e48ecdfe1fa Mon Sep 17 00:00:00 2001 From: xtaci Date: Fri, 2 Sep 2016 23:24:10 +0800 Subject: [PATCH] fix --- mux.go | 2 +- session.go | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/mux.go b/mux.go index 5bf24f5..dff1a98 100644 --- a/mux.go +++ b/mux.go @@ -51,7 +51,7 @@ func VerifyConfig(config *Config) error { return errors.New("max frame size must not be larger than 65535") } if config.MaxReceiveBuffer <= 0 { - return errors.New("max frame tokens must be positive") + return errors.New("max receive buffer must be positive") } return nil } diff --git a/session.go b/session.go index 09712b7..0ef4b9a 100644 --- a/session.go +++ b/session.go @@ -279,7 +279,8 @@ func (s *Session) keepalive() { case <-tickerPing.C: s.writeFrame(newFrame(cmdNOP, 0)) case <-tickerTimeout.C: - if !atomic.CompareAndSwapInt32(&s.dataReady, 1, 0) { + if !atomic.CompareAndSwapInt32(&s.dataReady, 1, 0) && + int(atomic.LoadInt32(&s.bucket)) == s.config.MaxReceiveBuffer { s.Close() return }