rspamd_spf_log_id, "spf", rec->task->task_pool->tag.uid, \
G_STRFUNC, \
__VA_ARGS__)
+#define msg_debug_spf_flatten(...) rspamd_conditional_debug_fast_num_id (NULL, NULL, \
+ rspamd_spf_log_id, "spf", (flat)->digest, \
+ G_STRFUNC, \
+ __VA_ARGS__)
INIT_LOG_MODULE(spf)
spf_lib_ctx = NULL;
}
+static void
+spf_record_cached_unref_dtor (gpointer p)
+{
+ struct spf_resolved *flat = (struct spf_resolved *)p;
+
+ _spf_record_unref (flat, "LRU cache");
+}
+
void
spf_library_config (const ucl_object_t *obj)
{
spf_lib_ctx->spf_hash = rspamd_lru_hash_new (
ival,
NULL,
- (GDestroyNotify) spf_record_unref);
+ spf_record_cached_unref_dtor);
}
}
else {
spf_lib_ctx->spf_hash = rspamd_lru_hash_new (
2048,
NULL,
- (GDestroyNotify) spf_record_unref);
+ spf_record_cached_unref_dtor);
}
}
}
rec->callback (flat, rec->task, rec->cbdata);
- REF_RELEASE (flat);
+ spf_record_unref (flat);
rec->done = TRUE;
}
}
}
struct spf_resolved *
-spf_record_ref (struct spf_resolved *rec)
+_spf_record_ref (struct spf_resolved *flat, const gchar *loc)
{
- REF_RETAIN (rec);
- return rec;
+ msg_debug_spf_flatten ("record ref %s; refcount=%d++", loc, flat->ref.refcount);
+ REF_RETAIN (flat);
+ return flat;
}
void
-spf_record_unref (struct spf_resolved *rec)
+_spf_record_unref (struct spf_resolved *flat, const gchar *loc)
{
- REF_RELEASE (rec);
+ msg_debug_spf_flatten ("record unref %s; refcount=%d--", loc, flat->ref.refcount);
+ REF_RELEASE (flat);
}
gchar *
/*
* Increase refcount
*/
-struct spf_resolved *spf_record_ref (struct spf_resolved *rec);
-
+struct spf_resolved *_spf_record_ref (struct spf_resolved *rec, const gchar *loc);
+#define spf_record_ref(rec) \
+ _spf_record_ref ((rec), G_STRLOC)
/*
* Decrease refcount
*/
-void spf_record_unref (struct spf_resolved *rec);
+void _spf_record_unref (struct spf_resolved *rec, const gchar *loc);
+#define spf_record_unref(rec) \
+ _spf_record_unref((rec), G_STRLOC)
/**
* Prints address + mask in a freshly allocated string (must be freed)