pass the largest acked 1-RTT packet number to the crypto setup

This commit is contained in:
Marten Seemann 2019-06-12 22:10:24 +08:00
parent 1e148c20c5
commit 73d5d83a1d
5 changed files with 17 additions and 17 deletions

View file

@ -223,7 +223,7 @@ func (h *cryptoSetup) ChangeConnectionID(id protocol.ConnectionID) error {
return nil
}
func (h *cryptoSetup) Received1RTTAck() {
func (h *cryptoSetup) SetLargest1RTTAcked(_ protocol.PacketNumber) {
// drop initial keys
// TODO: do this earlier
if h.initialOpener != nil {

View file

@ -71,7 +71,7 @@ type CryptoSetup interface {
ChangeConnectionID(protocol.ConnectionID) error
HandleMessage([]byte, protocol.EncryptionLevel) bool
Received1RTTAck()
SetLargest1RTTAcked(protocol.PacketNumber)
ConnectionState() tls.ConnectionState
GetInitialOpener() (LongHeaderOpener, error)

View file

@ -182,18 +182,6 @@ func (mr *MockCryptoSetupMockRecorder) HandleMessage(arg0, arg1 interface{}) *go
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HandleMessage", reflect.TypeOf((*MockCryptoSetup)(nil).HandleMessage), arg0, arg1)
}
// Received1RTTAck mocks base method
func (m *MockCryptoSetup) Received1RTTAck() {
m.ctrl.T.Helper()
m.ctrl.Call(m, "Received1RTTAck")
}
// Received1RTTAck indicates an expected call of Received1RTTAck
func (mr *MockCryptoSetupMockRecorder) Received1RTTAck() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Received1RTTAck", reflect.TypeOf((*MockCryptoSetup)(nil).Received1RTTAck))
}
// RunHandshake mocks base method
func (m *MockCryptoSetup) RunHandshake() {
m.ctrl.T.Helper()
@ -205,3 +193,15 @@ func (mr *MockCryptoSetupMockRecorder) RunHandshake() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RunHandshake", reflect.TypeOf((*MockCryptoSetup)(nil).RunHandshake))
}
// SetLargest1RTTAcked mocks base method
func (m *MockCryptoSetup) SetLargest1RTTAcked(arg0 protocol.PacketNumber) {
m.ctrl.T.Helper()
m.ctrl.Call(m, "SetLargest1RTTAcked", arg0)
}
// SetLargest1RTTAcked indicates an expected call of SetLargest1RTTAcked
func (mr *MockCryptoSetupMockRecorder) SetLargest1RTTAcked(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetLargest1RTTAcked", reflect.TypeOf((*MockCryptoSetup)(nil).SetLargest1RTTAcked), arg0)
}

View file

@ -50,7 +50,7 @@ type streamManager interface {
type cryptoStreamHandler interface {
RunHandshake()
ChangeConnectionID(protocol.ConnectionID) error
Received1RTTAck()
SetLargest1RTTAcked(protocol.PacketNumber)
io.Closer
ConnectionState() tls.ConnectionState
}
@ -890,7 +890,7 @@ func (s *session) handleAckFrame(frame *wire.AckFrame, pn protocol.PacketNumber,
}
if encLevel == protocol.Encryption1RTT {
s.receivedPacketHandler.IgnoreBelow(s.sentPacketHandler.GetLowestPacketNotConfirmedAcked())
s.cryptoStreamHandler.Received1RTTAck()
s.cryptoStreamHandler.SetLargest1RTTAcked(frame.LargestAcked())
}
return nil
}

View file

@ -163,7 +163,7 @@ var _ = Describe("Session", func() {
})
It("tells the ReceivedPacketHandler to ignore low ranges", func() {
cryptoSetup.EXPECT().Received1RTTAck()
cryptoSetup.EXPECT().SetLargest1RTTAcked(protocol.PacketNumber(3))
ack := &wire.AckFrame{AckRanges: []wire.AckRange{{Smallest: 2, Largest: 3}}}
sph := mockackhandler.NewMockSentPacketHandler(mockCtrl)
sph.EXPECT().ReceivedAck(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any())