Allow updates to the recovery config after sending ACK-only packets. (#2351)

This allows in-handshake config overrides to work reliably with multi-packet
handshakes.
This commit is contained in:
Antonio Vicente
2026-02-10 12:27:53 -08:00
committed by GitHub
parent 19e29f340d
commit 2e67e72c8e
2 changed files with 22 additions and 3 deletions
+8 -3
View File
@@ -7452,9 +7452,14 @@ impl<F: BufFactory> Connection<F> {
Ok(_) => (),
Err(Error::Done) => {
// Apply in-handshake configuration from callbacks before any
// packet has been sent.
if self.sent_count == 0 {
// Apply in-handshake configuration from callbacks if the path's
// Recovery module can still be reinitilized.
if self
.paths
.get_active()
.map(|p| p.can_reinit_recovery())
.unwrap_or(false)
{
if ex_data.recovery_config != self.recovery_config {
if let Ok(path) = self.paths.get_active_mut() {
self.recovery_config = ex_data.recovery_config;
+14
View File
@@ -520,6 +520,20 @@ impl Path {
outcome
}
/// Returns true if the path's recovery module hasn't processed any non-ACK
/// packets, and it is still OK to fully reinitialize the recovery module to
/// pickup changes to congestion control config.
pub fn can_reinit_recovery(&self) -> bool {
// The recovery module can be reinitialized until the connection attempts
// to send a packet with inflight data. The congestion
// controller doesn't track anything interesting until inflight
// data is sent. Handshake ACKs may be sent prior to arrival of
// the full ClientHello, but the send of ACK only packets
// shouldn't prevent the reinit of the recovery module.
self.recovery.bytes_in_flight() == 0 &&
self.recovery.bytes_in_flight_duration() == Duration::ZERO
}
pub fn reinit_recovery(
&mut self, recovery_config: &recovery::RecoveryConfig,
) {