Skip to content

Commit

Permalink
lib: set an aggressive draining timeout when closed before established
Browse files Browse the repository at this point in the history
It is possible that a server could close a connection without ever sending
an ACK frame. For example, when immeditaly closing a connection due to a
TLS-level reason.

Previously, we always would set the draining timer the same way when processing
CONNECTION_CLOSE frames, basing it on 3*PTO. In the situation where there
is no accurate RTT estimate, the PTO is based on the default initial RTT,
which comes out at 999ms. This leads to clients that honor the draining
period to have to wait 3 seconds for no real reason.

With this change, in the situation where a CONNECTION_CLOSE is received
before the connection is established, we'll just immediately timeout.
  • Loading branch information
LPardue committed Apr 8, 2024
1 parent 098664e commit e1c6d03
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion quiche/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7262,7 +7262,13 @@ impl Connection {
});

let path = self.paths.get_active()?;
self.draining_timer = Some(now + (path.recovery.pto() * 3));

if self.is_established() {
self.draining_timer = Some(now + (path.recovery.pto() * 3));
} else {
// May as well tidy things up immediately.
self.draining_timer = Some(now);
}
},

frame::Frame::ApplicationClose { error_code, reason } => {
Expand Down

0 comments on commit e1c6d03

Please sign in to comment.