]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Init resolver in log helper
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 3 Nov 2016 17:48:44 +0000 (17:48 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 4 Nov 2016 14:13:07 +0000 (14:13 +0000)
src/log_helper.c
src/plugins/lua/fann_scores.lua

index 29cb511a3ef5e114a5c4faa176613a1a0057f7e9..467f98f310387b72f117d7f6f1d1ff5112024fa5 100644 (file)
@@ -52,6 +52,7 @@ struct log_helper_ctx {
        struct event_base *ev_base;
        struct event log_ev;
        struct rspamd_worker_lua_script *scripts;
+       struct rspamd_dns_resolver *resolver;
        lua_State *L;
        gint pair[2];
 };
@@ -189,6 +190,11 @@ start_log_helper (struct rspamd_worker *worker)
        ctx->cfg = worker->srv->cfg;
        ctx->scripts = worker->cf->scripts;
        ctx->L = ctx->cfg->lua_state;
+       ctx->resolver = dns_resolver_init (worker->srv->logger,
+                               ctx->ev_base,
+                               worker->srv->cfg);
+       rspamd_upstreams_library_config (worker->srv->cfg, ctx->cfg->ups_ctx,
+                       ctx->ev_base, ctx->resolver->r);
 
        DL_COUNT (worker->cf->scripts, tmp, nscripts);
        msg_info ("started log_helper worker with %d scripts", nscripts);
index 64566e1029e62cf0ed663f8f41c01c0b4d8a0768..0a238db291a405871b7ceb04e65b478c79b10846 100644 (file)
@@ -469,7 +469,6 @@ local function fann_train_callback(score, required_score, results, cf, id, opts,
     if learn_spam then k = 'spam' else k = 'ham' end
 
     local function can_train_cb(err, data)
-      rspamd_logger.errx('hui')
       if not err and tonumber(data) > 0 then
         local learn_data = symbols_to_fann_vector(
           map(function(r) return r[1] end, results),
@@ -494,7 +493,6 @@ local function fann_train_callback(score, required_score, results, cf, id, opts,
       end
     end
 
-    rspamd_logger.errx('pizda: %s %s %s %s', redis_can_train_sha, fname, tostring(max_trains), k)
     redis_make_request(ev_base,
       rspamd_config,
       nil,