Skip to content

Commit 6820b9b

Browse files
committed
MEDIUM: h2: implement active connection reversal
Implement active reverse on h2_conn_reverse(). Only minimal steps are done here : HTTP version session counters are incremented on the listener instance. Also, the connection is inserted in the mux_stopping_list to ensure it will be actively closed on process shutdown/listener suspend.
1 parent b130f8d commit 6820b9b

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

src/mux_h2.c

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3220,6 +3220,9 @@ static int h2_frame_check_vs_state(struct h2c *h2c, struct h2s *h2s)
32203220
* passive reversal. Timeouts are inverted and H2_CF_IS_BACK is set or unset
32213221
* depending on the reversal direction.
32223222
*
3223+
* For active reversal, only minor steps are required. The connection should
3224+
* then be accepted by its listener before being able to use it for transfers.
3225+
*
32233226
* For passive reversal, connection is inserted in its targetted server idle
32243227
* pool. It can thus be reused immediately for future transfers on this server.
32253228
*
@@ -3257,7 +3260,23 @@ static int h2_conn_reverse(struct h2c *h2c)
32573260
srv_add_to_idle_list(srv, conn, 1);
32583261
}
32593262
else {
3260-
/* TODO */
3263+
struct listener *l = __objt_listener(h2c->conn->target);
3264+
struct proxy *prx = l->bind_conf->frontend;
3265+
3266+
h2c->flags &= ~H2_CF_IS_BACK;
3267+
3268+
h2c->shut_timeout = h2c->timeout = prx->timeout.client;
3269+
if (tick_isset(prx->timeout.clientfin))
3270+
h2c->shut_timeout = prx->timeout.clientfin;
3271+
3272+
h2c->px_counters = EXTRA_COUNTERS_GET(prx->extra_counters_fe,
3273+
&h2_stats_module);
3274+
3275+
proxy_inc_fe_cum_sess_ver_ctr(l, prx, 2);
3276+
3277+
BUG_ON(LIST_INLIST(&h2c->conn->stopping_list));
3278+
LIST_APPEND(&mux_stopping_data[tid].list,
3279+
&h2c->conn->stopping_list);
32613280
}
32623281

32633282
h2c->task->expire = tick_add(now_ms, h2c->timeout);

0 commit comments

Comments
 (0)