Skip to content

Commit d8d9c60

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 c06ccd6 commit d8d9c60

12 files changed

Lines changed: 1165 additions & 22 deletions

File tree

‎quiche/include/quiche.h‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,20 @@ void quiche_config_set_initial_congestion_window_packets(quiche_config *config,
245245
// Recovery probes can bypass the fixed window.
246246
void quiche_config_set_unchecked_congestion_window(quiche_config *config, size_t window);
247247

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

‎quiche/src/ffi.rs‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,25 @@ pub extern "C" fn quiche_config_set_unchecked_congestion_window(
379379
config.set_unchecked_congestion_window(window);
380380
}
381381

382+
#[no_mangle]
383+
pub extern "C" fn quiche_config_set_ack_progress_timeout_millis(
384+
config: &mut Config, millis: u64,
385+
) {
386+
let timeout = match millis {
387+
0 => None,
388+
millis => Some(Duration::from_millis(millis)),
389+
};
390+
391+
config.set_ack_progress_timeout(timeout);
392+
}
393+
394+
#[no_mangle]
395+
pub extern "C" fn quiche_config_set_max_outstanding_sent_packets(
396+
config: &mut Config, max_packets: size_t,
397+
) {
398+
config.set_max_outstanding_sent_packets(max_packets);
399+
}
400+
382401
#[no_mangle]
383402
pub extern "C" fn quiche_config_enable_hystart(config: &mut Config, v: bool) {
384403
config.enable_hystart(v);

0 commit comments

Comments
 (0)