reactor: reap proxy-pending connections that never send their PROXY header (were never timed out)

This commit is contained in:
Jean Chevronnet 2026-08-17 21:37:18 +00:00
parent de4cf9866d
commit 5522e36125

View file

@ -502,7 +502,7 @@ fn reactor_loop(
let now = Instant::now(); let now = Instant::now();
let mut expired = Vec::new(); let mut expired = Vec::new();
pending_hs.retain(|&(tok, dl)| match conns.get(&tok) { pending_hs.retain(|&(tok, dl)| match conns.get(&tok) {
Some(c) if c.handshaking => { Some(c) if c.handshaking || c.proxy_pending => {
if now >= dl { if now >= dl {
expired.push(tok); expired.push(tok);
false false
@ -510,7 +510,7 @@ fn reactor_loop(
true true
} }
} }
_ => false, // handshake finished, or the conn is already gone _ => false, // handshake/proxy-header done, or the conn is already gone
}); });
for tok in expired { for tok in expired {
close_conn(&mut poll, &mut conns, tok, &core); close_conn(&mut poll, &mut conns, tok, &core);
@ -572,7 +572,10 @@ fn reactor_loop(
pending_out: Some(out), pending_out: Some(out),
}, },
); );
if handshaking { // reap a stalled TLS handshake OR a proxy-pending conn that never
// sends its PROXY header — neither has a uid yet, so nothing else
// would ever time it out.
if handshaking || a.via_proxy {
if let Some(d) = handshake_timeout { if let Some(d) = handshake_timeout {
pending_hs.push((token, Instant::now() + d)); pending_hs.push((token, Instant::now() + d));
} }