Skip to content

Commit d1b0a97

Browse files
committed
quic: avoid sending 1-RTT frames in initial/handshake packets
Restructure the send path a little to make it clear that 1-RTT frames go in 1-RTT packets. For golang/go#58547 Change-Id: Id4c2c86c8ccd350bf490f38a8bb01ad9bc2639ee Reviewed-on: https://go-review.googlesource.com/c/net/+/524035 Reviewed-by: Jonathan Amsterdam <jba@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
1 parent 4332436 commit d1b0a97

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

internal/quic/conn_send.go

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -224,28 +224,13 @@ func (c *Conn) appendFrames(now time.Time, space numberSpace, pnum packetNumber,
224224

225225
// TODO: Add all the other frames we can send.
226226

227-
// HANDSHAKE_DONE
228-
if c.handshakeConfirmed.shouldSendPTO(pto) {
229-
if !c.w.appendHandshakeDoneFrame() {
230-
return
231-
}
232-
c.handshakeConfirmed.setSent(pnum)
233-
}
234-
235227
// CRYPTO
236228
c.crypto[space].dataToSend(pto, func(off, size int64) int64 {
237229
b, _ := c.w.appendCryptoFrame(off, int(size))
238230
c.crypto[space].sendData(off, b)
239231
return int64(len(b))
240232
})
241233

242-
// NEW_CONNECTION_ID, RETIRE_CONNECTION_ID
243-
if space == appDataSpace {
244-
if !c.connIDState.appendFrames(&c.w, pnum, pto) {
245-
return
246-
}
247-
}
248-
249234
// Test-only PING frames.
250235
if space == c.testSendPingSpace && c.testSendPing.shouldSendPTO(pto) {
251236
if !c.w.appendPingFrame() {
@@ -254,11 +239,26 @@ func (c *Conn) appendFrames(now time.Time, space numberSpace, pnum packetNumber,
254239
c.testSendPing.setSent(pnum)
255240
}
256241

257-
// All stream-related frames. This should come last in the packet,
258-
// so large amounts of STREAM data don't crowd out other frames
259-
// we may need to send.
260-
if !c.appendStreamFrames(&c.w, pnum, pto) {
261-
return
242+
if space == appDataSpace {
243+
// HANDSHAKE_DONE
244+
if c.handshakeConfirmed.shouldSendPTO(pto) {
245+
if !c.w.appendHandshakeDoneFrame() {
246+
return
247+
}
248+
c.handshakeConfirmed.setSent(pnum)
249+
}
250+
251+
// NEW_CONNECTION_ID, RETIRE_CONNECTION_ID
252+
if !c.connIDState.appendFrames(&c.w, pnum, pto) {
253+
return
254+
}
255+
256+
// All stream-related frames. This should come last in the packet,
257+
// so large amounts of STREAM data don't crowd out other frames
258+
// we may need to send.
259+
if !c.appendStreamFrames(&c.w, pnum, pto) {
260+
return
261+
}
262262
}
263263

264264
// If this is a PTO probe and we haven't added an ack-eliciting frame yet,

0 commit comments

Comments
 (0)