aboutsummaryrefslogtreecommitdiffstats
path: root/src/http_proxy.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-11-20 16:17:24 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-11-20 16:17:24 +0000
commit13cb93001a2cb7dbf7db85b25ac22558da4f610b (patch)
tree468ad6403e5649017593b3c8ae960132759a7045 /src/http_proxy.c
parenta42332ca48be149ed950ed9ccaf81d58783a13c9 (diff)
downloadrspamd-13cb93001a2cb7dbf7db85b25ac22558da4f610b.tar.gz
rspamd-13cb93001a2cb7dbf7db85b25ac22558da4f610b.zip
Fix upstreams usage
Diffstat (limited to 'src/http_proxy.c')
-rw-r--r--src/http_proxy.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/http_proxy.c b/src/http_proxy.c
index 85ee1c4bd..a5290de63 100644
--- a/src/http_proxy.c
+++ b/src/http_proxy.c
@@ -63,6 +63,7 @@ struct rspamd_http_upstream {
struct http_proxy_ctx {
gdouble timeout;
struct timeval io_tv;
+ struct rspamd_config *cfg;
/* DNS resolver */
struct rspamd_dns_resolver *resolver;
/* Events base */
@@ -155,7 +156,7 @@ http_proxy_parse_upstream (rspamd_mempool_t *pool,
goto err;
}
- up->u = rspamd_upstreams_create ();
+ up->u = rspamd_upstreams_create (ctx->cfg->ups_ctx);
if (!rspamd_upstreams_from_ucl (up->u, elt, 11333, NULL)) {
g_set_error (err, http_proxy_quark (), 100,
"upstream has bad hosts definition");
@@ -200,6 +201,7 @@ init_http_proxy (struct rspamd_config *cfg)
ctx->timeout = 5.0;
ctx->upstreams = g_hash_table_new (rspamd_strcase_hash, rspamd_strcase_equal);
ctx->rotate_tm = DEFAULT_ROTATION_TIME;
+ ctx->cfg = cfg;
rspamd_rcl_register_worker_option (cfg, type, "timeout",
rspamd_rcl_parse_struct_time, ctx,
@@ -457,8 +459,9 @@ start_http_proxy (struct rspamd_worker *worker)
worker->srv->cfg);
double_to_tv (ctx->timeout, &ctx->io_tv);
- rspamd_upstreams_library_init (ctx->resolver->r, ctx->ev_base);
- rspamd_upstreams_library_config (worker->srv->cfg);
+ ctx->cfg->ups_ctx = rspamd_upstreams_library_init (ctx->resolver->r,
+ ctx->ev_base);
+ rspamd_upstreams_library_config (worker->srv->cfg, ctx->cfg->ups_ctx);
/* XXX: stupid default */
ctx->keys_cache = rspamd_keypair_cache_new (256);