mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-03 04:07:35 +03:00
introduce separate tracing calls for sent long and short header packets
This commit is contained in:
parent
9e5f92b561
commit
24be84cd00
14 changed files with 127 additions and 61 deletions
|
@ -121,7 +121,8 @@ type ConnectionTracer interface {
|
|||
SentTransportParameters(*TransportParameters)
|
||||
ReceivedTransportParameters(*TransportParameters)
|
||||
RestoredTransportParameters(parameters *TransportParameters) // for 0-RTT
|
||||
SentPacket(hdr *ExtendedHeader, size ByteCount, ack *AckFrame, frames []Frame)
|
||||
SentLongHeaderPacket(hdr *ExtendedHeader, size ByteCount, ack *AckFrame, frames []Frame)
|
||||
SentShortHeaderPacket(hdr *ShortHeader, size ByteCount, ack *AckFrame, frames []Frame)
|
||||
ReceivedVersionNegotiationPacket(dest, src ArbitraryLenConnectionID, _ []VersionNumber)
|
||||
ReceivedRetry(*Header)
|
||||
ReceivedLongHeaderPacket(hdr *ExtendedHeader, size ByteCount, frames []Frame)
|
||||
|
|
|
@ -254,16 +254,28 @@ func (mr *MockConnectionTracerMockRecorder) RestoredTransportParameters(arg0 int
|
|||
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) {
|
||||
// SentLongHeaderPacket mocks base method.
|
||||
func (m *MockConnectionTracer) SentLongHeaderPacket(arg0 *wire.ExtendedHeader, arg1 protocol.ByteCount, arg2 *wire.AckFrame, arg3 []Frame) {
|
||||
m.ctrl.T.Helper()
|
||||
m.ctrl.Call(m, "SentPacket", arg0, arg1, arg2, arg3)
|
||||
m.ctrl.Call(m, "SentLongHeaderPacket", arg0, arg1, arg2, arg3)
|
||||
}
|
||||
|
||||
// SentPacket indicates an expected call of SentPacket.
|
||||
func (mr *MockConnectionTracerMockRecorder) SentPacket(arg0, arg1, arg2, arg3 interface{}) *gomock.Call {
|
||||
// SentLongHeaderPacket indicates an expected call of SentLongHeaderPacket.
|
||||
func (mr *MockConnectionTracerMockRecorder) SentLongHeaderPacket(arg0, arg1, arg2, arg3 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SentPacket", reflect.TypeOf((*MockConnectionTracer)(nil).SentPacket), arg0, arg1, arg2, arg3)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SentLongHeaderPacket", reflect.TypeOf((*MockConnectionTracer)(nil).SentLongHeaderPacket), arg0, arg1, arg2, arg3)
|
||||
}
|
||||
|
||||
// SentShortHeaderPacket mocks base method.
|
||||
func (m *MockConnectionTracer) SentShortHeaderPacket(arg0 *ShortHeader, arg1 protocol.ByteCount, arg2 *wire.AckFrame, arg3 []Frame) {
|
||||
m.ctrl.T.Helper()
|
||||
m.ctrl.Call(m, "SentShortHeaderPacket", arg0, arg1, arg2, arg3)
|
||||
}
|
||||
|
||||
// SentShortHeaderPacket indicates an expected call of SentShortHeaderPacket.
|
||||
func (mr *MockConnectionTracerMockRecorder) SentShortHeaderPacket(arg0, arg1, arg2, arg3 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SentShortHeaderPacket", reflect.TypeOf((*MockConnectionTracer)(nil).SentShortHeaderPacket), arg0, arg1, arg2, arg3)
|
||||
}
|
||||
|
||||
// SentTransportParameters mocks base method.
|
||||
|
|
|
@ -104,9 +104,15 @@ func (m *connTracerMultiplexer) RestoredTransportParameters(tp *TransportParamet
|
|||
}
|
||||
}
|
||||
|
||||
func (m *connTracerMultiplexer) SentPacket(hdr *ExtendedHeader, size ByteCount, ack *AckFrame, frames []Frame) {
|
||||
func (m *connTracerMultiplexer) SentLongHeaderPacket(hdr *ExtendedHeader, size ByteCount, ack *AckFrame, frames []Frame) {
|
||||
for _, t := range m.tracers {
|
||||
t.SentPacket(hdr, size, ack, frames)
|
||||
t.SentLongHeaderPacket(hdr, size, ack, frames)
|
||||
}
|
||||
}
|
||||
|
||||
func (m *connTracerMultiplexer) SentShortHeaderPacket(hdr *ShortHeader, size ByteCount, ack *AckFrame, frames []Frame) {
|
||||
for _, t := range m.tracers {
|
||||
t.SentShortHeaderPacket(hdr, size, ack, frames)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -157,13 +157,22 @@ var _ = Describe("Tracing", func() {
|
|||
tracer.RestoredTransportParameters(tp)
|
||||
})
|
||||
|
||||
It("traces the SentPacket event", func() {
|
||||
It("traces the SentLongHeaderPacket event", func() {
|
||||
hdr := &ExtendedHeader{Header: Header{DestConnectionID: protocol.ParseConnectionID([]byte{1, 2, 3})}}
|
||||
ack := &AckFrame{AckRanges: []AckRange{{Smallest: 1, Largest: 10}}}
|
||||
ping := &PingFrame{}
|
||||
tr1.EXPECT().SentPacket(hdr, ByteCount(1337), ack, []Frame{ping})
|
||||
tr2.EXPECT().SentPacket(hdr, ByteCount(1337), ack, []Frame{ping})
|
||||
tracer.SentPacket(hdr, 1337, ack, []Frame{ping})
|
||||
tr1.EXPECT().SentLongHeaderPacket(hdr, ByteCount(1337), ack, []Frame{ping})
|
||||
tr2.EXPECT().SentLongHeaderPacket(hdr, ByteCount(1337), ack, []Frame{ping})
|
||||
tracer.SentLongHeaderPacket(hdr, 1337, ack, []Frame{ping})
|
||||
})
|
||||
|
||||
It("traces the SentShortHeaderPacket event", func() {
|
||||
hdr := &ShortHeader{DestConnectionID: protocol.ParseConnectionID([]byte{1, 2, 3})}
|
||||
ack := &AckFrame{AckRanges: []AckRange{{Smallest: 1, Largest: 10}}}
|
||||
ping := &PingFrame{}
|
||||
tr1.EXPECT().SentShortHeaderPacket(hdr, ByteCount(1337), ack, []Frame{ping})
|
||||
tr2.EXPECT().SentShortHeaderPacket(hdr, ByteCount(1337), ack, []Frame{ping})
|
||||
tracer.SentShortHeaderPacket(hdr, 1337, ack, []Frame{ping})
|
||||
})
|
||||
|
||||
It("traces the ReceivedVersionNegotiationPacket event", func() {
|
||||
|
|
|
@ -31,11 +31,12 @@ func (n NullConnectionTracer) StartedConnection(local, remote net.Addr, srcConnI
|
|||
|
||||
func (n NullConnectionTracer) NegotiatedVersion(chosen VersionNumber, clientVersions, serverVersions []VersionNumber) {
|
||||
}
|
||||
func (n NullConnectionTracer) ClosedConnection(err error) {}
|
||||
func (n NullConnectionTracer) SentTransportParameters(*TransportParameters) {}
|
||||
func (n NullConnectionTracer) ReceivedTransportParameters(*TransportParameters) {}
|
||||
func (n NullConnectionTracer) RestoredTransportParameters(*TransportParameters) {}
|
||||
func (n NullConnectionTracer) SentPacket(*ExtendedHeader, ByteCount, *AckFrame, []Frame) {}
|
||||
func (n NullConnectionTracer) ClosedConnection(err error) {}
|
||||
func (n NullConnectionTracer) SentTransportParameters(*TransportParameters) {}
|
||||
func (n NullConnectionTracer) ReceivedTransportParameters(*TransportParameters) {}
|
||||
func (n NullConnectionTracer) RestoredTransportParameters(*TransportParameters) {}
|
||||
func (n NullConnectionTracer) SentLongHeaderPacket(*ExtendedHeader, ByteCount, *AckFrame, []Frame) {}
|
||||
func (n NullConnectionTracer) SentShortHeaderPacket(*ShortHeader, ByteCount, *AckFrame, []Frame) {}
|
||||
func (n NullConnectionTracer) ReceivedVersionNegotiationPacket(dest, src ArbitraryLenConnectionID, _ []VersionNumber) {
|
||||
}
|
||||
func (n NullConnectionTracer) ReceivedRetry(*Header) {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue