mirror of
https://github.com/NLnetLabs/unbound.git
synced 2025-12-20 23:00:56 -05:00
protect config access. fix test.
git-svn-id: file:///svn/unbound/trunk@908 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
parent
c8f2bf0333
commit
6ef599255d
3 changed files with 13 additions and 0 deletions
|
|
@ -9,6 +9,7 @@
|
||||||
- random generator cleanup - RND_STATE_SIZE removed, and instead
|
- random generator cleanup - RND_STATE_SIZE removed, and instead
|
||||||
a super-rnd can be passed at init to chain init random states.
|
a super-rnd can be passed at init to chain init random states.
|
||||||
- test also does lock checks if available.
|
- test also does lock checks if available.
|
||||||
|
- protect config access in libworker_setup().
|
||||||
|
|
||||||
25 January 2008: Wouter
|
25 January 2008: Wouter
|
||||||
- added tpkg for asynclook and library use.
|
- added tpkg for asynclook and library use.
|
||||||
|
|
|
||||||
|
|
@ -108,8 +108,14 @@ libworker_setup(struct ub_val_ctx* ctx, int is_bg)
|
||||||
}
|
}
|
||||||
w->thread_num = w->env->alloc->thread_num;
|
w->thread_num = w->env->alloc->thread_num;
|
||||||
alloc_set_id_cleanup(w->env->alloc, &libworker_alloc_cleanup, w);
|
alloc_set_id_cleanup(w->env->alloc, &libworker_alloc_cleanup, w);
|
||||||
|
if(!w->is_bg || w->is_bg_thread) {
|
||||||
|
lock_basic_lock(&ctx->cfglock);
|
||||||
|
}
|
||||||
w->env->scratch = regional_create_custom(cfg->msg_buffer_size);
|
w->env->scratch = regional_create_custom(cfg->msg_buffer_size);
|
||||||
w->env->scratch_buffer = ldns_buffer_new(cfg->msg_buffer_size);
|
w->env->scratch_buffer = ldns_buffer_new(cfg->msg_buffer_size);
|
||||||
|
if(!w->is_bg || w->is_bg_thread) {
|
||||||
|
lock_basic_unlock(&ctx->cfglock);
|
||||||
|
}
|
||||||
if(!w->env->scratch || !w->env->scratch_buffer) {
|
if(!w->env->scratch || !w->env->scratch_buffer) {
|
||||||
libworker_delete(w);
|
libworker_delete(w);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
@ -139,11 +145,17 @@ libworker_setup(struct ub_val_ctx* ctx, int is_bg)
|
||||||
libworker_delete(w);
|
libworker_delete(w);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
if(!w->is_bg || w->is_bg_thread) {
|
||||||
|
lock_basic_lock(&ctx->cfglock);
|
||||||
|
}
|
||||||
w->back = outside_network_create(w->base, cfg->msg_buffer_size,
|
w->back = outside_network_create(w->base, cfg->msg_buffer_size,
|
||||||
(size_t)cfg->outgoing_num_ports, cfg->out_ifs,
|
(size_t)cfg->outgoing_num_ports, cfg->out_ifs,
|
||||||
cfg->num_out_ifs, cfg->do_ip4, cfg->do_ip6, -1,
|
cfg->num_out_ifs, cfg->do_ip4, cfg->do_ip6, -1,
|
||||||
cfg->do_tcp?cfg->outgoing_num_tcp:0,
|
cfg->do_tcp?cfg->outgoing_num_tcp:0,
|
||||||
w->env->infra_cache, w->env->rnd);
|
w->env->infra_cache, w->env->rnd);
|
||||||
|
if(!w->is_bg || w->is_bg_thread) {
|
||||||
|
lock_basic_unlock(&ctx->cfglock);
|
||||||
|
}
|
||||||
if(!w->back) {
|
if(!w->back) {
|
||||||
libworker_delete(w);
|
libworker_delete(w);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
||||||
BIN
testdata/05-asynclook.tpkg
vendored
BIN
testdata/05-asynclook.tpkg
vendored
Binary file not shown.
Loading…
Reference in a new issue