#define RSPAMD_MEMPOOL_AVG_WORDS_LEN "avg_words_len"
#define RSPAMD_MEMPOOL_SHORT_WORDS_CNT "short_words_cnt"
#define RSPAMD_MEMPOOL_HEADERS_HASH "headers_hash"
-#define RSPAMD_MEMPOOL_SETTINGS_HASH "settings_hash"
#define RSPAMD_MEMPOOL_MTA_TAG "MTA-Tag"
#define RSPAMD_MEMPOOL_MTA_NAME "MTA-Name"
#define RSPAMD_MEMPOOL_SPF_DOMAIN "spf_domain"
}
IF_HEADER (SETTINGS_ID_HEADER) {
guint64 h;
- guint32 *hp;
msg_debug_protocol ("read settings-id header, value: %V", hv);
h = rspamd_cryptobox_fast_hash_specific (RSPAMD_CRYPTOBOX_XXHASH64,
- hv_tok->begin, hv_tok->len, 0xdeadbabe);
- hp = rspamd_mempool_alloc (task->task_pool, sizeof (*hp));
- memcpy (hp, &h, sizeof (*hp));
- rspamd_mempool_set_variable (task->task_pool,
- RSPAMD_MEMPOOL_SETTINGS_HASH,
- hp, NULL);
+ hv_tok->begin, hv_tok->len, 0x0);
+ /* Take the lower part of hash as LE number */
+ task->settings_id = (guint32)GUINT64_TO_LE (h);
}
break;
case 'u':
ls = g_malloc0 (sz);
/* Handle settings id */
- sid = rspamd_mempool_get_variable (task->task_pool,
- "settings_hash");
+ sid = task->settings_id;
if (sid) {
ls->settings_id = *sid;
*/
struct rspamd_task {
struct rspamd_worker *worker; /**< pointer to worker object */
- guint processed_stages; /**< bits of stages that are processed */
enum rspamd_command cmd; /**< command */
gint sock; /**< socket descriptor */
guint32 flags; /**< Bit flags */
gpointer checkpoint; /**< Opaque checkpoint data */
ucl_object_t *settings; /**< Settings applied to task */
+ guint32 processed_stages; /**< bits of stages that are processed */
+ guint32 settings_id; /**< hashed settings id */
const gchar *classifier; /**< Classifier to learn (if needed) */
struct rspamd_lang_detector *lang_det; /**< Languages detector */
{
LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
- guint32 *hp;
if (task != NULL) {
- hp = rspamd_mempool_get_variable (task->task_pool,
- RSPAMD_MEMPOOL_SETTINGS_HASH);
- if (hp) {
- lua_pushnumber (L, *hp);
+ if (task->settings_id) {
+ lua_pushnumber (L, task->settings_id);
}
else {
lua_pushnil (L);