Don't retransmit handshake packets once the handshake is complete

Fixes #663.
This commit is contained in:
Lucas Clemente
2017-06-14 16:36:35 +02:00
parent 7a49b06c6c
commit 23bad71d92
2 changed files with 16 additions and 0 deletions

View File

@@ -579,6 +579,10 @@ func (s *session) sendPacket() error {
utils.Debugf("\tDequeueing retransmission for packet 0x%x", retransmitPacket.PacketNumber)
if retransmitPacket.EncryptionLevel != protocol.EncryptionForwardSecure {
if s.handshakeComplete {
// Don't retransmit handshake packets when the handshake is complete
continue
}
utils.Debugf("\tDequeueing handshake retransmission for packet 0x%x", retransmitPacket.PacketNumber)
stopWaitingFrame := s.sentPacketHandler.GetStopWaitingFrame(true)
var packet *packedPacket

View File

@@ -991,6 +991,18 @@ var _ = Describe("Session", func() {
Expect(sentPackets[0].Frames).To(HaveLen(2))
Expect(sentPackets[0].Frames).To(ContainElement(sf))
})
It("doesn't retransmit handshake packets when the handshake is complete", func() {
sess.handshakeComplete = true
sf := &frames.StreamFrame{StreamID: 1, Data: []byte("foobar")}
sph.retransmissionQueue = []*ackhandler.Packet{{
Frames: []frames.Frame{sf},
EncryptionLevel: protocol.EncryptionSecure,
}}
err := sess.sendPacket()
Expect(err).ToNot(HaveOccurred())
Expect(mconn.written).To(BeEmpty())
})
})
Context("for packets after the handshake", func() {