Send ACKs and SWFs even if we are congestion limited

Fixes #576.
This commit is contained in:
Lucas Clemente 2017-06-20 12:01:28 +02:00 committed by Lucas Clemente
parent fc8d937fce
commit ff8c75a22e
3 changed files with 52 additions and 1 deletions

View file

@ -64,6 +64,25 @@ func (p *packetPacker) PackConnectionClose(ccf *frames.ConnectionCloseFrame, lea
}, err
}
func (p *packetPacker) PackAckPacket(leastUnacked protocol.PacketNumber, ackframe *frames.AckFrame) (*packedPacket, error) {
encLevel, sealer := p.cryptoSetup.GetSealer()
ph := p.getPublicHeader(leastUnacked, encLevel)
frames := []frames.Frame{ackframe}
if p.stopWaiting != nil {
p.stopWaiting.PacketNumber = ph.PacketNumber
p.stopWaiting.PacketNumberLen = ph.PacketNumberLen
frames = append(frames, p.stopWaiting)
p.stopWaiting = nil
}
raw, err := p.writeAndSealPacket(ph, frames, sealer)
return &packedPacket{
number: ph.PacketNumber,
raw: raw,
frames: frames,
encryptionLevel: encLevel,
}, err
}
// RetransmitNonForwardSecurePacket retransmits a handshake packet, that was sent with less than forward-secure encryption
func (p *packetPacker) RetransmitNonForwardSecurePacket(packet *ackhandler.Packet) (*packedPacket, error) {
if packet.EncryptionLevel == protocol.EncryptionForwardSecure {