From 50934d4ce75b1f929600c08949fb1b6c83e70af6 Mon Sep 17 00:00:00 2001 From: Wouter Wijngaards Date: Tue, 10 Sep 2013 08:46:33 +0000 Subject: [PATCH] more time_t. git-svn-id: file:///svn/unbound/trunk@2951 be551aaa-1e26-0410-a405-d3ace91eadb9 --- doc/Changelog | 3 +++ util/config_file.c | 8 ++++---- util/data/msgparse.h | 4 ++-- util/data/msgreply.c | 4 ++-- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/doc/Changelog b/doc/Changelog index 286095dac..7d4336e24 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,3 +1,6 @@ +10 Sep 2013: Wouter + - MIN_TTL and MAX_TTL also in time_t. + 26 Aug 2013: Wouter - More fixes for bug#519: for the threaded case test if the bg thread has been killed, on ub_ctx_delete, to avoid hangs. diff --git a/util/config_file.c b/util/config_file.c index 62510516b..1e0bd72df 100644 --- a/util/config_file.c +++ b/util/config_file.c @@ -366,9 +366,9 @@ int config_set_option(struct config_file* cfg, const char* opt, else S_YNO("prefetch:", prefetch) else S_YNO("prefetch-key:", prefetch_key) else if(strcmp(opt, "cache-max-ttl:") == 0) - { IS_NUMBER_OR_ZERO; cfg->max_ttl = atoi(val); MAX_TTL=(uint32_t)cfg->max_ttl;} + { IS_NUMBER_OR_ZERO; cfg->max_ttl = atoi(val); MAX_TTL=(time_t)cfg->max_ttl;} else if(strcmp(opt, "cache-min-ttl:") == 0) - { IS_NUMBER_OR_ZERO; cfg->min_ttl = atoi(val); MIN_TTL=(uint32_t)cfg->min_ttl;} + { IS_NUMBER_OR_ZERO; cfg->min_ttl = atoi(val); MIN_TTL=(time_t)cfg->min_ttl;} else S_NUMBER_OR_ZERO("infra-host-ttl:", host_ttl) else S_POW2("infra-cache-slabs:", infra_cache_slabs) else S_SIZET_NONZERO("infra-cache-numhosts:", infra_cache_numhosts) @@ -1171,8 +1171,8 @@ cfg_parse_memsize(const char* str, size_t* res) void config_apply(struct config_file* config) { - MAX_TTL = (uint32_t)config->max_ttl; - MIN_TTL = (uint32_t)config->min_ttl; + MAX_TTL = (time_t)config->max_ttl; + MIN_TTL = (time_t)config->min_ttl; EDNS_ADVERTISED_SIZE = (uint16_t)config->edns_buffer_size; MINIMAL_RESPONSES = config->minimal_responses; RRSET_ROUNDROBIN = config->rrset_roundrobin; diff --git a/util/data/msgparse.h b/util/data/msgparse.h index 830d68e16..83d2aaaa6 100644 --- a/util/data/msgparse.h +++ b/util/data/msgparse.h @@ -71,9 +71,9 @@ struct regional; /** number of buckets in parse rrset hash table. Must be power of 2. */ #define PARSE_TABLE_SIZE 32 /** Maximum TTL that is allowed. */ -extern uint32_t MAX_TTL; +extern time_t MAX_TTL; /** Minimum TTL that is allowed. */ -extern uint32_t MIN_TTL; +extern time_t MIN_TTL; /** Negative cache time (for entries without any RRs.) */ #define NORR_TTL 5 /* seconds */ diff --git a/util/data/msgreply.c b/util/data/msgreply.c index f611c2b73..004d6c928 100644 --- a/util/data/msgreply.c +++ b/util/data/msgreply.c @@ -53,9 +53,9 @@ #include "util/data/msgencode.h" /** MAX TTL default for messages and rrsets */ -uint32_t MAX_TTL = 3600 * 24 * 10; /* ten days */ +time_t MAX_TTL = 3600 * 24 * 10; /* ten days */ /** MIN TTL default for messages and rrsets */ -uint32_t MIN_TTL = 0; +time_t MIN_TTL = 0; /** allocate qinfo, return 0 on error */ static int -- 2.47.2