-/* Copyright (c) 2014, Vsevolod Stakhov
+/* Copyright (c) 2014-2015, Vsevolod Stakhov
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
new_task = g_slice_alloc0 (sizeof (struct rspamd_task));
new_task->worker = worker;
- new_task->state = READ_MESSAGE;
+
if (worker) {
new_task->cfg = worker->srv->cfg;
if (new_task->cfg->check_all_filters) {
-/* Copyright (c) 2014, Vsevolod Stakhov
+/* Copyright (c) 2014-2015, Vsevolod Stakhov
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
METRIC_ACTION_MAX
};
+enum rspamd_task_stage {
+ RSPAMD_TASK_STAGE_CONNECT = (1 << 0),
+ RSPAMD_TASK_STAGE_ENVELOPE = (1 << 1),
+ RSPAMD_TASK_STAGE_READ_MESSAGE = (1 << 2),
+ RSPAMD_TASK_STAGE_PRE_FILTERS = (1 << 3),
+ RSPAMD_TASK_STAGE_FILTERS = (1 << 4),
+ RSPAMD_TASK_STAGE_CLASSIFIERS = (1 << 5),
+ RSPAMD_TASK_STAGE_POST_FILTERS = (1 << 6),
+ RSPAMD_TASK_STAGE_WRITE_REPLY = (1 << 7)
+};
+
#define RSPAMD_TASK_FLAG_MIME (1 << 0)
#define RSPAMD_TASK_FLAG_JSON (1 << 1)
#define RSPAMD_TASK_FLAG_SKIP_EXTRA (1 << 2)
struct rspamd_task {
struct rspamd_worker *worker; /**< pointer to worker object */
struct custom_command *custom_cmd; /**< custom command if any */
- enum {
- READ_MESSAGE,
- WAIT_PRE_FILTER,
- WAIT_FILTER,
- WAIT_POST_FILTER,
- WRITE_REPLY,
- WRITING_REPLY,
- CLOSING_CONNECTION
- } state; /**< current session state */
+ guint processed_stages; /**< bits of stages that are processed */
enum rspamd_command cmd; /**< command */
gint sock; /**< socket descriptor */
guint flags; /**< Bit flags */