aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstat/backends/redis_backend.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-02-18 12:58:57 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-02-18 12:58:57 +0000
commit0f32df6f44c75cb9be69618e699fb2972cc7d421 (patch)
treec7be839a23808ac274a0fc5c14c75a55607600ad /src/libstat/backends/redis_backend.c
parentc9d04a923e2a64321df8128aa4efaacdfccbed2f (diff)
downloadrspamd-0f32df6f44c75cb9be69618e699fb2972cc7d421.tar.gz
rspamd-0f32df6f44c75cb9be69618e699fb2972cc7d421.zip
[Fix] Core: Fix address rotation bug
Previously, upstream.get_addr function returned the new address of the upstream. Unfortunately, it was used for printing addresses. It caused the following situation: let's imagine we have A1 and A2 where A1 was initially selected. So the connection was performed to A1: Current addr Selected addr Connect+---------+ A2+------>A1 A1 | +-+Print failure<---+ A1+------>A2 A2 | +----+ +->Mark failure+-------->+ A2 | +----+ But the failure OP as well as log message told about `A2` where the real problem happened with `A1`. This commit adds distinguishing between getting the next and the current address of the upstream resolving this issue.
Diffstat (limited to 'src/libstat/backends/redis_backend.c')
-rw-r--r--src/libstat/backends/redis_backend.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libstat/backends/redis_backend.c b/src/libstat/backends/redis_backend.c
index d7402db98..d54767c12 100644
--- a/src/libstat/backends/redis_backend.c
+++ b/src/libstat/backends/redis_backend.c
@@ -975,7 +975,7 @@ rspamd_redis_async_stat_cb (struct rspamd_stat_async_elt *elt, gpointer d)
0);
g_assert (cbdata->selected != NULL);
- addr = rspamd_upstream_addr (cbdata->selected);
+ addr = rspamd_upstream_addr_next (cbdata->selected);
g_assert (addr != NULL);
if (rspamd_inet_address_get_af (addr) == AF_UNIX) {
@@ -1522,7 +1522,7 @@ rspamd_redis_runtime (struct rspamd_task *task,
rt->stcf = stcf;
rt->redis_object_expanded = object_expanded;
- addr = rspamd_upstream_addr (up);
+ addr = rspamd_upstream_addr_next (up);
g_assert (addr != NULL);
if (rspamd_inet_address_get_af (addr) == AF_UNIX) {
@@ -1693,7 +1693,7 @@ rspamd_redis_learn_tokens (struct rspamd_task *task, GPtrArray *tokens,
}
}
- addr = rspamd_upstream_addr (up);
+ addr = rspamd_upstream_addr_next (up);
g_assert (addr != NULL);
if (rspamd_inet_address_get_af (addr) == AF_UNIX) {