Skip to content

Commit 96e4bd6

Browse files
committed
lib: set an aggressive draining timeout when closed before established
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.
1 parent 68da664 commit 96e4bd6

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

quiche/src/lib.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -7272,7 +7272,13 @@ impl Connection {
72727272
});
72737273

72747274
let path = self.paths.get_active()?;
7275-
self.draining_timer = Some(now + (path.recovery.pto() * 3));
7275+
7276+
if self.is_established() {
7277+
self.draining_timer = Some(now + (path.recovery.pto() * 3));
7278+
} else {
7279+
// May as well tidy things up immediately.
7280+
self.draining_timer = Some(now);
7281+
}
72767282
},
72777283

72787284
frame::Frame::ApplicationClose { error_code, reason } => {

0 commit comments

Comments
 (0)