better handling of token bucket notify

This commit is contained in:
xtaci
2019-04-17 22:26:12 +08:00
parent 5eb9306e00
commit 6e0e0d2e80
+5 -2
View File
@@ -152,7 +152,6 @@ func (s *Session) Close() (err error) {
s.streams[k].sessionClose()
}
s.streamLock.Unlock()
s.notifyBucket()
return s.conn.Close()
}
}
@@ -217,7 +216,11 @@ func (s *Session) recvLoop() {
for {
for atomic.LoadInt32(&s.bucket) <= 0 && !s.IsClosed() {
<-s.bucketNotify
select {
case <-s.bucketNotify:
case <-s.die:
return
}
}
// read header first