declare the handshake confirmed when receiving an ACK for a 1-RTT packet

... on the client side. Both the receipt of HANDSHAKE_DONE and the
receipt of an ACK for a 1-RTT packet are sufficient for declaring
confirmation of the handshake.
This commit is contained in:
Marten Seemann 2021-04-14 22:26:03 +07:00
parent 3138a45fde
commit 17d9860db6
6 changed files with 154 additions and 65 deletions

View file

@ -2564,6 +2564,18 @@ var _ = Describe("Client Session", func() {
Expect(sess.handleHandshakeDoneFrame()).To(Succeed())
})
It("interprets an ACK for 1-RTT packets as confirmation of the handshake", func() {
sess.peerParams = &wire.TransportParameters{}
sph := mockackhandler.NewMockSentPacketHandler(mockCtrl)
sess.sentPacketHandler = sph
ack := &wire.AckFrame{AckRanges: []wire.AckRange{{Smallest: 1, Largest: 3}}}
sph.EXPECT().ReceivedAck(ack, protocol.Encryption1RTT, gomock.Any()).Return(true, nil)
sph.EXPECT().SetHandshakeConfirmed()
cryptoSetup.EXPECT().SetLargest1RTTAcked(protocol.PacketNumber(3))
cryptoSetup.EXPECT().SetHandshakeConfirmed()
Expect(sess.handleAckFrame(ack, protocol.Encryption1RTT)).To(Succeed())
})
Context("handling tokens", func() {
var mockTokenStore *MockTokenStore