CLEANUP: mux-h2: remove the outdated condition to release h2c on timeout

The historical code dealing with timeout was left with a confusing
condition that is always true but always requires some analysis. It
would check if some streams were left pending before deciding to
release the connection. It could indeed be problematic to leave with
no timeout and an active connection!

As Christopher figured, the situation cannot exist because a first
check ensures there's no more h2c via h2c_may_expire(), then a call
to h2_wake_some_streams() will call h2s_wake_one_stream() for each
of the h2s, and all those with no h2c are purged. Thus on return
from h2_wake_some_streams() we're guaranteed to have an empty tree.

Let's just remove the condition and clean up the code.
This commit is contained in:
Willy Tarreau 2026-05-04 11:57:12 +02:00
parent 95ea3c5510
commit 0896ea43fc

View File

@ -5469,6 +5469,8 @@ do_leave:
h2c->task = NULL;
h2c_error(h2c, H2_ERR_NO_ERROR);
/* here we don't have any h2c left, let's kill all h2c-less streams */
h2_wake_some_streams(h2c, 0);
if (br_data(h2c->mbuf)) {
@ -5515,11 +5517,8 @@ do_leave:
HA_SPIN_UNLOCK(IDLE_CONNS_LOCK, &idle_conns[tid].idle_conns_lock);
}
/* either we can release everything now or it will be done later once
* the last stream closes.
*/
if (eb_is_empty(&h2c->streams_by_id))
h2_release(h2c);
/* now we're done */
h2_release(h2c);
TRACE_LEAVE(H2_EV_H2C_WAKE);
return NULL;