add a RestoredTransportParameters method to the logging interface

This commit is contained in:
Marten Seemann 2021-01-09 14:20:52 +08:00
parent 96dbfbc320
commit d04662a964
8 changed files with 44 additions and 0 deletions

View file

@ -107,6 +107,7 @@ type ConnectionTracer interface {
ClosedConnection(CloseReason)
SentTransportParameters(*TransportParameters)
ReceivedTransportParameters(*TransportParameters)
RestoredTransportParameters(parameters *TransportParameters) // for 0-RTT
SentPacket(hdr *ExtendedHeader, size ByteCount, ack *AckFrame, frames []Frame)
ReceivedVersionNegotiationPacket(*Header, []VersionNumber)
ReceivedRetry(*Header)

View file

@ -206,6 +206,18 @@ func (mr *MockConnectionTracerMockRecorder) ReceivedVersionNegotiationPacket(arg
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReceivedVersionNegotiationPacket", reflect.TypeOf((*MockConnectionTracer)(nil).ReceivedVersionNegotiationPacket), arg0, arg1)
}
// RestoredTransportParameters mocks base method
func (m *MockConnectionTracer) RestoredTransportParameters(arg0 *wire.TransportParameters) {
m.ctrl.T.Helper()
m.ctrl.Call(m, "RestoredTransportParameters", arg0)
}
// RestoredTransportParameters indicates an expected call of RestoredTransportParameters
func (mr *MockConnectionTracerMockRecorder) RestoredTransportParameters(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RestoredTransportParameters", reflect.TypeOf((*MockConnectionTracer)(nil).RestoredTransportParameters), arg0)
}
// SentPacket mocks base method
func (m *MockConnectionTracer) SentPacket(arg0 *wire.ExtendedHeader, arg1 protocol.ByteCount, arg2 *wire.AckFrame, arg3 []Frame) {
m.ctrl.T.Helper()

View file

@ -84,6 +84,12 @@ func (m *connTracerMultiplexer) ReceivedTransportParameters(tp *TransportParamet
}
}
func (m *connTracerMultiplexer) RestoredTransportParameters(tp *TransportParameters) {
for _, t := range m.tracers {
t.RestoredTransportParameters(tp)
}
}
func (m *connTracerMultiplexer) SentPacket(hdr *ExtendedHeader, size ByteCount, ack *AckFrame, frames []Frame) {
for _, t := range m.tracers {
t.SentPacket(hdr, size, ack, frames)

View file

@ -126,6 +126,13 @@ var _ = Describe("Tracing", func() {
tracer.ReceivedTransportParameters(tp)
})
It("traces the RestoredTransportParameters event", func() {
tp := &wire.TransportParameters{InitialMaxData: 1337}
tr1.EXPECT().RestoredTransportParameters(tp)
tr2.EXPECT().RestoredTransportParameters(tp)
tracer.RestoredTransportParameters(tp)
})
It("traces the SentPacket event", func() {
hdr := &ExtendedHeader{Header: Header{DestConnectionID: ConnectionID{1, 2, 3}}}
ack := &AckFrame{AckRanges: []AckRange{{Smallest: 1, Largest: 10}}}