add a logging event for dropping 1-RTT keys

This commit is contained in:
Marten Seemann 2020-09-09 14:55:46 +07:00
parent 9e1d65f4c9
commit dbaacd49bd
9 changed files with 77 additions and 1 deletions

View file

@ -111,6 +111,7 @@ type ConnectionTracer interface {
UpdatedKeyFromTLS(EncryptionLevel, Perspective)
UpdatedKey(generation KeyPhase, remote bool)
DroppedEncryptionLevel(EncryptionLevel)
DroppedKey(generation KeyPhase)
SetLossTimer(TimerType, EncryptionLevel, time.Time)
LossTimerExpired(TimerType, EncryptionLevel)
LossTimerCanceled()

View file

@ -86,6 +86,18 @@ func (mr *MockConnectionTracerMockRecorder) DroppedEncryptionLevel(arg0 interfac
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DroppedEncryptionLevel", reflect.TypeOf((*MockConnectionTracer)(nil).DroppedEncryptionLevel), arg0)
}
// DroppedKey mocks base method
func (m *MockConnectionTracer) DroppedKey(arg0 protocol.KeyPhase) {
m.ctrl.T.Helper()
m.ctrl.Call(m, "DroppedKey", arg0)
}
// DroppedKey indicates an expected call of DroppedKey
func (mr *MockConnectionTracerMockRecorder) DroppedKey(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DroppedKey", reflect.TypeOf((*MockConnectionTracer)(nil).DroppedKey), arg0)
}
// DroppedPacket mocks base method
func (m *MockConnectionTracer) DroppedPacket(arg0 protocol.PacketType, arg1 protocol.ByteCount, arg2 PacketDropReason) {
m.ctrl.T.Helper()

View file

@ -162,6 +162,12 @@ func (m *connTracerMultiplexer) DroppedEncryptionLevel(encLevel EncryptionLevel)
}
}
func (m *connTracerMultiplexer) DroppedKey(generation KeyPhase) {
for _, t := range m.tracers {
t.DroppedKey(generation)
}
}
func (m *connTracerMultiplexer) SetLossTimer(typ TimerType, encLevel EncryptionLevel, exp time.Time) {
for _, t := range m.tracers {
t.SetLossTimer(typ, encLevel, exp)

View file

@ -213,6 +213,12 @@ var _ = Describe("Tracing", func() {
tracer.DroppedEncryptionLevel(EncryptionHandshake)
})
It("traces the DroppedKey event", func() {
tr1.EXPECT().DroppedKey(KeyPhase(123))
tr2.EXPECT().DroppedKey(KeyPhase(123))
tracer.DroppedKey(123)
})
It("traces the SetLossTimer event", func() {
now := time.Now()
tr1.EXPECT().SetLossTimer(TimerTypePTO, EncryptionHandshake, now)