From c8939acc7f4c8989006614fefa46a89534e39e3f Mon Sep 17 00:00:00 2001 From: Wouter Wijngaards Date: Wed, 30 May 2007 14:55:40 +0000 Subject: [PATCH] multiple subrequests at the same time. git-svn-id: file:///svn/unbound/trunk@351 be551aaa-1e26-0410-a405-d3ace91eadb9 --- daemon/worker.c | 36 ++++++++++++++++++++++++++++++++++++ doc/Changelog | 1 + 2 files changed, 37 insertions(+) diff --git a/daemon/worker.c b/daemon/worker.c index 985a73ef7..78ef5d0a0 100644 --- a/daemon/worker.c +++ b/daemon/worker.c @@ -169,6 +169,33 @@ set_extstates_initial(struct worker* worker, struct module_qstate* qstate) qstate->ext_state[i] = module_state_initial; } +/** find runnable recursive */ +static struct module_qstate* +find_run_in(struct module_qstate* p) +{ + struct module_qstate* q; + for(p = p->subquery_first; p; p = p->subquery_next) { + if(p->ext_state[p->curmod] == module_state_initial) + return p; + if((q=find_run_in(p))) + return q; + } + return NULL; +} + +/** find other runnable subqueries */ +static struct module_qstate* +find_runnable(struct module_qstate* subq) +{ + struct module_qstate* p = subq; + if(p->subquery_next && p->subquery_next->ext_state[ + p->subquery_next->curmod] == module_state_initial) + return p->subquery_next; + while(p->parent) + p = p->parent; + return find_run_in(p); +} + /** process incoming request */ static void worker_process_query(struct worker* worker, struct work_query* w, @@ -219,6 +246,15 @@ worker_process_query(struct worker* worker, struct work_query* w, event = module_event_subq_done; continue; } + if(s != module_error && s != module_finished) { + /* see if we can continue with other subrequests */ + struct module_qstate* nxt = find_runnable(qstate); + if(nxt) { + qstate = nxt; + entry = NULL; + event = module_event_pass; + } + } break; } /* request done */ diff --git a/doc/Changelog b/doc/Changelog index 4e59aab70..017e685ca 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -9,6 +9,7 @@ - processInitRequest and processInitRequest2. - cache synthesizes referral messages, with DS and NSEC. - processInitRequest3. + - if a request creates multiple subrequests these are all activated. 29 May 2007: Wouter - routines to lock and unlock array of rrsets moved to cache/rrset. -- 2.47.2