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))];
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);
}
* 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;
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
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);