]> source.dussan.org Git - rspamd.git/commitdiff
Rework task states definition.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 2 Jun 2015 08:39:50 +0000 (09:39 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 2 Jun 2015 14:39:36 +0000 (15:39 +0100)
src/libserver/task.c
src/libserver/task.h

index 4833c083524d3fc1a592c441d1de45a226f6c46c..ba4f0c1bd7526bbe2b97d7049a4c7d14c09052b4 100644 (file)
@@ -1,4 +1,4 @@
-/* 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
@@ -47,7 +47,7 @@ rspamd_task_new (struct rspamd_worker *worker)
        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) {
index 05a50ecdc8dccb896c70d6cfef16ec1507d81050..5ce24176cd7c9240e3631946e6749119e4d4010c 100644 (file)
@@ -1,4 +1,4 @@
-/* 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
@@ -51,6 +51,17 @@ enum rspamd_metric_action {
        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)
@@ -79,15 +90,7 @@ struct custom_command {
 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                                                                          */