Skip to content

Commit

Permalink
quic: handle streams moving from the data queue to the meta queue
Browse files Browse the repository at this point in the history
In Conn.appendStreamFrames, a stream can be moved from the
data queue (for streams with only flow-controlled frames to send)
to the metadata queue (for streams with non-flow-controlled frames
to send) if some other goroutine asynchronously modifies the
stream state.

Adjust the check at the end of this function to clear the needSend
bool only if queueMeta and queueData are both empty, to avoid
losing track of the need to send frames when this happens.

For golang/go#58547

Change-Id: Ib9ad3b01f543cd7673f5233ceb58b2db9adfff5a
Reviewed-on: https://go-review.googlesource.com/c/net/+/531656
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
  • Loading branch information
neild committed Oct 4, 2023
1 parent 350aad2 commit 5d5a036
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion internal/quic/conn_streams.go
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,9 @@ func (c *Conn) appendStreamFrames(w *packetWriter, pnum packetNumber, pto bool)
state = s.state.set(0, streamQueueData)
c.queueStreamForSendLocked(s, state)
}
c.streams.needSend.Store(c.streams.queueData.head != nil)
if c.streams.queueMeta.head == nil && c.streams.queueData.head == nil {
c.streams.needSend.Store(false)
}
return true
}

Expand Down

0 comments on commit 5d5a036

Please sign in to comment.