]> source.dussan.org Git - rspamd.git/commitdiff
Fix fuzzy stats
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 14 Dec 2015 18:28:33 +0000 (18:28 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 14 Dec 2015 18:28:33 +0000 (18:28 +0000)
src/fuzzy_storage.c
src/libutil/hash.c
src/libutil/hash.h

index 9bb542df874fe0110069015768efb769a9ac3628..4bbb96689bdd704595c664664060483c9f816861 100644 (file)
@@ -791,6 +791,7 @@ rspamd_fuzzy_storage_stat (struct rspamd_main *rspamd_main,
        GHashTable *ip_hash;
        struct fuzzy_key_stat *key_stat;
        struct rspamd_http_keypair *kp;
+       rspamd_lru_element_t *lru_elt;
        ucl_object_t *obj, *elt, *ip_elt, *ip_cur;
        struct ucl_emitter_functions *emit_subr;
        guchar fdspace[CMSG_SPACE(sizeof (int))];
@@ -836,7 +837,8 @@ rspamd_fuzzy_storage_stat (struct rspamd_main *rspamd_main,
                                                ip_elt = ucl_object_typed_new (UCL_OBJECT);
 
                                                while (g_hash_table_iter_next (&ip_it, &k, &v)) {
-                                                       ip_cur = rspamd_fuzzy_storage_stat_key (v);
+                                                       lru_elt = v;
+                                                       ip_cur = rspamd_fuzzy_storage_stat_key (lru_elt->data);
                                                        ucl_object_insert_key (ip_elt, ip_cur,
                                                                        rspamd_inet_address_to_string (k), 0, true);
                                                }
index 51cc4207cb3a8fce6295d7d0d44d16f04d5d29d0..845e2fc3ff90c1d91756f03947b29e38657eeb93 100644 (file)
  * LRU hashing
  */
 
-typedef struct rspamd_lru_element_s {
-       gpointer data;
-       gpointer key;
-       time_t store_time;
-       guint ttl;
-       rspamd_lru_hash_t *hash;
-       GList *link;
-
-} rspamd_lru_element_t;
-
 struct rspamd_lru_hash_s {
        gint maxsize;
        gint maxage;
index bb55f2595251a8491fa0474b562176b6801a51dc..62005f9f8fb26f7ff9cbb3507d41bbd4338488c3 100644 (file)
 struct rspamd_lru_hash_s;
 typedef struct rspamd_lru_hash_s rspamd_lru_hash_t;
 
+typedef struct rspamd_lru_element_s {
+       gpointer data;
+       gpointer key;
+       time_t store_time;
+       guint ttl;
+       rspamd_lru_hash_t *hash;
+       GList *link;
+
+} rspamd_lru_element_t;
+
+
 /**
  * Create new lru hash
  * @param maxsize maximum elements in a hash
@@ -72,13 +83,13 @@ void rspamd_lru_hash_insert (rspamd_lru_hash_t *hash,
 void rspamd_lru_hash_destroy (rspamd_lru_hash_t *hash);
 
 /**
- * Get hash table for this lru hash
+ * Get hash table for this lru hash (use rspamd_lru_element_t as data)
  */
 GHashTable *rspamd_lru_hash_get_htable (rspamd_lru_hash_t *hash);
 
 
 /**
- * Get expire queue for this lru hash
+ * Get expire queue for this lru hash (use rspamd_lru_element_t as data)
  */
 GQueue *rspamd_lru_hash_get_queue (rspamd_lru_hash_t *hash);