BUG/MINOR: logs: Report the true number of retries if there was no connection
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 16 Apr 2021 09:24:20 +0000 (11:24 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 29 Apr 2021 09:10:14 +0000 (11:10 +0200)
commitf0c0f87427d04f9e713bd89f21eecfd02922800f
tree5db80ed91db18bf8b6253e6929c0bd4daada89d6
parente4f952a4b2c43ff82e55ba124676f501f4baf355
BUG/MINOR: logs: Report the true number of retries if there was no connection

When the session is aborted before any connection attempt to any server, the
number of connection retries reported in the logs is wrong. It happens
because when the retries counter is not strictly positive, we consider the
max number of retries was reached and the backend retries value is used. It
is obviously wrong when no connectioh was performed.

In fact, at this stage, the retries counter is initialized to 0. But the
backend stream-interface is in the INI state. Once it is set to SI_ST_REQ,
the counter is set to the backend value. And it is the only possible state
transition from INI state. Thus it is safe to rely on it to fix the bug.

This patch must be backported to all stable versions.

(cherry picked from commit 1d26f22e0568d6761b1e0a522079b23387bace80)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 5d5d615d891f7e45626be7348f765d31364cd358)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit de754a708ddad51839799ef9b884ae88f826689b)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
src/log.c