This commit is contained in:
xtaci
2016-09-02 23:24:10 +08:00
parent 8ff34859ff
commit b2fb5477f6
2 changed files with 3 additions and 2 deletions
+1 -1
View File
@@ -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
}
+2 -1
View File
@@ -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
}