- Fixup compile without cachedb.

This commit is contained in:
W.C.A. Wijngaards 2024-04-10 11:33:52 +02:00
parent f3f85e5a11
commit cccf5e73c0
3 changed files with 12 additions and 3 deletions

View file

@ -659,9 +659,12 @@ answer_from_cache(struct worker* worker, struct query_info* qinfo,
if(rep->ttl < timenow) { if(rep->ttl < timenow) {
/* Check if we need to serve expired now */ /* Check if we need to serve expired now */
if(worker->env.cfg->serve_expired && if(worker->env.cfg->serve_expired &&
!worker->env.cfg->serve_expired_client_timeout && !worker->env.cfg->serve_expired_client_timeout
!(worker->env.cachedb_enabled && #ifdef USE_CACHEDB
worker->env.cfg->cachedb_check_when_serve_expired)) { && !(worker->env.cachedb_enabled &&
worker->env.cfg->cachedb_check_when_serve_expired)
#endif
) {
if(worker->env.cfg->serve_expired_ttl && if(worker->env.cfg->serve_expired_ttl &&
rep->serve_expired_ttl < timenow) rep->serve_expired_ttl < timenow)
return 0; return 0;

View file

@ -511,6 +511,7 @@ void mesh_new_client(struct mesh_area* mesh, struct query_info* qinfo,
log_err("mesh_new_client: out of memory initializing serve expired"); log_err("mesh_new_client: out of memory initializing serve expired");
goto servfail_mem; goto servfail_mem;
} }
#ifdef USE_CACHEDB
if(!timeout && mesh->env->cfg->serve_expired && if(!timeout && mesh->env->cfg->serve_expired &&
!mesh->env->cfg->serve_expired_client_timeout && !mesh->env->cfg->serve_expired_client_timeout &&
(mesh->env->cachedb_enabled && (mesh->env->cachedb_enabled &&
@ -520,6 +521,7 @@ void mesh_new_client(struct mesh_area* mesh, struct query_info* qinfo,
goto servfail_mem; goto servfail_mem;
} }
} }
#endif
/* update statistics */ /* update statistics */
if(was_detached) { if(was_detached) {
log_assert(mesh->num_detached_states > 0); log_assert(mesh->num_detached_states > 0);
@ -625,6 +627,7 @@ mesh_new_callback(struct mesh_area* mesh, struct query_info* qinfo,
mesh_state_delete(&s->s); mesh_state_delete(&s->s);
return 0; return 0;
} }
#ifdef USE_CACHEDB
if(!timeout && mesh->env->cfg->serve_expired && if(!timeout && mesh->env->cfg->serve_expired &&
!mesh->env->cfg->serve_expired_client_timeout && !mesh->env->cfg->serve_expired_client_timeout &&
(mesh->env->cachedb_enabled && (mesh->env->cachedb_enabled &&
@ -635,6 +638,7 @@ mesh_new_callback(struct mesh_area* mesh, struct query_info* qinfo,
return 0; return 0;
} }
} }
#endif
/* update statistics */ /* update statistics */
if(was_detached) { if(was_detached) {
log_assert(mesh->num_detached_states > 0); log_assert(mesh->num_detached_states > 0);

View file

@ -537,8 +537,10 @@ struct module_env {
/** EDNS client string information */ /** EDNS client string information */
struct edns_strings* edns_strings; struct edns_strings* edns_strings;
#ifdef USE_CACHEDB
/** the cachedb enabled value, copied and stored here. */ /** the cachedb enabled value, copied and stored here. */
int cachedb_enabled; int cachedb_enabled;
#endif
/* Make every mesh state unique, do not aggregate mesh states. */ /* Make every mesh state unique, do not aggregate mesh states. */
int unique_mesh; int unique_mesh;
}; };