From: Wouter Wijngaards Date: Tue, 17 Jul 2018 14:56:02 +0000 (+0000) Subject: Fixup cache size test for msg cache. X-Git-Tag: release-1.8.0rc1~93 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5bda4f98221fd4b386cd0deb20a69f293d64036d;p=thirdparty%2Funbound.git Fixup cache size test for msg cache. git-svn-id: file:///svn/unbound/trunk@4789 be551aaa-1e26-0410-a405-d3ace91eadb9 --- diff --git a/daemon/daemon.c b/daemon/daemon.c index 994489e21..b98f18c0c 100644 --- a/daemon/daemon.c +++ b/daemon/daemon.c @@ -804,8 +804,8 @@ void daemon_apply_cfg(struct daemon* daemon, struct config_file* cfg) daemon->cfg = cfg; config_apply(cfg); if(!daemon->env->msg_cache || - cfg->msg_cache_size != slabhash_get_size(daemon->env->msg_cache) || - cfg->msg_cache_slabs != daemon->env->msg_cache->size) { + cfg->msg_cache_slabs != daemon->env->msg_cache->size || + (cfg->msg_cache_size/cfg->msg_cache_slabs)*cfg->msg_cache_slabs != slabhash_get_size(daemon->env->msg_cache)) { slabhash_delete(daemon->env->msg_cache); daemon->env->msg_cache = slabhash_create(cfg->msg_cache_slabs, HASH_DEFAULT_STARTARRAY, cfg->msg_cache_size, diff --git a/libunbound/context.c b/libunbound/context.c index 6ac8086bf..dbe1cfcb0 100644 --- a/libunbound/context.c +++ b/libunbound/context.c @@ -72,8 +72,8 @@ context_finalize(struct ub_ctx* ctx) if(!auth_zones_apply_cfg(ctx->env->auth_zones, cfg, 1)) return UB_INITFAIL; if(!ctx->env->msg_cache || - cfg->msg_cache_size != slabhash_get_size(ctx->env->msg_cache) || - cfg->msg_cache_slabs != ctx->env->msg_cache->size) { + cfg->msg_cache_slabs != ctx->env->msg_cache->size || + (cfg->msg_cache_size/cfg->msg_cache_slabs)*cfg->msg_cache_slabs != slabhash_get_size(ctx->env->msg_cache)) { slabhash_delete(ctx->env->msg_cache); ctx->env->msg_cache = slabhash_create(cfg->msg_cache_slabs, HASH_DEFAULT_STARTARRAY, cfg->msg_cache_size, diff --git a/services/cache/infra.c b/services/cache/infra.c index 6a427d197..2b9b96e87 100644 --- a/services/cache/infra.c +++ b/services/cache/infra.c @@ -302,7 +302,7 @@ infra_adjust(struct infra_cache* infra, struct config_file* cfg) /* divide cachesize by slabs and multiply by slabs, because if the * cachesize is not an even multiple of slabs, that is the resulting * size of the slabhash */ - if(maxmem != slabhash_get_size(infra->hosts) || + if((maxmem/cfg->infra_cache_slabs)*cfg->infra_cache_slabs != slabhash_get_size(infra->hosts) || cfg->infra_cache_slabs != infra->hosts->size || cfg->ratelimit_slabs != infra->domain_rates->size || (cfg->ratelimit_size/cfg->ratelimit_slabs)*cfg->ratelimit_slabs != slabhash_get_size(infra->domain_rates) ||