@@ -45,12 +45,10 @@ struct rspamd_stat_cache { | |||
gpointer ctx, gboolean learn); | |||
gint (*check)(struct rspamd_task *task, | |||
gboolean is_spam, | |||
gpointer runtime, | |||
gpointer ctx); | |||
gpointer runtime); | |||
gint (*learn)(struct rspamd_task *task, | |||
gboolean is_spam, | |||
gpointer runtime, | |||
gpointer ctx); | |||
gpointer runtime); | |||
void (*close) (gpointer ctx); | |||
gpointer ctx; | |||
}; | |||
@@ -64,12 +62,10 @@ struct rspamd_stat_cache { | |||
gpointer ctx, gboolean learn); \ | |||
gint rspamd_stat_cache_##name##_check (struct rspamd_task *task, \ | |||
gboolean is_spam, \ | |||
gpointer runtime, \ | |||
gpointer ctx); \ | |||
gpointer runtime); \ | |||
gint rspamd_stat_cache_##name##_learn (struct rspamd_task *task, \ | |||
gboolean is_spam, \ | |||
gpointer runtime, \ | |||
gpointer ctx); \ | |||
gpointer runtime); \ | |||
void rspamd_stat_cache_##name##_close (gpointer ctx) | |||
RSPAMD_STAT_CACHE_DEF(sqlite3); |
@@ -306,8 +306,7 @@ rspamd_stat_cache_redis_runtime (struct rspamd_task *task, | |||
gint | |||
rspamd_stat_cache_redis_check (struct rspamd_task *task, | |||
gboolean is_spam, | |||
gpointer runtime, | |||
gpointer c) | |||
gpointer runtime) | |||
{ | |||
struct rspamd_redis_cache_runtime *rt = runtime; | |||
struct timeval tv; | |||
@@ -333,8 +332,7 @@ rspamd_stat_cache_redis_check (struct rspamd_task *task, | |||
gint | |||
rspamd_stat_cache_redis_learn (struct rspamd_task *task, | |||
gboolean is_spam, | |||
gpointer runtime, | |||
gpointer c) | |||
gpointer runtime) | |||
{ | |||
struct rspamd_redis_cache_runtime *rt = runtime; | |||
struct timeval tv; |
@@ -174,16 +174,15 @@ rspamd_stat_cache_sqlite3_runtime (struct rspamd_task *task, | |||
gpointer ctx, gboolean learn) | |||
{ | |||
/* No need of runtime for this type of classifier */ | |||
return NULL; | |||
return ctx; | |||
} | |||
gint | |||
rspamd_stat_cache_sqlite3_check (struct rspamd_task *task, | |||
gboolean is_spam, | |||
gpointer runtime, | |||
gpointer c) | |||
gpointer runtime) | |||
{ | |||
struct rspamd_stat_sqlite3_ctx *ctx = (struct rspamd_stat_sqlite3_ctx *)c; | |||
struct rspamd_stat_sqlite3_ctx *ctx = runtime; | |||
struct mime_text_part *part; | |||
rspamd_cryptobox_hash_state_t st; | |||
rspamd_ftok_t *word; | |||
@@ -243,10 +242,9 @@ rspamd_stat_cache_sqlite3_check (struct rspamd_task *task, | |||
gint | |||
rspamd_stat_cache_sqlite3_learn (struct rspamd_task *task, | |||
gboolean is_spam, | |||
gpointer runtime, | |||
gpointer c) | |||
gpointer runtime) | |||
{ | |||
struct rspamd_stat_sqlite3_ctx *ctx = (struct rspamd_stat_sqlite3_ctx *)c; | |||
struct rspamd_stat_sqlite3_ctx *ctx = runtime; | |||
gboolean unlearn = !!(task->flags & RSPAMD_TASK_FLAG_UNLEARN); | |||
guchar *h; | |||
gint64 flag; |
@@ -391,8 +391,7 @@ rspamd_stat_cache_check (struct rspamd_stat_ctx *st_ctx, | |||
if (cl->cache && cl->cachecf) { | |||
rt = cl->cache->runtime (task, cl->cachecf, FALSE); | |||
learn_res = cl->cache->check (task, spam, | |||
cl->cachecf, rt); | |||
learn_res = cl->cache->check (task, spam, rt); | |||
} | |||
if (learn_res == RSPAMD_LEARN_INGORE) { | |||
@@ -576,7 +575,7 @@ rspamd_stat_backends_post_learn (struct rspamd_stat_ctx *st_ctx, | |||
if (cl->cache) { | |||
cache_run = cl->cache->runtime (task, cl->cachecf, TRUE); | |||
cl->cache->learn (task, spam, cache_run, cl->cachecf); | |||
cl->cache->learn (task, spam, cache_run); | |||
} | |||
for (j = 0; j < cl->statfiles_ids->len; j ++) { |