mirror of
https://github.com/NLnetLabs/unbound.git
synced 2025-12-27 18:20:02 -05:00
threadsafe rrset counter.
git-svn-id: file:///svn/unbound/trunk@1240 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
parent
636f742ef0
commit
62fc91f7f1
5 changed files with 13 additions and 0 deletions
|
|
@ -106,9 +106,11 @@ get_rrset_bogus(struct worker* worker)
|
|||
if(m == -1)
|
||||
return 0;
|
||||
ve = (struct val_env*)worker->env.modinfo[m];
|
||||
lock_basic_lock(&ve->bogus_lock);
|
||||
r = ve->num_rrset_bogus;
|
||||
if(!worker->env.cfg->stat_cumulative)
|
||||
ve->num_rrset_bogus = 0;
|
||||
lock_basic_unlock(&ve->bogus_lock);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,6 @@
|
|||
17 September 2008: Wouter
|
||||
- locking for threadsafe bogus rrset counter.
|
||||
|
||||
16 September 2008: Wouter
|
||||
- extended-statistics: yesno config option.
|
||||
- unwanted replies spoof nearmiss detector.
|
||||
|
|
|
|||
|
|
@ -341,7 +341,9 @@ val_verify_rrset(struct module_env* env, struct val_env* ve,
|
|||
d->ttl = ve->bogus_ttl;
|
||||
/* leave RR specific TTL: not used for determine
|
||||
* if RRset timed out and clients see proper value. */
|
||||
lock_basic_lock(&ve->bogus_lock);
|
||||
ve->num_rrset_bogus++;
|
||||
lock_basic_unlock(&ve->bogus_lock);
|
||||
}
|
||||
/* if status updated - store in cache for reuse */
|
||||
rrset_update_sec_status(env->rrset_cache, rrset, *env->now);
|
||||
|
|
|
|||
|
|
@ -154,6 +154,9 @@ val_init(struct module_env* env, int id)
|
|||
env->modinfo[id] = (void*)val_env;
|
||||
env->need_to_validate = 1;
|
||||
val_env->permissive_mode = 0;
|
||||
lock_basic_init(&val_env->bogus_lock);
|
||||
lock_protect(&val_env->bogus_lock, &val_env->num_rrset_bogus,
|
||||
sizeof(val->env->num_rrset_bogus));
|
||||
if(!val_apply_cfg(env, val_env, env->cfg)) {
|
||||
log_err("validator: could not apply configuration settings.");
|
||||
return 0;
|
||||
|
|
@ -168,6 +171,7 @@ val_deinit(struct module_env* env, int id)
|
|||
if(!env || !env->modinfo[id])
|
||||
return;
|
||||
val_env = (struct val_env*)env->modinfo[id];
|
||||
lock_basic_destroy(&val_env->bogus_lock);
|
||||
anchors_delete(env->anchors);
|
||||
env->anchors = NULL;
|
||||
key_cache_delete(val_env->kcache);
|
||||
|
|
|
|||
|
|
@ -108,6 +108,8 @@ struct val_env {
|
|||
*/
|
||||
size_t* nsec3_maxiter;
|
||||
|
||||
/** lock on bogus counter */
|
||||
lock_basic_t bogus_lock;
|
||||
/** number of times rrsets marked bogus */
|
||||
size_t num_rrset_bogus;
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue