]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: stream: Eventually handle stream timeouts when exiting process_stream()
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 27 Feb 2023 15:21:00 +0000 (16:21 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 27 Feb 2023 16:45:45 +0000 (17:45 +0100)
When we exit from process_stream(), if the task is expired, we try to handle
the stream timeouts and we resync the stream-connectors. This avoids a
useless immediate wakeup. It is not really an issue, but it is a small
improvement in edge cases.

src/stream.c

index a8a8816ae6d47a3c961e6d05644560acd14921db..b2428e4a74964db141778aa57c37890d7aa00cad 100644 (file)
@@ -2539,6 +2539,13 @@ struct task *process_stream(struct task *t, void *context, unsigned int state)
 
                t->expire = tick_first(t->expire, s->conn_exp);
 
+               if (unlikely(tick_is_expired(t->expire, now_ms))) {
+                       /* Some events prevented the timeouts to be handled but nothing evolved.
+                          So do it now and resyunc the stconns
+                        */
+                       stream_handle_timeouts(s);
+                       goto resync_stconns;
+               }
 
                s->pending_events &= ~(TASK_WOKEN_TIMER | TASK_WOKEN_RES);
                stream_release_buffers(s);