forked from quic-go/quic-go
fix packing of probe packets when retransmissions are canceled
This commit is contained in:
@@ -565,7 +565,7 @@ func (p *packetPacker) MaybePackProbePacket(encLevel protocol.EncryptionLevel) (
|
||||
default:
|
||||
panic("unknown encryption level")
|
||||
}
|
||||
if err != nil {
|
||||
if err != nil || contents == nil {
|
||||
return nil, err
|
||||
}
|
||||
if p.perspective == protocol.PerspectiveClient && encLevel == protocol.EncryptionInitial {
|
||||
|
||||
@@ -1127,6 +1127,18 @@ var _ = Describe("Packet packer", func() {
|
||||
Expect(packet.frames).To(HaveLen(1))
|
||||
Expect(packet.frames[0].Frame).To(Equal(f))
|
||||
})
|
||||
|
||||
It("returns nil if there's no probe data to send", func() {
|
||||
sealingManager.EXPECT().Get1RTTSealer().Return(getSealer(), nil)
|
||||
ackFramer.EXPECT().GetAckFrame(protocol.Encryption1RTT)
|
||||
pnManager.EXPECT().PeekPacketNumber(protocol.Encryption1RTT).Return(protocol.PacketNumber(0x42), protocol.PacketNumberLen2)
|
||||
expectAppendControlFrames()
|
||||
expectAppendStreamFrames()
|
||||
|
||||
packet, err := packer.MaybePackProbePacket(protocol.Encryption1RTT)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(packet).To(BeNil())
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1404,7 +1404,7 @@ func (s *session) sendProbePacket(encLevel protocol.EncryptionLevel) error {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if packet == nil {
|
||||
if packet == nil || packet.packetContents == nil {
|
||||
return fmt.Errorf("session BUG: couldn't pack %s probe packet", encLevel)
|
||||
}
|
||||
s.sendPackedPacket(packet)
|
||||
|
||||
Reference in New Issue
Block a user