From 8fc573c8953710bce37f6430d1d9ec91a23047e9 Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Sun, 4 Mar 2018 22:33:10 +0700 Subject: [PATCH] set the packet type for handshake retransmissions --- packet_packer.go | 1 + packet_packer_test.go | 2 ++ 2 files changed, 3 insertions(+) diff --git a/packet_packer.go b/packet_packer.go index 43ff8e36..6070dd90 100644 --- a/packet_packer.go +++ b/packet_packer.go @@ -214,6 +214,7 @@ func (p *packetPacker) packHandshakeRetransmission(packet *ackhandler.Packet) (* p.hasSentPacket = false } header := p.getHeader(packet.EncryptionLevel) + header.Type = packet.PacketType var frames []wire.Frame if p.version.UsesStopWaitingFrames() { // for gQUIC: pack a STOP_WAITING first if p.stopWaiting == nil { diff --git a/packet_packer_test.go b/packet_packer_test.go index 57ab1b26..e620869c 100644 --- a/packet_packer_test.go +++ b/packet_packer_test.go @@ -616,12 +616,14 @@ var _ = Describe("Packet packer", func() { It("packs a retransmission for a packet sent with no encryption", func() { packet := &ackhandler.Packet{ + PacketType: protocol.PacketTypeHandshake, EncryptionLevel: protocol.EncryptionUnencrypted, Frames: []wire.Frame{sf}, } p, err := packer.PackRetransmission(packet) Expect(err).ToNot(HaveOccurred()) Expect(p).To(HaveLen(1)) + Expect(p[0].header.Type).To(Equal(protocol.PacketTypeHandshake)) Expect(p[0].frames).To(Equal([]wire.Frame{swf, sf})) Expect(p[0].encryptionLevel).To(Equal(protocol.EncryptionUnencrypted)) })