Skip to content

[QUIC] Complete PTO timeout loss detection handling #398

Description

@kcenon

Summary

Complete the PTO (Probe Timeout) handling in QUIC loss detection as required by RFC 9002 Section 6.2.

Current State

The connection.cpp:1105 has a TODO comment indicating PTO timeout loss detection is not fully implemented:

// TODO: Handle PTO timeout for loss detection

The loss_detector class has the infrastructure but the integration in connection is incomplete.

RFC 9002 Requirements

Per Section 6.2 (Probe Timeout):

  • When PTO expires, send one or two probe packets
  • Probe packets must be ack-eliciting
  • Increase PTO count on each expiry
  • Reset PTO count when receiving acknowledgments

Implementation Details

Current loss_detector API

class loss_detector {
public:
    [[nodiscard]] auto on_timeout() -> loss_detection_result;
    [[nodiscard]] auto pto_count() const noexcept -> uint32_t;
    auto reset_pto_count() noexcept -> void;
};

Required Changes in connection.cpp

void connection::on_timeout() {
    auto result = loss_detector_.on_timeout();
    
    if (result.event == loss_detection_event::pto_expired) {
        // 1. Generate probe packets
        generate_probe_packets();
        
        // 2. Handle lost packets
        for (const auto& lost : result.lost_packets) {
            retransmit_frames(lost.frames);
        }
        
        // 3. Update congestion controller
        for (const auto& lost : result.lost_packets) {
            congestion_controller_.on_packet_lost(lost);
        }
    }
}

Tasks

  • Implement generate_probe_packets() method
  • Connect on_timeout() with loss detection result handling
  • Retransmit frames from lost packets
  • Update congestion controller on loss
  • Add unit tests for PTO timeout scenarios
  • Add integration tests for packet loss recovery

Acceptance Criteria

  • PTO timeout triggers probe packet generation
  • Lost packets are properly retransmitted
  • Congestion controller is notified of losses
  • PTO count increments correctly
  • Unit tests cover all PTO scenarios
  • No regression in existing QUIC tests

Files to Modify

  • src/protocols/quic/connection.cpp
  • include/kcenon/network/protocols/quic/connection.h
  • tests/test_quic_connection.cpp
  • tests/test_quic_loss_detection.cpp

Related

Metadata

Metadata

Assignees

Labels

asyncAsynchronous operationsbugSomething isn't workingpriority:highHigh priority issue

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions