mirror of
https://github.com/haproxy/haproxy.git
synced 2026-04-22 14:49:45 -04:00
MINOR: mux-h2: handle idle-ping on conn reverse
This commit extends MUX H2 connection reversal step to properly take into account the new idle-ping feature. It first ensures that h2c task is properly instantiated/freed depending now on both timers and idle-ping configuration. Also, h2c_update_timeout() is now called instead of manually requeuing the task, which ensures the proper timer value is selected depending on the new connection side.
This commit is contained in:
parent
cc5a7a760f
commit
bd1d02e2b3
2 changed files with 13 additions and 6 deletions
|
|
@ -17633,6 +17633,10 @@ idle-ping <delay>
|
|||
This feature relies on specific underlying protocol support. For now, only H2
|
||||
mux implements it. Idle-ping is simply ignored by other protocols.
|
||||
|
||||
This option is particularly useful when using reverse HTTP. Setting it on the
|
||||
bind line is useful for the peer which is responsible to actively initiate
|
||||
connections and will then receive incoming traffic through them.
|
||||
|
||||
interface <interface>
|
||||
Restricts the socket to a specific interface. When specified, only packets
|
||||
received from that particular interface are processed by the socket. This is
|
||||
|
|
@ -18663,6 +18667,11 @@ idle-ping <delay>
|
|||
This feature relies on specific underlying protocol support. For now, only H2
|
||||
mux implements it. Idle-ping is simply ignored by other protocols.
|
||||
|
||||
This option is particularly useful when using reverse HTTP. Setting it on the
|
||||
server line is useful for the peer which listen for incoming connections and
|
||||
attach them to a corresponding server to be able to reuse later on traffic
|
||||
forwarding.
|
||||
|
||||
init-addr {last | libc | none | <ip>},[...]*
|
||||
May be used in the following contexts: tcp, http, log
|
||||
|
||||
|
|
|
|||
10
src/mux_h2.c
10
src/mux_h2.c
|
|
@ -4096,7 +4096,7 @@ static int h2_conn_reverse(struct h2c *h2c)
|
|||
/* If only the new side has a defined timeout, task must be allocated.
|
||||
* On the contrary, if only old side has a timeout, it must be freed.
|
||||
*/
|
||||
if (!h2c->task && tick_isset(h2c->timeout)) {
|
||||
if (!h2c->task && (tick_isset(h2c->timeout) || tick_isset(conn_idle_ping(conn)))) {
|
||||
h2c->task = task_new_here();
|
||||
if (!h2c->task)
|
||||
goto err;
|
||||
|
|
@ -4104,16 +4104,14 @@ static int h2_conn_reverse(struct h2c *h2c)
|
|||
h2c->task->process = h2_timeout_task;
|
||||
h2c->task->context = h2c;
|
||||
}
|
||||
else if (!tick_isset(h2c->timeout)) {
|
||||
else if (!tick_isset(h2c->timeout) && !tick_isset(conn_idle_ping(conn))) {
|
||||
task_destroy(h2c->task);
|
||||
h2c->task = NULL;
|
||||
}
|
||||
|
||||
/* Requeue task if instantiated with the new timeout value. */
|
||||
if (h2c->task) {
|
||||
h2c->task->expire = tick_add(now_ms, h2c->timeout);
|
||||
task_queue(h2c->task);
|
||||
}
|
||||
if (h2c->task)
|
||||
h2c_update_timeout(h2c);
|
||||
|
||||
TRACE_LEAVE(H2_EV_H2C_WAKE, h2c->conn);
|
||||
return 1;
|
||||
|
|
|
|||
Loading…
Reference in a new issue