summaryrefslogtreecommitdiff
path: root/vendor/golang.org/x/net/http2/writesched_random.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/golang.org/x/net/http2/writesched_random.go')
-rw-r--r--vendor/golang.org/x/net/http2/writesched_random.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/vendor/golang.org/x/net/http2/writesched_random.go b/vendor/golang.org/x/net/http2/writesched_random.go
index 36d7919f1..9a7b9e581 100644
--- a/vendor/golang.org/x/net/http2/writesched_random.go
+++ b/vendor/golang.org/x/net/http2/writesched_random.go
@@ -19,7 +19,8 @@ type randomWriteScheduler struct {
zero writeQueue
// sq contains the stream-specific queues, keyed by stream ID.
- // When a stream is idle or closed, it's deleted from the map.
+ // When a stream is idle, closed, or emptied, it's deleted
+ // from the map.
sq map[uint32]*writeQueue
// pool of empty queues for reuse.
@@ -63,8 +64,12 @@ func (ws *randomWriteScheduler) Pop() (FrameWriteRequest, bool) {
return ws.zero.shift(), true
}
// Iterate over all non-idle streams until finding one that can be consumed.
- for _, q := range ws.sq {
+ for streamID, q := range ws.sq {
if wr, ok := q.consume(math.MaxInt32); ok {
+ if q.empty() {
+ delete(ws.sq, streamID)
+ ws.queuePool.put(q)
+ }
return wr, true
}
}