aboutsummaryrefslogtreecommitdiffstats
path: root/src/rspamd_proxy.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-07-18 19:12:10 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-07-18 19:12:10 +0100
commite1e2c7f0b69adfdaa5e36aebb3f1b607e4f6f62a (patch)
treed0067f3bab18332f1dc6f56467730673cf51f89d /src/rspamd_proxy.c
parent6025568b6ee88c8010480ab3d6698fe4969ef054 (diff)
downloadrspamd-e1e2c7f0b69adfdaa5e36aebb3f1b607e4f6f62a.tar.gz
rspamd-e1e2c7f0b69adfdaa5e36aebb3f1b607e4f6f62a.zip
[Fix] Fix some issues with retries in the proxy
Diffstat (limited to 'src/rspamd_proxy.c')
-rw-r--r--src/rspamd_proxy.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/rspamd_proxy.c b/src/rspamd_proxy.c
index a726f8f39..6ee34c918 100644
--- a/src/rspamd_proxy.c
+++ b/src/rspamd_proxy.c
@@ -1055,8 +1055,6 @@ proxy_open_mirror_connections (struct rspamd_proxy_session *session)
continue;
}
- rspamd_http_message_remove_header (msg, "Content-Length");
- rspamd_http_message_remove_header (msg, "Key");
msg->method = HTTP_GET;
if (msg->url->len == 0) {
@@ -1121,9 +1119,11 @@ proxy_backend_master_error_handler (struct rspamd_http_connection *conn, GError
struct rspamd_proxy_session *session;
session = bk_conn->s;
- msg_info_session ("abnormally closing connection from backend: %s, error: %s",
+ msg_info_session ("abnormally closing connection from backend: %s, error: %s,"
+ " retries left: %d",
rspamd_inet_address_to_string (rspamd_upstream_addr (session->master_conn->up)),
- err->message);
+ err->message,
+ session->ctx->max_retries - session->retries);
session->retries ++;
proxy_backend_close_connection (session->master_conn);
@@ -1138,6 +1138,12 @@ proxy_backend_master_error_handler (struct rspamd_http_connection *conn, GError
if (!proxy_send_master_message (session)) {
proxy_client_write_error (session, err->code, err->message);
}
+ else {
+ msg_info_session ("retry connection to: %s"
+ " retries left: %d",
+ rspamd_inet_address_to_string (rspamd_upstream_addr (session->master_conn->up)),
+ session->ctx->max_retries - session->retries);
+ }
}
}
@@ -1211,7 +1217,7 @@ proxy_send_master_message (struct rspamd_proxy_session *session)
goto err;
}
else {
- retry:
+retry:
if (session->ctx->max_retries &&
session->retries > session->ctx->max_retries) {
msg_err_session ("cannot connect to upstream, maximum retries "
@@ -1328,12 +1334,12 @@ proxy_client_finish_handler (struct rspamd_http_connection *conn,
session->client_message = rspamd_http_connection_steal_msg (
session->client_conn);
+ session->shmem_ref = rspamd_http_message_shmem_ref (session->client_message);
rspamd_http_message_remove_header (msg, "Content-Length");
rspamd_http_message_remove_header (msg, "Key");
proxy_open_mirror_connections (session);
rspamd_http_connection_reset (session->client_conn);
- session->shmem_ref = rspamd_http_message_shmem_ref (session->client_message);
proxy_send_master_message (session);
}