commit e875262: [Fix] Fix off-by-one in retries for the proxy
Vsevolod Stakhov
vsevolod at highsecure.ru
Tue Nov 12 16:56:06 UTC 2019
Author: Vsevolod Stakhov
Date: 2019-11-12 16:55:37 +0000
URL: https://github.com/rspamd/rspamd/commit/e87526230e690ee824f554f99ef0253cfb5670af (HEAD -> master)
[Fix] Fix off-by-one in retries for the proxy
---
src/rspamd_proxy.c | 6 +++---
1 file 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 */
More information about the Commits
mailing list