]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
Rework bloom hash library to use XXHash.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 18 Feb 2014 18:39:07 +0000 (18:39 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 21 Mar 2014 11:32:13 +0000 (11:32 +0000)
Conflicts:

src/fuzzy_storage.c

src/fuzzy_storage.c

index 9b97cda18634c934386b7f35f997e8efbcfe3fb5..199a94f1178ae12772650b5725e3af0cd6df0254 100644 (file)
@@ -79,7 +79,7 @@ worker_t fuzzy_worker = {
 static GQueue                  *hashes[BUCKETS];
 static GQueue                  *frequent;
 static GHashTable              *static_hash;
-static bloom_filter_t          *bf;
+static rspamd_bloom_filter_t   *bf;
 
 /* Number of cache modifications */
 static guint32                 mods = 0;
@@ -666,7 +666,7 @@ process_write_command (struct fuzzy_cmd *cmd, guint64 time, struct rspamd_fuzzy_
 {
        struct rspamd_fuzzy_node       *h;
 
-       if (rspamd_bloom_check (bf, cmd->hash)) {
+       if (bloom_check (bf, cmd->hash)) {
                if (update_hash (cmd, time, ctx)) {
                        return TRUE;
                }
@@ -1040,6 +1040,12 @@ start_fuzzy (struct rspamd_worker *worker)
        event_base_set (ctx->ev_base, &sev);
        signal_add (&sev, NULL);
 
+       /* Init bloom filter */
+       bf = rspamd_bloom_create (2000000L, RSPAMD_DEFAULT_BLOOM_HASHES);
+       /* Try to read hashes from file */
+       if (!read_hashes_file (worker)) {
+               msg_err ("cannot read hashes file, it can be created after save procedure");
+       }
 
        if (ctx->strict_hash) {
                static_hash = g_hash_table_new_full (rspamd_str_hash, rspamd_str_equal,
@@ -1052,13 +1058,6 @@ start_fuzzy (struct rspamd_worker *worker)
                frequent = g_queue_new ();
        }
 
-       /* Init bloom filter */
-       bf = bloom_create (20000000L, DEFAULT_BLOOM_HASHES);
-       /* Try to read hashes from file */
-       if (!read_hashes_file (worker)) {
-               msg_err ("cannot read hashes file, it can be created after save procedure");
-       }
-
        /* Timer event */
        evtimer_set (&tev, sync_callback, worker);
        event_base_set (ctx->ev_base, &tev);