Browse Source

Fix learn errors reporting

tags/1.1.0
Vsevolod Stakhov 8 years ago
parent
commit
42e13bdaa1
4 changed files with 17 additions and 10 deletions
  1. 12
    5
      src/controller.c
  2. 3
    1
      src/libserver/task.c
  3. 0
    4
      src/libstat/stat_process.c
  4. 2
    0
      src/worker.c

+ 12
- 5
src/controller.c View File

@@ -1199,11 +1199,18 @@ rspamd_controller_learn_fin_task (void *ud)
}

if (RSPAMD_TASK_IS_PROCESSED (task)) {
msg_info_session ("<%s> learned message as %s: %s",
rspamd_inet_address_to_string (session->from_addr),
session->is_spam ? "spam" : "ham",
task->message_id);
rspamd_controller_send_string (conn_ent, "{\"success\":true}");
if (task->err) {
rspamd_controller_send_error (conn_ent, task->err->code,
task->err->message);
}
else {
msg_info_session ("<%s> learned message as %s: %s",
rspamd_inet_address_to_string (session->from_addr),
session->is_spam ? "spam" : "ham",
task->message_id);
rspamd_controller_send_string (conn_ent, "{\"success\":true}");
}

return TRUE;
}


+ 3
- 1
src/libserver/task.c View File

@@ -455,7 +455,9 @@ rspamd_task_process (struct rspamd_task *task, guint stages)

case RSPAMD_TASK_STAGE_POST_FILTERS:
rspamd_lua_call_post_filters (task);
rspamd_stat_check_autolearn (task);
if (task->flags & RSPAMD_TASK_FLAG_LEARN_AUTO) {
rspamd_stat_check_autolearn (task);
}
break;

case RSPAMD_TASK_STAGE_LEARN:

+ 0
- 4
src/libstat/stat_process.c View File

@@ -843,10 +843,6 @@ rspamd_stat_check_autolearn (struct rspamd_task *task)
}
}

if (ret) {
task->flags |= RSPAMD_TASK_FLAG_LEARN_AUTO;
}

return ret;
}


+ 2
- 0
src/worker.c View File

@@ -255,6 +255,8 @@ accept_socket (gint fd, short what, void *arg)

worker->srv->stat->connections_count++;
task->resolver = ctx->resolver;
/* TODO: allow to disable autolearn in protocol */
task->flags |= RSPAMD_TASK_FLAG_LEARN_AUTO;

task->http_conn = rspamd_http_connection_new (
rspamd_worker_body_handler,

Loading…
Cancel
Save