forked from quic-go/quic-go
rename peerNotAwaitingAddressValidation to peerCompletedAddressValidation
This commit is contained in:
@@ -49,7 +49,7 @@ type sentPacketHandler struct {
|
|||||||
handshakePackets *packetNumberSpace
|
handshakePackets *packetNumberSpace
|
||||||
appDataPackets *packetNumberSpace
|
appDataPackets *packetNumberSpace
|
||||||
|
|
||||||
peerNotAwaitingAddressValidation bool
|
peerCompletedAddressValidation bool
|
||||||
handshakeComplete bool
|
handshakeComplete bool
|
||||||
|
|
||||||
// lowestNotConfirmedAcked is the lowest packet number that we sent an ACK for, but haven't received confirmation, that this ACK actually arrived
|
// lowestNotConfirmedAcked is the lowest packet number that we sent an ACK for, but haven't received confirmation, that this ACK actually arrived
|
||||||
@@ -97,12 +97,8 @@ func newSentPacketHandler(
|
|||||||
true, // use Reno
|
true, // use Reno
|
||||||
)
|
)
|
||||||
|
|
||||||
var peerNotAwaitingAddressValidation bool
|
|
||||||
if pers == protocol.PerspectiveServer {
|
|
||||||
peerNotAwaitingAddressValidation = true
|
|
||||||
}
|
|
||||||
return &sentPacketHandler{
|
return &sentPacketHandler{
|
||||||
peerNotAwaitingAddressValidation: peerNotAwaitingAddressValidation,
|
peerCompletedAddressValidation: pers == protocol.PerspectiveServer,
|
||||||
initialPackets: newPacketNumberSpace(initialPacketNumber),
|
initialPackets: newPacketNumberSpace(initialPacketNumber),
|
||||||
handshakePackets: newPacketNumberSpace(0),
|
handshakePackets: newPacketNumberSpace(0),
|
||||||
appDataPackets: newPacketNumberSpace(0),
|
appDataPackets: newPacketNumberSpace(0),
|
||||||
@@ -129,7 +125,7 @@ func (h *sentPacketHandler) dropPackets(encLevel protocol.EncryptionLevel) {
|
|||||||
// The server won't await address validation after the handshake is confirmed.
|
// The server won't await address validation after the handshake is confirmed.
|
||||||
// This applies even if we didn't receive an ACK for a Handshake packet.
|
// This applies even if we didn't receive an ACK for a Handshake packet.
|
||||||
if h.perspective == protocol.PerspectiveClient && encLevel == protocol.EncryptionHandshake {
|
if h.perspective == protocol.PerspectiveClient && encLevel == protocol.EncryptionHandshake {
|
||||||
h.peerNotAwaitingAddressValidation = true
|
h.peerCompletedAddressValidation = true
|
||||||
}
|
}
|
||||||
// remove outstanding packets from bytes_in_flight
|
// remove outstanding packets from bytes_in_flight
|
||||||
if encLevel == protocol.EncryptionInitial || encLevel == protocol.EncryptionHandshake {
|
if encLevel == protocol.EncryptionInitial || encLevel == protocol.EncryptionHandshake {
|
||||||
@@ -180,7 +176,7 @@ func (h *sentPacketHandler) SentPacket(packet *Packet) {
|
|||||||
if isAckEliciting {
|
if isAckEliciting {
|
||||||
h.getPacketNumberSpace(packet.EncryptionLevel).history.SentPacket(packet)
|
h.getPacketNumberSpace(packet.EncryptionLevel).history.SentPacket(packet)
|
||||||
}
|
}
|
||||||
if isAckEliciting || !h.peerNotAwaitingAddressValidation {
|
if isAckEliciting || !h.peerCompletedAddressValidation {
|
||||||
h.setLossDetectionTimer()
|
h.setLossDetectionTimer()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -239,9 +235,9 @@ func (h *sentPacketHandler) ReceivedAck(ack *wire.AckFrame, encLevel protocol.En
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Servers complete address validation when a protected packet is received.
|
// Servers complete address validation when a protected packet is received.
|
||||||
if h.perspective == protocol.PerspectiveClient && !h.peerNotAwaitingAddressValidation &&
|
if h.perspective == protocol.PerspectiveClient && !h.peerCompletedAddressValidation &&
|
||||||
(encLevel == protocol.EncryptionHandshake || encLevel == protocol.Encryption1RTT) {
|
(encLevel == protocol.EncryptionHandshake || encLevel == protocol.Encryption1RTT) {
|
||||||
h.peerNotAwaitingAddressValidation = true
|
h.peerCompletedAddressValidation = true
|
||||||
h.logger.Debugf("Peer doesn't await address validation any longer.")
|
h.logger.Debugf("Peer doesn't await address validation any longer.")
|
||||||
// Make sure that the timer is reset, even if this ACK doesn't acknowledge any (ack-eliciting) packets.
|
// Make sure that the timer is reset, even if this ACK doesn't acknowledge any (ack-eliciting) packets.
|
||||||
h.setLossDetectionTimer()
|
h.setLossDetectionTimer()
|
||||||
@@ -422,7 +418,7 @@ func (h *sentPacketHandler) setLossDetectionTimer() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Cancel the alarm if no packets are outstanding
|
// Cancel the alarm if no packets are outstanding
|
||||||
if !h.hasOutstandingPackets() && h.peerNotAwaitingAddressValidation {
|
if !h.hasOutstandingPackets() && h.peerCompletedAddressValidation {
|
||||||
h.logger.Debugf("Canceling loss detection timer. No packets in flight.")
|
h.logger.Debugf("Canceling loss detection timer. No packets in flight.")
|
||||||
h.alarm = time.Time{}
|
h.alarm = time.Time{}
|
||||||
return
|
return
|
||||||
@@ -517,7 +513,7 @@ func (h *sentPacketHandler) OnLossDetectionTimeout() error {
|
|||||||
// setLossDetectionTimer. This doesn't reset the timer in the session though.
|
// setLossDetectionTimer. This doesn't reset the timer in the session though.
|
||||||
// When OnAlarm is called, we therefore need to make sure that there are
|
// When OnAlarm is called, we therefore need to make sure that there are
|
||||||
// actually packets outstanding.
|
// actually packets outstanding.
|
||||||
if h.hasOutstandingPackets() || !h.peerNotAwaitingAddressValidation {
|
if h.hasOutstandingPackets() || !h.peerCompletedAddressValidation {
|
||||||
if err := h.onVerifiedLossDetectionTimeout(); err != nil {
|
if err := h.onVerifiedLossDetectionTimeout(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -750,7 +750,7 @@ var _ = Describe("SentPacketHandler", func() {
|
|||||||
Expect(handler.SendMode()).To(Equal(SendPTOInitial))
|
Expect(handler.SendMode()).To(Equal(SendPTOInitial))
|
||||||
|
|
||||||
// Now receive an ACK for a Handshake packet.
|
// Now receive an ACK for a Handshake packet.
|
||||||
// This tells the client that the server is not awaiting address validation.
|
// This tells the client that the server completed address validation.
|
||||||
handler.SentPacket(handshakePacket(&Packet{PacketNumber: 1}))
|
handler.SentPacket(handshakePacket(&Packet{PacketNumber: 1}))
|
||||||
Expect(handler.ReceivedAck(
|
Expect(handler.ReceivedAck(
|
||||||
&wire.AckFrame{AckRanges: []wire.AckRange{{Smallest: 1, Largest: 1}}},
|
&wire.AckFrame{AckRanges: []wire.AckRange{{Smallest: 1, Largest: 1}}},
|
||||||
|
|||||||
Reference in New Issue
Block a user