diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-11-21 13:31:26 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-11-21 13:31:26 +0000 |
commit | f3ac40859446c3f6829d52cfd0ae8066e5b5b2c8 (patch) | |
tree | 9eebef9b8f6dc2a2157cbd53170f6bd696ca6a01 /src | |
parent | 19fdaf580a3746442173f10da662629bdc1b62b9 (diff) | |
download | rspamd-f3ac40859446c3f6829d52cfd0ae8066e5b5b2c8.tar.gz rspamd-f3ac40859446c3f6829d52cfd0ae8066e5b5b2c8.zip |
Use new rotation logic in the code
Diffstat (limited to 'src')
-rw-r--r-- | src/http_proxy.c | 3 | ||||
-rw-r--r-- | src/libmime/smtp_utils.c | 2 | ||||
-rw-r--r-- | src/libstat/backends/redis.c | 10 | ||||
-rw-r--r-- | src/lua/lua_upstream.c | 6 | ||||
-rw-r--r-- | src/plugins/fuzzy_check.c | 5 | ||||
-rw-r--r-- | src/plugins/surbl.c | 2 | ||||
-rw-r--r-- | src/smtp_proxy.c | 2 |
7 files changed, 20 insertions, 10 deletions
diff --git a/src/http_proxy.c b/src/http_proxy.c index c35c02bd1..43cacae9c 100644 --- a/src/http_proxy.c +++ b/src/http_proxy.c @@ -322,7 +322,8 @@ proxy_client_finish_handler (struct rspamd_http_connection *conn, goto err; } else { - session->up = rspamd_upstream_get (backend->u, RSPAMD_UPSTREAM_ROUND_ROBIN); + session->up = rspamd_upstream_get (backend->u, + RSPAMD_UPSTREAM_ROUND_ROBIN, NULL, 0); if (session->up == NULL) { msg_err ("cannot select upstream for %s", host ? hostbuf : "default"); diff --git a/src/libmime/smtp_utils.c b/src/libmime/smtp_utils.c index 33750bae5..ce7ac72fa 100644 --- a/src/libmime/smtp_utils.c +++ b/src/libmime/smtp_utils.c @@ -64,7 +64,7 @@ create_smtp_upstream_connection (struct smtp_session *session) /* Try to select upstream */ selected = rspamd_upstream_get (session->ctx->upstreams, - RSPAMD_UPSTREAM_ROUND_ROBIN); + RSPAMD_UPSTREAM_ROUND_ROBIN, NULL, 0); if (selected == NULL) { msg_err ("no upstreams suitable found"); return FALSE; diff --git a/src/libstat/backends/redis.c b/src/libstat/backends/redis.c index 66bad4471..b5194065a 100644 --- a/src/libstat/backends/redis.c +++ b/src/libstat/backends/redis.c @@ -398,10 +398,16 @@ rspamd_redis_runtime (struct rspamd_task *task, } if (learn) { - up = rspamd_upstream_get (elt->write_servers, RSPAMD_UPSTREAM_MASTER_SLAVE); + up = rspamd_upstream_get (elt->write_servers, + RSPAMD_UPSTREAM_MASTER_SLAVE, + NULL, + 0); } else { - up = rspamd_upstream_get (elt->read_servers, RSPAMD_UPSTREAM_ROUND_ROBIN); + up = rspamd_upstream_get (elt->read_servers, + RSPAMD_UPSTREAM_ROUND_ROBIN, + NULL, + 0); } if (up == NULL) { diff --git a/src/lua/lua_upstream.c b/src/lua/lua_upstream.c index 8ceadcc8c..18a6069ac 100644 --- a/src/lua/lua_upstream.c +++ b/src/lua/lua_upstream.c @@ -274,7 +274,7 @@ lua_upstream_list_get_upstream_round_robin (lua_State *L) upl = lua_check_upstream_list (L); if (upl) { - selected = rspamd_upstream_get (upl, RSPAMD_UPSTREAM_ROUND_ROBIN); + selected = rspamd_upstream_get (upl, RSPAMD_UPSTREAM_ROUND_ROBIN, NULL, 0); if (selected) { pselected = lua_newuserdata (L, sizeof (struct upstream *)); rspamd_lua_setclass (L, "rspamd{upstream}", -1); @@ -305,7 +305,9 @@ lua_upstream_list_get_upstream_master_slave (lua_State *L) upl = lua_check_upstream_list (L); if (upl) { - selected = rspamd_upstream_get (upl, RSPAMD_UPSTREAM_MASTER_SLAVE); + selected = rspamd_upstream_get (upl, RSPAMD_UPSTREAM_MASTER_SLAVE, + NULL, + 0); if (selected) { pselected = lua_newuserdata (L, sizeof (struct upstream *)); rspamd_lua_setclass (L, "rspamd{upstream}", -1); diff --git a/src/plugins/fuzzy_check.c b/src/plugins/fuzzy_check.c index c6db5e016..7e03009f9 100644 --- a/src/plugins/fuzzy_check.c +++ b/src/plugins/fuzzy_check.c @@ -1347,7 +1347,8 @@ register_fuzzy_client_call (struct rspamd_task *task, gint sock; /* Get upstream */ - selected = rspamd_upstream_get (rule->servers, RSPAMD_UPSTREAM_ROUND_ROBIN); + selected = rspamd_upstream_get (rule->servers, RSPAMD_UPSTREAM_ROUND_ROBIN, + NULL, 0); if (selected) { if ((sock = rspamd_inet_address_connect (rspamd_upstream_addr (selected), SOCK_DGRAM, TRUE)) == -1) { @@ -1434,7 +1435,7 @@ register_fuzzy_controller_call (struct rspamd_http_connection_entry *entry, /* Get upstream */ while ((selected = rspamd_upstream_get (rule->servers, - RSPAMD_UPSTREAM_SEQUENTIAL))) { + RSPAMD_UPSTREAM_SEQUENTIAL, NULL, 0))) { /* Create UDP socket */ if ((sock = rspamd_inet_address_connect (rspamd_upstream_addr (selected), SOCK_DGRAM, TRUE)) == -1) { diff --git a/src/plugins/surbl.c b/src/plugins/surbl.c index c53fc00bd..e624ce6dd 100644 --- a/src/plugins/surbl.c +++ b/src/plugins/surbl.c @@ -1047,7 +1047,7 @@ register_redirector_call (struct rspamd_url *url, struct rspamd_task *task, struct rspamd_http_message *msg; selected = rspamd_upstream_get (surbl_module_ctx->redirectors, - RSPAMD_UPSTREAM_ROUND_ROBIN); + RSPAMD_UPSTREAM_ROUND_ROBIN, url->host, url->hostlen); if (selected) { s = rspamd_inet_address_connect (rspamd_upstream_addr (selected), diff --git a/src/smtp_proxy.c b/src/smtp_proxy.c index 74c1da4c7..9c5364f1e 100644 --- a/src/smtp_proxy.c +++ b/src/smtp_proxy.c @@ -427,7 +427,7 @@ create_smtp_proxy_upstream_connection (struct smtp_proxy_session *session) /* Try to select upstream */ selected = rspamd_upstream_get (session->ctx->upstreams, - RSPAMD_UPSTREAM_ROUND_ROBIN); + RSPAMD_UPSTREAM_ROUND_ROBIN, NULL, 0); if (selected == NULL) { msg_err ("no upstreams suitable found"); return FALSE; |