@@ -405,6 +405,7 @@ struct rspamd_config { | |||
gchar *log_format_str; /**< raw log format string */ | |||
struct rspamd_external_libs_ctx *libs_ctx; /**< context for external libraries */ | |||
struct rspamd_monitored_ctx *monitored_ctx; /**< context for monitored resources */ | |||
struct rspamd_re_cache *re_cache; /**< static regexp cache */ | |||
@@ -27,6 +27,7 @@ | |||
#include "stat_api.h" | |||
#include "unix-std.h" | |||
#include "libutil/multipattern.h" | |||
#include "monitored.h" | |||
#include <math.h> | |||
#define DEFAULT_SCORE 10.0 | |||
@@ -164,6 +165,7 @@ rspamd_config_new (void) | |||
cfg->ssl_ciphers = "HIGH:!aNULL:!kRSA:!PSK:!SRP:!MD5:!RC4"; | |||
cfg->max_message = DEFAULT_MAX_MESSAGE; | |||
cfg->monitored_ctx = rspamd_monitored_ctx_init (); | |||
REF_INIT_RETAIN (cfg, rspamd_config_free); | |||
@@ -232,6 +234,10 @@ rspamd_config_free (struct rspamd_config *cfg) | |||
g_slice_free1 (sizeof (*sc), sc); | |||
} | |||
if (cfg->monitored_ctx) { | |||
rspamd_monitored_ctx_destroy (cfg->monitored_ctx); | |||
} | |||
g_list_free (cfg->classifiers); | |||
g_list_free (cfg->metrics_list); | |||
rspamd_symbols_cache_destroy (cfg->cache); |
@@ -197,7 +197,8 @@ rspamd_monitored_dns_cb (struct rdns_reply *reply, void *arg) | |||
struct rspamd_monitored *m; | |||
m = conf->m; | |||
msg_debug_mon ("dns callback for %s: %s", m->url, | |||
rdns_strerror (reply->code)); | |||
if (reply->code == RDNS_RC_TIMEOUT) { | |||
rspamd_monitored_propagate_error (m, "timeout"); |
@@ -35,6 +35,7 @@ | |||
#include "worker_private.h" | |||
#include "utlist.h" | |||
#include "libutil/http_private.h" | |||
#include "monitored.h" | |||
#include "lua/lua_common.h" | |||
@@ -586,6 +587,8 @@ start_worker (struct rspamd_worker *worker) | |||
rspamd_upstreams_library_config (worker->srv->cfg, ctx->cfg->ups_ctx, | |||
ctx->ev_base, ctx->resolver->r); | |||
rspamd_monitored_ctx_config (worker->srv->cfg->monitored_ctx, | |||
worker->srv->cfg, ctx->ev_base, ctx->resolver->r); | |||
/* XXX: stupid default */ | |||
ctx->keys_cache = rspamd_keypair_cache_new (256); |