aboutsummaryrefslogtreecommitdiffstats
path: root/src/libutil/upstream.h
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/libutil/upstream.h
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/libutil/upstream.h')
-rw-r--r--src/libutil/upstream.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/libutil/upstream.h b/src/libutil/upstream.h
index 5c0c92afc..4db962765 100644
--- a/src/libutil/upstream.h
+++ b/src/libutil/upstream.h
@@ -208,11 +208,18 @@ void rspamd_upstreams_add_watch_callback (struct upstream_list *ups,
gpointer ud);
/**
+ * Returns the next IP address of the upstream (internal rotation)
+ * @param up
+ * @return
+ */
+rspamd_inet_addr_t* rspamd_upstream_addr_next (struct upstream *up);
+
+/**
* Returns the current IP address of the upstream
* @param up
* @return
*/
-rspamd_inet_addr_t* rspamd_upstream_addr (struct upstream *up);
+rspamd_inet_addr_t* rspamd_upstream_addr_cur (const struct upstream *up);
/**
* Add custom address for an upstream (ownership of addr is transferred to upstream)