keep increasing the packet number after version negotiation and retry

This commit is contained in:
Marten Seemann 2018-12-22 22:15:35 +06:30
parent 1abf9e1b37
commit 178ac0dacb
8 changed files with 59 additions and 13 deletions

View file

@ -38,6 +38,7 @@ var _ = Describe("Client", func() {
srcConnID protocol.ConnectionID,
conf *Config,
tlsConf *tls.Config,
initialPacketNumber protocol.PacketNumber,
params *handshake.TransportParameters,
initialVersion protocol.VersionNumber,
logger utils.Logger,
@ -142,6 +143,7 @@ var _ = Describe("Client", func() {
_ protocol.ConnectionID,
_ *Config,
_ *tls.Config,
_ protocol.PacketNumber,
_ *handshake.TransportParameters,
_ protocol.VersionNumber,
_ utils.Logger,
@ -172,6 +174,7 @@ var _ = Describe("Client", func() {
_ protocol.ConnectionID,
_ *Config,
tlsConf *tls.Config,
_ protocol.PacketNumber,
_ *handshake.TransportParameters,
_ protocol.VersionNumber,
_ utils.Logger,
@ -202,6 +205,7 @@ var _ = Describe("Client", func() {
_ protocol.ConnectionID,
_ *Config,
_ *tls.Config,
_ protocol.PacketNumber,
_ *handshake.TransportParameters,
_ protocol.VersionNumber,
_ utils.Logger,
@ -239,6 +243,7 @@ var _ = Describe("Client", func() {
_ protocol.ConnectionID,
_ *Config,
_ *tls.Config,
_ protocol.PacketNumber,
_ *handshake.TransportParameters,
_ protocol.VersionNumber,
_ utils.Logger,
@ -279,6 +284,7 @@ var _ = Describe("Client", func() {
_ protocol.ConnectionID,
_ *Config,
_ *tls.Config,
_ protocol.PacketNumber,
_ *handshake.TransportParameters,
_ protocol.VersionNumber,
_ utils.Logger,
@ -324,6 +330,7 @@ var _ = Describe("Client", func() {
_ protocol.ConnectionID,
_ *Config,
_ *tls.Config,
_ protocol.PacketNumber,
_ *handshake.TransportParameters,
_ protocol.VersionNumber,
_ utils.Logger,
@ -369,6 +376,7 @@ var _ = Describe("Client", func() {
_ protocol.ConnectionID,
_ *Config,
_ *tls.Config,
_ protocol.PacketNumber,
_ *handshake.TransportParameters,
_ protocol.VersionNumber,
_ utils.Logger,
@ -484,6 +492,7 @@ var _ = Describe("Client", func() {
_ protocol.ConnectionID,
configP *Config,
_ *tls.Config,
_ protocol.PacketNumber,
params *handshake.TransportParameters,
_ protocol.VersionNumber, /* initial version */
_ utils.Logger,
@ -530,8 +539,9 @@ var _ = Describe("Client", func() {
sess1.EXPECT().run().DoAndReturn(func() error {
return <-run1
})
sess1.EXPECT().closeForRecreating().Do(func() {
sess1.EXPECT().closeForRecreating().DoAndReturn(func() protocol.PacketNumber {
run1 <- errCloseForRecreating
return 42
})
sess2 := NewMockQuicSession(mockCtrl)
sess2.EXPECT().run()
@ -547,6 +557,7 @@ var _ = Describe("Client", func() {
_ protocol.ConnectionID,
_ *Config,
_ *tls.Config,
initialPacketNumber protocol.PacketNumber,
_ *handshake.TransportParameters,
_ protocol.VersionNumber,
_ utils.Logger,
@ -554,9 +565,11 @@ var _ = Describe("Client", func() {
) (quicSession, error) {
switch len(sessions) {
case 2: // for the first session
Expect(initialPacketNumber).To(BeZero())
Expect(origDestConnID).To(BeNil())
Expect(destConnID).ToNot(BeNil())
case 1: // for the second session
Expect(initialPacketNumber).To(Equal(protocol.PacketNumber(42)))
Expect(origDestConnID).To(Equal(connID))
Expect(destConnID).ToNot(Equal(connID))
}
@ -615,6 +628,7 @@ var _ = Describe("Client", func() {
_ protocol.ConnectionID,
_ *Config,
_ *tls.Config,
_ protocol.PacketNumber,
_ *handshake.TransportParameters,
_ protocol.VersionNumber,
_ utils.Logger,
@ -654,6 +668,7 @@ var _ = Describe("Client", func() {
_ protocol.ConnectionID,
_ *Config,
_ *tls.Config,
_ protocol.PacketNumber,
_ *handshake.TransportParameters,
_ protocol.VersionNumber,
_ utils.Logger,