commit d538b9d: [Fix] Select a different upstream on last retransmit
Vsevolod Stakhov
vsevolod at highsecure.ru
Tue Dec 10 10:56:06 UTC 2019
Author: Vsevolod Stakhov
Date: 2019-12-10 10:49:22 +0000
URL: https://github.com/rspamd/rspamd/commit/d538b9d97f80d7ad86d982deca44172a7b7f8c94 (HEAD -> master)
[Fix] Select a different upstream on last retransmit
Issue: #3182
---
src/rspamd_proxy.c | 21 +++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
diff --git a/src/rspamd_proxy.c b/src/rspamd_proxy.c
index 6cc2e592d..2a0cadbf1 100644
--- a/src/rspamd_proxy.c
+++ b/src/rspamd_proxy.c
@@ -1872,8 +1872,25 @@ retry:
goto err;
}
- session->master_conn->up = rspamd_upstream_get (backend->u,
- RSPAMD_UPSTREAM_ROUND_ROBIN, NULL, 0);
+ /* Provide hash key if hashing based on source address is desired */
+ guint hash_len;
+ gpointer hash_key = rspamd_inet_address_get_hash_key (session->client_addr,
+ &hash_len);
+
+ if (session->ctx->max_retries > 1 &&
+ session->retries == session->ctx->max_retries) {
+
+ session->master_conn->up = rspamd_upstream_get_except (backend->u,
+ session->master_conn->up,
+ RSPAMD_UPSTREAM_ROUND_ROBIN,
+ hash_key, hash_len);
+ }
+ else {
+ session->master_conn->up = rspamd_upstream_get (backend->u,
+ RSPAMD_UPSTREAM_ROUND_ROBIN,
+ hash_key, hash_len);
+ }
+
session->master_conn->timeout = backend->timeout;
if (session->master_conn->up == NULL) {
More information about the Commits
mailing list