Browse Source

Fix maps initialisation

tags/1.2.0
Vsevolod Stakhov 8 years ago
parent
commit
e4d146bfc8
7 changed files with 13 additions and 12 deletions
  1. 1
    1
      src/controller.c
  2. 5
    1
      src/fuzzy_storage.c
  3. 1
    3
      src/http_proxy.c
  4. 2
    2
      src/libutil/map.c
  5. 2
    2
      src/libutil/map.h
  6. 1
    1
      src/lua_worker.c
  7. 1
    2
      src/worker.c

+ 1
- 1
src/controller.c View File

@@ -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);


+ 5
- 1
src/fuzzy_storage.c View File

@@ -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));

+ 1
- 3
src/http_proxy.c View File

@@ -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);

+ 2
- 2
src/libutil/map.c View File

@@ -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;

+ 2
- 2
src/libutil/map.h View File

@@ -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)

+ 1
- 1
src/lua_worker.c View File

@@ -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 ();

+ 1
- 2
src/worker.c View File

@@ -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);

Loading…
Cancel
Save