Skip to content

Commit 81a71f2

Browse files
committed
quiche: add ack progress timeout and outstanding sent packets limit
Close connections whose packets in flight are not acknowledged for too long, or that track too many sent packets. Both limits are configurable.
1 parent b60aff9 commit 81a71f2

12 files changed

Lines changed: 1159 additions & 22 deletions

File tree

‎quiche/include/quiche.h‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,20 @@ int quiche_config_set_cc_algorithm_name(quiche_config *config, const char *algo)
237237
// Sets the initial cwnd for the connection in terms of packet count.
238238
void quiche_config_set_initial_congestion_window_packets(quiche_config *config, size_t packets);
239239

240+
// Sets how long packets can remain in flight without the peer acknowledging any
241+
// new packet, while it keeps sending packets, in milliseconds, before the
242+
// connection is closed with a PROTOCOL_VIOLATION error. The timeout should be
243+
// much larger than the round-trip time. The value 0 disables this timeout,
244+
// default is 30000.
245+
void quiche_config_set_ack_progress_timeout_millis(quiche_config *config, uint64_t millis);
246+
247+
// Sets the number of sent packets that can be tracked for loss detection
248+
// before the connection is closed with a PROTOCOL_VIOLATION error. The limit
249+
// should be much larger than the congestion window, in packets. The value 0
250+
// disables this limit, so the memory used to track sent packets is no longer
251+
// bounded, default is 40000.
252+
void quiche_config_set_max_outstanding_sent_packets(quiche_config *config, size_t max_packets);
253+
240254
enum quiche_cc_algorithm {
241255
QUICHE_CC_RENO = 0,
242256
QUICHE_CC_CUBIC = 1,

‎quiche/src/ffi.rs‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,25 @@ pub extern "C" fn quiche_config_set_initial_congestion_window_packets(
368368
config.set_initial_congestion_window_packets(packets);
369369
}
370370

371+
#[no_mangle]
372+
pub extern "C" fn quiche_config_set_ack_progress_timeout_millis(
373+
config: &mut Config, millis: u64,
374+
) {
375+
let timeout = match millis {
376+
0 => None,
377+
millis => Some(Duration::from_millis(millis)),
378+
};
379+
380+
config.set_ack_progress_timeout(timeout);
381+
}
382+
383+
#[no_mangle]
384+
pub extern "C" fn quiche_config_set_max_outstanding_sent_packets(
385+
config: &mut Config, max_packets: size_t,
386+
) {
387+
config.set_max_outstanding_sent_packets(max_packets);
388+
}
389+
371390
#[no_mangle]
372391
pub extern "C" fn quiche_config_enable_hystart(config: &mut Config, v: bool) {
373392
config.enable_hystart(v);

0 commit comments

Comments
 (0)