qlog the max_datagram_frame_size transport parameter

This commit is contained in:
Marten Seemann 2021-01-11 16:19:05 +08:00
parent d1c5297c0b
commit ec2b9f47ca
3 changed files with 20 additions and 1 deletions

View file

@ -345,6 +345,8 @@ type eventTransportParameters struct {
InitialMaxStreamsUni int64
PreferredAddress *preferredAddress
MaxDatagramFrameSize protocol.ByteCount
}
func (e eventTransportParameters) Category() category { return categoryTransport }
@ -365,7 +367,7 @@ func (e eventTransportParameters) MarshalJSONObject(enc *gojay.Encoder) {
enc.StringKey("initial_source_connection_id", connectionID(e.InitialSourceConnectionID).String())
enc.BoolKey("disable_active_migration", e.DisableActiveMigration)
enc.FloatKeyOmitEmpty("max_idle_timeout", milliseconds(e.MaxIdleTimeout))
enc.Uint64KeyNullEmpty("max_udp_payload_size", uint64(e.MaxUDPPayloadSize))
enc.Int64KeyNullEmpty("max_udp_payload_size", int64(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)
@ -380,6 +382,9 @@ func (e eventTransportParameters) MarshalJSONObject(enc *gojay.Encoder) {
if e.PreferredAddress != nil {
enc.ObjectKey("preferred_address", e.PreferredAddress)
}
if e.MaxDatagramFrameSize != protocol.InvalidByteCount {
enc.Int64Key("max_datagram_frame_size", int64(e.MaxDatagramFrameSize))
}
}
type preferredAddress struct {

View file

@ -205,6 +205,7 @@ func (t *connectionTracer) recordTransportParameters(sentBy protocol.Perspective
InitialMaxStreamsBidi: int64(tp.MaxBidiStreamNum),
InitialMaxStreamsUni: int64(tp.MaxUniStreamNum),
PreferredAddress: pa,
MaxDatagramFrameSize: tp.MaxDatagramFrameSize,
})
t.mutex.Unlock()
}

View file

@ -244,6 +244,7 @@ var _ = Describe("Tracing", func() {
InitialSourceConnectionID: protocol.ConnectionID{0xde, 0xad, 0xbe, 0xef},
RetrySourceConnectionID: &protocol.ConnectionID{0xde, 0xca, 0xfb, 0xad},
ActiveConnectionIDLimit: 7,
MaxDatagramFrameSize: protocol.InvalidByteCount,
})
entry := exportAndParseSingle()
Expect(entry.Time).To(BeTemporally("~", time.Now(), scaleDuration(10*time.Millisecond)))
@ -265,6 +266,7 @@ var _ = Describe("Tracing", func() {
Expect(ev).To(HaveKeyWithValue("initial_max_streams_bidi", float64(10)))
Expect(ev).To(HaveKeyWithValue("initial_max_streams_uni", float64(20)))
Expect(ev).ToNot(HaveKey("preferred_address"))
Expect(ev).ToNot(HaveKey("max_datagram_frame_size"))
})
It("records the server's transport parameters, without a stateless reset token", func() {
@ -317,6 +319,17 @@ var _ = Describe("Tracing", func() {
Expect(pa).To(HaveKeyWithValue("stateless_reset_token", "0f0e0d0c0b0a09080706050403020100"))
})
It("records transport parameters that enable the datagram extension", func() {
tracer.SentTransportParameters(&logging.TransportParameters{
MaxDatagramFrameSize: 1337,
})
entry := exportAndParseSingle()
Expect(entry.Time).To(BeTemporally("~", time.Now(), scaleDuration(10*time.Millisecond)))
Expect(entry.Name).To(Equal("transport:parameters_set"))
ev := entry.Event
Expect(ev).To(HaveKeyWithValue("max_datagram_frame_size", float64(1337)))
})
It("records received transport parameters", func() {
tracer.ReceivedTransportParameters(&logging.TransportParameters{})
entry := exportAndParseSingle()