Skip to content

Commit

Permalink
add "dtn" cc
Browse files Browse the repository at this point in the history
  • Loading branch information
kota-yata committed Jul 20, 2024
1 parent c23e692 commit eb5bc9b
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
42 changes: 42 additions & 0 deletions src/aioquic/quic/congestion/dtn.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
from typing import Iterable

from ..packet_builder import QuicSentPacket
from .base import (
K_MINIMUM_WINDOW,
QuicCongestionControl,
QuicRttMonitor,
register_congestion_control,
)

K_LOSS_REDUCTION_FACTOR = 0.5


class DtnCongestionControl(QuicCongestionControl):
"""
DTN congestion control.
"""

def __init__(self, *, max_datagram_size: int) -> None:
super().__init__(max_datagram_size=max_datagram_size)
self._max_datagram_size = max_datagram_size
self._congestion_recovery_start_time = 0.0
self._congestion_stash = 0
self._rtt_monitor = QuicRttMonitor()

def on_packet_acked(self, *, now: float, packet: QuicSentPacket) -> None:
pass

def on_packet_sent(self, *, packet: QuicSentPacket) -> None:
pass

def on_packets_expired(self, *, packets: Iterable[QuicSentPacket]) -> None:
pass

def on_packets_lost(self, *, now: float, packets: Iterable[QuicSentPacket]) -> None:
pass

def on_rtt_measurement(self, *, now: float, rtt: float) -> None:
pass


register_congestion_control("dtn", DtnCongestionControl)
2 changes: 1 addition & 1 deletion src/aioquic/quic/recovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import math
from typing import Any, Callable, Dict, Iterable, List, Optional

from .congestion import cubic, reno # noqa
from .congestion import cubic, reno, dtn # noqa
from .congestion.base import K_GRANULARITY, create_congestion_control
from .logger import QuicLoggerTrace
from .packet_builder import QuicDeliveryState, QuicSentPacket
Expand Down

0 comments on commit eb5bc9b

Please sign in to comment.