diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-12-14 18:28:33 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-12-14 18:28:33 +0000 |
commit | 45384ca0ba44f87a34eb1e1207f6f6b545f457a2 (patch) | |
tree | 5c85d4ecf5fdf77a59ad29f9e9e01d8a3df3f753 /src | |
parent | 2638d55b61fcbc37693d6e00c98ce3f6c8e671f3 (diff) | |
download | rspamd-45384ca0ba44f87a34eb1e1207f6f6b545f457a2.tar.gz rspamd-45384ca0ba44f87a34eb1e1207f6f6b545f457a2.zip |
Fix fuzzy stats
Diffstat (limited to 'src')
-rw-r--r-- | src/fuzzy_storage.c | 4 | ||||
-rw-r--r-- | src/libutil/hash.c | 10 | ||||
-rw-r--r-- | src/libutil/hash.h | 15 |
3 files changed, 16 insertions, 13 deletions
diff --git a/src/fuzzy_storage.c b/src/fuzzy_storage.c index 9bb542df8..4bbb96689 100644 --- a/src/fuzzy_storage.c +++ b/src/fuzzy_storage.c @@ -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); } diff --git a/src/libutil/hash.c b/src/libutil/hash.c index 51cc4207c..845e2fc3f 100644 --- a/src/libutil/hash.c +++ b/src/libutil/hash.c @@ -30,16 +30,6 @@ * 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; diff --git a/src/libutil/hash.h b/src/libutil/hash.h index bb55f2595..62005f9f8 100644 --- a/src/libutil/hash.h +++ b/src/libutil/hash.h @@ -12,6 +12,17 @@ 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); |