Skip to content

Commit

Permalink
better handling of token bucket notify
Browse files Browse the repository at this point in the history
  • Loading branch information
xtaci committed Apr 17, 2019
1 parent 5eb9306 commit 6e0e0d2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions session.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ func (s *Session) Close() (err error) {
s.streams[k].sessionClose()
}
s.streamLock.Unlock()
s.notifyBucket()
return s.conn.Close()
}
}
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 6e0e0d2

Please sign in to comment.