Skip to content

Commit

Permalink
[Minor] Write SPF digest even if it is not cached
Browse files Browse the repository at this point in the history
  • Loading branch information
vstakhov committed Nov 22, 2021
1 parent 4234ed5 commit e9f8d4f
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/libserver/spf.c
Expand Up @@ -607,6 +607,7 @@ rspamd_spf_maybe_return (struct spf_record *rec)
{
struct spf_resolved *flat;
struct rspamd_task *task = rec->task;
bool cached = false;

if (rec->requests_inflight == 0 && !rec->done) {
flat = rspamd_spf_record_flatten (rec);
Expand All @@ -620,16 +621,26 @@ rspamd_spf_maybe_return (struct spf_record *rec)
spf_record_ref (flat),
flat->timestamp, flat->ttl);

msg_info_task ("stored record for %s (0x%xuL) in LRU cache for %d seconds, "
msg_info_task ("stored SPF record for %s (0x%xuL) in LRU cache for %d seconds, "
"%d/%d elements in the cache",
flat->domain,
flat->digest,
flat->ttl,
rspamd_lru_hash_size (spf_lib_ctx->spf_hash),
rspamd_lru_hash_capacity (spf_lib_ctx->spf_hash));
cached = true;
}
}

if (!cached) {
/* Still write a log line */
msg_info_task ("not stored SPF record for %s (0x%xuL) in LRU cache; flags=%d; ttl=%d",
flat->domain,
flat->digest,
flat->flags,
flat->ttl);
}

rec->callback (flat, rec->task, rec->cbdata);
spf_record_unref (flat);
rec->done = TRUE;
Expand Down

0 comments on commit e9f8d4f

Please sign in to comment.