diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-02-16 17:08:57 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-02-16 17:08:57 +0000 |
commit | e4d146bfc88fdeed63034f7cc85f2602b25163fb (patch) | |
tree | d3a84e44f00fccaa92618c502c11f8c1aecb743b | |
parent | 7a1aac9058a1b5f06d3212f1abf1eae701775a92 (diff) | |
download | rspamd-e4d146bfc88fdeed63034f7cc85f2602b25163fb.tar.gz rspamd-e4d146bfc88fdeed63034f7cc85f2602b25163fb.zip |
Fix maps initialisation
-rw-r--r-- | src/controller.c | 2 | ||||
-rw-r--r-- | src/fuzzy_storage.c | 6 | ||||
-rw-r--r-- | src/http_proxy.c | 4 | ||||
-rw-r--r-- | src/libutil/map.c | 4 | ||||
-rw-r--r-- | src/libutil/map.h | 4 | ||||
-rw-r--r-- | src/lua_worker.c | 2 | ||||
-rw-r--r-- | src/worker.c | 3 |
7 files changed, 13 insertions, 12 deletions
diff --git a/src/controller.c b/src/controller.c index 67f45b7c3..66c2a35f9 100644 --- a/src/controller.c +++ b/src/controller.c @@ -2656,7 +2656,7 @@ start_controller_worker (struct rspamd_worker *worker) rspamd_upstreams_library_config (worker->srv->cfg, worker->srv->cfg->ups_ctx, ctx->ev_base, ctx->resolver->r); /* Maps events */ - rspamd_map_watch (worker->srv->cfg, ctx->ev_base); + rspamd_map_watch (worker->srv->cfg, ctx->ev_base, ctx->resolver); rspamd_symbols_cache_start_refresh (worker->srv->cfg->cache, ctx->ev_base); rspamd_stat_init (worker->srv->cfg, ctx->ev_base); diff --git a/src/fuzzy_storage.c b/src/fuzzy_storage.c index 844198a21..86153f01c 100644 --- a/src/fuzzy_storage.c +++ b/src/fuzzy_storage.c @@ -107,6 +107,7 @@ struct rspamd_fuzzy_storage_ctx { rspamd_lru_hash_t *errors_ips; struct rspamd_fuzzy_backend *backend; GQueue *updates_pending; + struct rspamd_dns_resolver *resolver; }; enum fuzzy_cmd_type { @@ -1401,7 +1402,10 @@ start_fuzzy (struct rspamd_worker *worker) } /* Maps events */ - rspamd_map_watch (worker->srv->cfg, ctx->ev_base); + ctx->resolver = dns_resolver_init (worker->srv->logger, + ctx->ev_base, + worker->srv->cfg); + rspamd_map_watch (worker->srv->cfg, ctx->ev_base, ctx->resolver); /* Get peer pipe */ memset (&srv_cmd, 0, sizeof (srv_cmd)); diff --git a/src/http_proxy.c b/src/http_proxy.c index 5cdd18c70..f0680fcb0 100644 --- a/src/http_proxy.c +++ b/src/http_proxy.c @@ -468,13 +468,11 @@ start_http_proxy (struct rspamd_worker *worker) ctx->ev_base = rspamd_prepare_worker (worker, "http_proxy", proxy_accept_socket); - rspamd_map_watch (worker->srv->cfg, ctx->ev_base); - - ctx->resolver = dns_resolver_init (worker->srv->logger, ctx->ev_base, worker->srv->cfg); double_to_tv (ctx->timeout, &ctx->io_tv); + rspamd_map_watch (worker->srv->cfg, ctx->ev_base, ctx->resolver); rspamd_upstreams_library_config (worker->srv->cfg, ctx->cfg->ups_ctx, ctx->ev_base, ctx->resolver->r); diff --git a/src/libutil/map.c b/src/libutil/map.c index d8b55eeee..7958867b3 100644 --- a/src/libutil/map.c +++ b/src/libutil/map.c @@ -617,8 +617,8 @@ http_callback (gint fd, short what, void *ud) /* Start watching event for all maps */ void rspamd_map_watch (struct rspamd_config *cfg, - struct rspamd_dns_resolver *resolver, - struct event_base *ev_base) + struct event_base *ev_base, + struct rspamd_dns_resolver *resolver) { GList *cur = cfg->maps; struct rspamd_map *map; diff --git a/src/libutil/map.h b/src/libutil/map.h index 80be704e8..26a47abf8 100644 --- a/src/libutil/map.h +++ b/src/libutil/map.h @@ -59,8 +59,8 @@ gboolean rspamd_map_add (struct rspamd_config *cfg, * Start watching of maps by adding events to libevent event loop */ void rspamd_map_watch (struct rspamd_config *cfg, - struct rspamd_dns_resolver *resolver, - struct event_base *ev_base); + struct event_base *ev_base, + struct rspamd_dns_resolver *resolver); /** * Remove all maps watched (remove events) diff --git a/src/lua_worker.c b/src/lua_worker.c index 8f02e12b2..799379c00 100644 --- a/src/lua_worker.c +++ b/src/lua_worker.c @@ -390,7 +390,7 @@ start_lua_worker (struct rspamd_worker *worker) } /* Maps events */ - rspamd_map_watch (worker->srv->cfg, ctx->ev_base); + rspamd_map_watch (worker->srv->cfg, ctx->ev_base, ctx->resolver); event_base_loop (ctx->ev_base, 0); rspamd_worker_block_signals (); diff --git a/src/worker.c b/src/worker.c index 91f570b62..a432060e0 100644 --- a/src/worker.c +++ b/src/worker.c @@ -414,13 +414,12 @@ start_worker (struct rspamd_worker *worker) ctx->ev_base = rspamd_prepare_worker (worker, "normal", accept_socket); msec_to_tv (ctx->timeout, &ctx->io_tv); - - rspamd_map_watch (worker->srv->cfg, ctx->ev_base); rspamd_symbols_cache_start_refresh (worker->srv->cfg->cache, ctx->ev_base); ctx->resolver = dns_resolver_init (worker->srv->logger, ctx->ev_base, worker->srv->cfg); + rspamd_map_watch (worker->srv->cfg, ctx->ev_base, ctx->resolver); rspamd_upstreams_library_config (worker->srv->cfg, ctx->cfg->ups_ctx, ctx->ev_base, ctx->resolver->r); |