don't send an ACK delay time for Initial and Handshake ACKs

This commit is contained in:
Marten Seemann
2019-05-08 14:18:59 +09:00
parent f981339bc0
commit 0e33f3c0da
2 changed files with 19 additions and 9 deletions

View File

@@ -83,14 +83,21 @@ func (h *receivedPacketHandler) GetAlarmTimeout() time.Time {
}
func (h *receivedPacketHandler) GetAckFrame(encLevel protocol.EncryptionLevel) *wire.AckFrame {
var ack *wire.AckFrame
switch encLevel {
case protocol.EncryptionInitial:
return h.initialPackets.GetAckFrame()
ack = h.initialPackets.GetAckFrame()
case protocol.EncryptionHandshake:
return h.handshakePackets.GetAckFrame()
ack = h.handshakePackets.GetAckFrame()
case protocol.Encryption1RTT:
return h.oneRTTPackets.GetAckFrame()
default:
return nil
}
// For Initial and Handshake ACKs, the delay time is ignored by the receiver.
// Set it to 0 in order to save bytes.
if ack != nil {
ack.DelayTime = 0
}
return ack
}