diff --git a/internal/wire/transport_parameter_test.go b/internal/wire/transport_parameter_test.go index c52ec712..5f7583c4 100644 --- a/internal/wire/transport_parameter_test.go +++ b/internal/wire/transport_parameter_test.go @@ -107,7 +107,7 @@ var _ = Describe("Transport Parameters", func() { It("errors when the max_packet_size is too small", func() { b := &bytes.Buffer{} - utils.WriteVarInt(b, uint64(maxPacketSizeParameterID)) + utils.WriteVarInt(b, uint64(maxUDPPayloadSizeParameterID)) utils.WriteVarInt(b, uint64(utils.VarIntLen(1199))) utils.WriteVarInt(b, 1199) p := &TransportParameters{} diff --git a/internal/wire/transport_parameters.go b/internal/wire/transport_parameters.go index 782890c2..318347b7 100644 --- a/internal/wire/transport_parameters.go +++ b/internal/wire/transport_parameters.go @@ -28,7 +28,7 @@ const ( originalConnectionIDParameterID transportParameterID = 0x0 maxIdleTimeoutParameterID transportParameterID = 0x1 statelessResetTokenParameterID transportParameterID = 0x2 - maxPacketSizeParameterID transportParameterID = 0x3 + maxUDPPayloadSizeParameterID transportParameterID = 0x3 initialMaxDataParameterID transportParameterID = 0x4 initialMaxStreamDataBidiLocalParameterID transportParameterID = 0x5 initialMaxStreamDataBidiRemoteParameterID transportParameterID = 0x6 @@ -64,7 +64,7 @@ type TransportParameters struct { DisableActiveMigration bool - MaxPacketSize protocol.ByteCount + MaxUDPPayloadSize protocol.ByteCount MaxUniStreamNum protocol.StreamNum MaxBidiStreamNum protocol.StreamNum @@ -123,7 +123,7 @@ func (p *TransportParameters) unmarshal(data []byte, sentBy protocol.Perspective initialMaxStreamsBidiParameterID, initialMaxStreamsUniParameterID, maxIdleTimeoutParameterID, - maxPacketSizeParameterID, + maxUDPPayloadSizeParameterID, activeConnectionIDLimitParameterID: if err := p.readNumericTransportParameter(r, paramID, int(paramLen)); err != nil { return err @@ -172,8 +172,8 @@ func (p *TransportParameters) unmarshal(data []byte, sentBy protocol.Perspective if !readMaxAckDelay { p.MaxAckDelay = protocol.DefaultMaxAckDelay } - if p.MaxPacketSize == 0 { - p.MaxPacketSize = protocol.MaxByteCount + if p.MaxUDPPayloadSize == 0 { + p.MaxUDPPayloadSize = protocol.MaxByteCount } // check that every transport parameter was sent at most once @@ -257,11 +257,11 @@ func (p *TransportParameters) readNumericTransportParameter( p.MaxUniStreamNum = protocol.StreamNum(val) case maxIdleTimeoutParameterID: p.MaxIdleTimeout = utils.MaxDuration(protocol.MinRemoteIdleTimeout, time.Duration(val)*time.Millisecond) - case maxPacketSizeParameterID: + case maxUDPPayloadSizeParameterID: if val < 1200 { return fmt.Errorf("invalid value for max_packet_size: %d (minimum 1200)", val) } - p.MaxPacketSize = protocol.ByteCount(val) + p.MaxUDPPayloadSize = protocol.ByteCount(val) case ackDelayExponentParameterID: if val > protocol.MaxAckDelayExponent { return fmt.Errorf("invalid value for ack_delay_exponent: %d (maximum %d)", val, protocol.MaxAckDelayExponent) @@ -311,7 +311,7 @@ func (p *TransportParameters) Marshal() []byte { // idle_timeout p.marshalVarintParam(b, maxIdleTimeoutParameterID, uint64(p.MaxIdleTimeout/time.Millisecond)) // max_packet_size - p.marshalVarintParam(b, maxPacketSizeParameterID, uint64(protocol.MaxReceivePacketSize)) + p.marshalVarintParam(b, maxUDPPayloadSizeParameterID, uint64(protocol.MaxReceivePacketSize)) // max_ack_delay // Only send it if is different from the default value. if p.MaxAckDelay != protocol.DefaultMaxAckDelay { diff --git a/packet_packer.go b/packet_packer.go index 1ac9dd5d..debb3a77 100644 --- a/packet_packer.go +++ b/packet_packer.go @@ -739,7 +739,7 @@ func (p *packetPacker) SetToken(token []byte) { } func (p *packetPacker) HandleTransportParameters(params *wire.TransportParameters) { - if params.MaxPacketSize != 0 { - p.maxPacketSize = utils.MinByteCount(p.maxPacketSize, params.MaxPacketSize) + if params.MaxUDPPayloadSize != 0 { + p.maxPacketSize = utils.MinByteCount(p.maxPacketSize, params.MaxUDPPayloadSize) } } diff --git a/packet_packer_test.go b/packet_packer_test.go index 16cd0754..009a5b48 100644 --- a/packet_packer_test.go +++ b/packet_packer_test.go @@ -732,7 +732,7 @@ var _ = Describe("Packet packer", func() { Expect(err).ToNot(HaveOccurred()) // now reduce the maxPacketSize packer.HandleTransportParameters(&wire.TransportParameters{ - MaxPacketSize: maxPacketSize - 10, + MaxUDPPayloadSize: maxPacketSize - 10, }) framer.EXPECT().AppendControlFrames(gomock.Any(), gomock.Any()).Do(func(_ []ackhandler.Frame, maxLen protocol.ByteCount) ([]ackhandler.Frame, protocol.ByteCount) { Expect(maxLen).To(Equal(initialMaxPacketSize - 10)) @@ -757,7 +757,7 @@ var _ = Describe("Packet packer", func() { Expect(err).ToNot(HaveOccurred()) // now try to increase the maxPacketSize packer.HandleTransportParameters(&wire.TransportParameters{ - MaxPacketSize: maxPacketSize + 10, + MaxUDPPayloadSize: maxPacketSize + 10, }) framer.EXPECT().AppendControlFrames(gomock.Any(), gomock.Any()).Do(func(_ []ackhandler.Frame, maxLen protocol.ByteCount) ([]ackhandler.Frame, protocol.ByteCount) { Expect(maxLen).To(Equal(initialMaxPacketSize)) diff --git a/qlog/event.go b/qlog/event.go index 4a7f5a1e..4d35773c 100644 --- a/qlog/event.go +++ b/qlog/event.go @@ -277,7 +277,7 @@ type eventTransportParameters struct { StatelessResetToken *[16]byte DisableActiveMigration bool MaxIdleTimeout time.Duration - MaxPacketSize protocol.ByteCount + MaxUDPPayloadSize protocol.ByteCount AckDelayExponent uint8 MaxAckDelay time.Duration ActiveConnectionIDLimit uint64 @@ -306,7 +306,7 @@ func (e eventTransportParameters) MarshalJSONObject(enc *gojay.Encoder) { } enc.BoolKey("disable_active_migration", e.DisableActiveMigration) enc.FloatKeyOmitEmpty("max_idle_timeout", milliseconds(e.MaxIdleTimeout)) - enc.Uint64KeyNullEmpty("max_packet_size", uint64(e.MaxPacketSize)) + enc.Uint64KeyNullEmpty("max_udp_payload_size", uint64(e.MaxUDPPayloadSize)) enc.Uint8KeyOmitEmpty("ack_delay_exponent", e.AckDelayExponent) enc.FloatKeyOmitEmpty("max_ack_delay", milliseconds(e.MaxAckDelay)) enc.Uint64KeyOmitEmpty("active_connection_id_limit", e.ActiveConnectionIDLimit) diff --git a/qlog/qlog.go b/qlog/qlog.go index e1852772..470b4c0b 100644 --- a/qlog/qlog.go +++ b/qlog/qlog.go @@ -149,7 +149,7 @@ func (t *tracer) recordTransportParameters(time time.Time, owner owner, tp *wire StatelessResetToken: tp.StatelessResetToken, DisableActiveMigration: tp.DisableActiveMigration, MaxIdleTimeout: tp.MaxIdleTimeout, - MaxPacketSize: tp.MaxPacketSize, + MaxUDPPayloadSize: tp.MaxUDPPayloadSize, AckDelayExponent: tp.AckDelayExponent, MaxAckDelay: tp.MaxAckDelay, ActiveConnectionIDLimit: tp.ActiveConnectionIDLimit, diff --git a/qlog/qlog_test.go b/qlog/qlog_test.go index 3ff60da8..67bee47d 100644 --- a/qlog/qlog_test.go +++ b/qlog/qlog_test.go @@ -165,7 +165,7 @@ var _ = Describe("Tracer", func() { MaxAckDelay: 123 * time.Millisecond, AckDelayExponent: 12, DisableActiveMigration: true, - MaxPacketSize: 1234, + MaxUDPPayloadSize: 1234, MaxIdleTimeout: 321 * time.Millisecond, StatelessResetToken: &[16]byte{0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x00}, OriginalConnectionID: protocol.ConnectionID{0xde, 0xad, 0xc0, 0xde}, @@ -180,7 +180,7 @@ var _ = Describe("Tracer", func() { Expect(ev).To(HaveKeyWithValue("original_connection_id", "deadc0de")) Expect(ev).To(HaveKeyWithValue("stateless_reset_token", "112233445566778899aabbccddeeff00")) Expect(ev).To(HaveKeyWithValue("max_idle_timeout", float64(321))) - Expect(ev).To(HaveKeyWithValue("max_packet_size", float64(1234))) + Expect(ev).To(HaveKeyWithValue("max_udp_payload_size", float64(1234))) Expect(ev).To(HaveKeyWithValue("ack_delay_exponent", float64(12))) Expect(ev).To(HaveKeyWithValue("active_connection_id_limit", float64(7))) Expect(ev).To(HaveKeyWithValue("initial_max_data", float64(4000))) diff --git a/session_test.go b/session_test.go index 4870456f..8434ce37 100644 --- a/session_test.go +++ b/session_test.go @@ -1436,7 +1436,7 @@ var _ = Describe("Session", func() { InitialMaxData: 0x5000, ActiveConnectionIDLimit: 3, // marshaling always sets it to this value - MaxPacketSize: protocol.MaxReceivePacketSize, + MaxUDPPayloadSize: protocol.MaxReceivePacketSize, } streamManager.EXPECT().UpdateLimits(params) packer.EXPECT().HandleTransportParameters(params)