aboutsummaryrefslogtreecommitdiffstats
path: root/src/rspamd_proxy.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-11-12 16:55:37 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-11-12 16:55:37 +0000
commite87526230e690ee824f554f99ef0253cfb5670af (patch)
tree23b56ba15e6a99a501a7b61b8b3395f032896e27 /src/rspamd_proxy.c
parentf78412b9f61895d96a99ba49f0ea39d964ba769e (diff)
downloadrspamd-e87526230e690ee824f554f99ef0253cfb5670af.tar.gz
rspamd-e87526230e690ee824f554f99ef0253cfb5670af.zip
[Fix] Fix off-by-one in retries for the proxy
Diffstat (limited to 'src/rspamd_proxy.c')
-rw-r--r--src/rspamd_proxy.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/rspamd_proxy.c b/src/rspamd_proxy.c
index e56b9b16f..fd5b181f8 100644
--- a/src/rspamd_proxy.c
+++ b/src/rspamd_proxy.c
@@ -1517,18 +1517,18 @@ proxy_backend_master_error_handler (struct rspamd_http_connection *conn, GError
struct rspamd_proxy_session *session;
session = bk_conn->s;
+ session->retries ++;
msg_info_session ("abnormally closing connection from backend: %s, error: %e,"
" retries left: %d",
rspamd_inet_address_to_string (
rspamd_upstream_addr_cur (session->master_conn->up)),
err,
session->ctx->max_retries - session->retries);
- session->retries ++;
rspamd_upstream_fail (bk_conn->up, FALSE);
proxy_backend_close_connection (session->master_conn);
- if (session->ctx->max_retries &&
- session->retries > session->ctx->max_retries) {
+ if (session->ctx->max_retries > 0 &&
+ session->retries >= session->ctx->max_retries) {
msg_err_session ("cannot connect to upstream, maximum retries "
"has been reached: %d", session->retries);
/* Terminate session immediately */