Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use struct{} instead of bool in window update queue #2555

Merged
merged 1 commit into from May 22, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions window_update_queue.go
Expand Up @@ -11,8 +11,8 @@ import (
type windowUpdateQueue struct {
mutex sync.Mutex

queue map[protocol.StreamID]bool // used as a set
queuedConn bool // connection-level window update
queue map[protocol.StreamID]struct{} // used as a set
queuedConn bool // connection-level window update

streamGetter streamGetter
connFlowController flowcontrol.ConnectionFlowController
Expand All @@ -25,7 +25,7 @@ func newWindowUpdateQueue(
cb func(wire.Frame),
) *windowUpdateQueue {
return &windowUpdateQueue{
queue: make(map[protocol.StreamID]bool),
queue: make(map[protocol.StreamID]struct{}),
streamGetter: streamGetter,
connFlowController: connFC,
callback: cb,
Expand All @@ -34,7 +34,7 @@ func newWindowUpdateQueue(

func (q *windowUpdateQueue) AddStream(id protocol.StreamID) {
q.mutex.Lock()
q.queue[id] = true
q.queue[id] = struct{}{}
q.mutex.Unlock()
}

Expand Down