mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-04 12:47:36 +03:00
add a RestoredTransportParameters method to the logging interface
This commit is contained in:
parent
96dbfbc320
commit
d04662a964
8 changed files with 44 additions and 0 deletions
|
@ -65,6 +65,7 @@ func (t *connTracer) StartedConnection(local, remote net.Addr, version logging.V
|
||||||
func (t *connTracer) ClosedConnection(logging.CloseReason) {}
|
func (t *connTracer) ClosedConnection(logging.CloseReason) {}
|
||||||
func (t *connTracer) SentTransportParameters(*logging.TransportParameters) {}
|
func (t *connTracer) SentTransportParameters(*logging.TransportParameters) {}
|
||||||
func (t *connTracer) ReceivedTransportParameters(*logging.TransportParameters) {}
|
func (t *connTracer) ReceivedTransportParameters(*logging.TransportParameters) {}
|
||||||
|
func (t *connTracer) RestoredTransportParameters(*logging.TransportParameters) {}
|
||||||
func (t *connTracer) SentPacket(hdr *logging.ExtendedHeader, size logging.ByteCount, ack *logging.AckFrame, frames []logging.Frame) {
|
func (t *connTracer) SentPacket(hdr *logging.ExtendedHeader, size logging.ByteCount, ack *logging.AckFrame, frames []logging.Frame) {
|
||||||
sentHeaders = append(sentHeaders, hdr)
|
sentHeaders = append(sentHeaders, hdr)
|
||||||
}
|
}
|
||||||
|
|
|
@ -207,6 +207,18 @@ func (mr *MockConnectionTracerMockRecorder) ReceivedVersionNegotiationPacket(arg
|
||||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReceivedVersionNegotiationPacket", reflect.TypeOf((*MockConnectionTracer)(nil).ReceivedVersionNegotiationPacket), arg0, arg1)
|
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
|
// SentPacket mocks base method
|
||||||
func (m *MockConnectionTracer) SentPacket(arg0 *wire.ExtendedHeader, arg1 protocol.ByteCount, arg2 *wire.AckFrame, arg3 []logging.Frame) {
|
func (m *MockConnectionTracer) SentPacket(arg0 *wire.ExtendedHeader, arg1 protocol.ByteCount, arg2 *wire.AckFrame, arg3 []logging.Frame) {
|
||||||
m.ctrl.T.Helper()
|
m.ctrl.T.Helper()
|
||||||
|
|
|
@ -107,6 +107,7 @@ type ConnectionTracer interface {
|
||||||
ClosedConnection(CloseReason)
|
ClosedConnection(CloseReason)
|
||||||
SentTransportParameters(*TransportParameters)
|
SentTransportParameters(*TransportParameters)
|
||||||
ReceivedTransportParameters(*TransportParameters)
|
ReceivedTransportParameters(*TransportParameters)
|
||||||
|
RestoredTransportParameters(parameters *TransportParameters) // for 0-RTT
|
||||||
SentPacket(hdr *ExtendedHeader, size ByteCount, ack *AckFrame, frames []Frame)
|
SentPacket(hdr *ExtendedHeader, size ByteCount, ack *AckFrame, frames []Frame)
|
||||||
ReceivedVersionNegotiationPacket(*Header, []VersionNumber)
|
ReceivedVersionNegotiationPacket(*Header, []VersionNumber)
|
||||||
ReceivedRetry(*Header)
|
ReceivedRetry(*Header)
|
||||||
|
|
|
@ -206,6 +206,18 @@ func (mr *MockConnectionTracerMockRecorder) ReceivedVersionNegotiationPacket(arg
|
||||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReceivedVersionNegotiationPacket", reflect.TypeOf((*MockConnectionTracer)(nil).ReceivedVersionNegotiationPacket), arg0, arg1)
|
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
|
// SentPacket mocks base method
|
||||||
func (m *MockConnectionTracer) SentPacket(arg0 *wire.ExtendedHeader, arg1 protocol.ByteCount, arg2 *wire.AckFrame, arg3 []Frame) {
|
func (m *MockConnectionTracer) SentPacket(arg0 *wire.ExtendedHeader, arg1 protocol.ByteCount, arg2 *wire.AckFrame, arg3 []Frame) {
|
||||||
m.ctrl.T.Helper()
|
m.ctrl.T.Helper()
|
||||||
|
|
|
@ -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) {
|
func (m *connTracerMultiplexer) SentPacket(hdr *ExtendedHeader, size ByteCount, ack *AckFrame, frames []Frame) {
|
||||||
for _, t := range m.tracers {
|
for _, t := range m.tracers {
|
||||||
t.SentPacket(hdr, size, ack, frames)
|
t.SentPacket(hdr, size, ack, frames)
|
||||||
|
|
|
@ -126,6 +126,13 @@ var _ = Describe("Tracing", func() {
|
||||||
tracer.ReceivedTransportParameters(tp)
|
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() {
|
It("traces the SentPacket event", func() {
|
||||||
hdr := &ExtendedHeader{Header: Header{DestConnectionID: ConnectionID{1, 2, 3}}}
|
hdr := &ExtendedHeader{Header: Header{DestConnectionID: ConnectionID{1, 2, 3}}}
|
||||||
ack := &AckFrame{AckRanges: []AckRange{{Smallest: 1, Largest: 10}}}
|
ack := &AckFrame{AckRanges: []AckRange{{Smallest: 1, Largest: 10}}}
|
||||||
|
|
|
@ -165,6 +165,7 @@ func (t *connTracer) ClosedConnection(r logging.CloseReason) {
|
||||||
}
|
}
|
||||||
func (t *connTracer) SentTransportParameters(*logging.TransportParameters) {}
|
func (t *connTracer) SentTransportParameters(*logging.TransportParameters) {}
|
||||||
func (t *connTracer) ReceivedTransportParameters(*logging.TransportParameters) {}
|
func (t *connTracer) ReceivedTransportParameters(*logging.TransportParameters) {}
|
||||||
|
func (t *connTracer) RestoredTransportParameters(*logging.TransportParameters) {}
|
||||||
func (t *connTracer) SentPacket(hdr *logging.ExtendedHeader, _ logging.ByteCount, _ *logging.AckFrame, _ []logging.Frame) {
|
func (t *connTracer) SentPacket(hdr *logging.ExtendedHeader, _ logging.ByteCount, _ *logging.AckFrame, _ []logging.Frame) {
|
||||||
typ := logging.PacketTypeFromHeader(&hdr.Header)
|
typ := logging.PacketTypeFromHeader(&hdr.Header)
|
||||||
if typ == logging.PacketType1RTT {
|
if typ == logging.PacketType1RTT {
|
||||||
|
|
|
@ -168,6 +168,10 @@ func (t *connectionTracer) ReceivedTransportParameters(tp *wire.TransportParamet
|
||||||
t.recordTransportParameters(t.perspective.Opposite(), tp)
|
t.recordTransportParameters(t.perspective.Opposite(), tp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (t *connectionTracer) RestoredTransportParameters(tp *wire.TransportParameters) {
|
||||||
|
// TODO: implement
|
||||||
|
}
|
||||||
|
|
||||||
func (t *connectionTracer) recordTransportParameters(sentBy protocol.Perspective, tp *wire.TransportParameters) {
|
func (t *connectionTracer) recordTransportParameters(sentBy protocol.Perspective, tp *wire.TransportParameters) {
|
||||||
owner := ownerLocal
|
owner := ownerLocal
|
||||||
if sentBy != t.perspective {
|
if sentBy != t.perspective {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue