mirror of
https://github.com/xtaci/smux.git
synced 2024-04-21 10:51:48 +00:00
fix a potential unexpected closing while bucket has exhausted
This commit is contained in:
+6
-2
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user