]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
prime flag moved.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Wed, 1 Aug 2007 12:59:37 +0000 (12:59 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Wed, 1 Aug 2007 12:59:37 +0000 (12:59 +0000)
git-svn-id: file:///svn/unbound/trunk@470 be551aaa-1e26-0410-a405-d3ace91eadb9

daemon/daemon.c
iterator/iter_utils.c
iterator/iterator.c
iterator/iterator.h
services/mesh.c
services/mesh.h
util/module.h

index b24a9f59f503420e14536cc24de886c0a22ca2fd..92672fc01e9278440abaeb2bceed8990c0ad8571 100644 (file)
@@ -172,7 +172,7 @@ count_modules(const char* s)
 
 /**
  * Get funcblock for module name
- * @param str: string with module name. Advanced to next value.
+ * @param str: string with module name. Advanced to next value on success.
  * @return funcblock or NULL on error.
  */
 static struct module_func_block*
index 73d4b726999266a8ce2cb2a52c4019ab8f192609..22a46dea1dc5ba6978cf608e95768f218dd93cde 100644 (file)
@@ -365,7 +365,8 @@ causes_cycle(struct module_qstate* qstate, uint8_t* name, size_t namelen,
        qinf.qname_len = namelen;
        qinf.qtype = t;
        qinf.qclass = c;
-       return (*qstate->env->detect_cycle)(qstate, &qinf, BIT_RD, 0);
+       return (*qstate->env->detect_cycle)(qstate, &qinf, BIT_RD, 
+               qstate->is_priming);
 }
 
 void 
index 2234f065772113f1ff6f7d952ba19bea8325b974..c195f92c73bd6abe13b46653dd277c2853c40114 100644 (file)
@@ -111,8 +111,7 @@ iter_new(struct module_qstate* qstate, int id)
        iq->num_current_queries = 0;
        iq->query_restart_count = 0;
        iq->referral_count = 0;
-       iq->priming = 0;
-       iq->priming_stub = 0;
+       iq->wait_priming_stub = 0;
        iq->refetch_glue = 0;
        iq->chase_flags = qstate->query_flags;
        /* Start with the (current) qname. */
@@ -375,9 +374,7 @@ generate_sub_request(uint8_t* qname, size_t qnamelen, uint16_t qtype,
         * the resolution chain, which might have a validator. We are 
         * uninterested in validating things not on the direct resolution 
         * path.  */
-       /* Turned off! CD does not make a difference in query results.
-       qstate->query_flags |= BIT_CD;
-       */
+       qflags |= BIT_CD;
 
        /* attach subquery, lookup existing or make a new one */
        if(!(*qstate->env->attach_sub)(qstate, &qinf, qflags, prime, &subq)) {
@@ -447,7 +444,6 @@ prime_root(struct module_qstate* qstate, struct iter_qstate* iq,
                subiq->dp = dp;
                /* there should not be any target queries. */
                subiq->num_target_queries = 0; 
-               subiq->priming = 1;
        }
        
        /* this module stops, our submodule starts, and does the query. */
@@ -504,8 +500,7 @@ prime_stub(struct module_qstate* qstate, struct iter_qstate* iq,
                 * wouldn't be anyway, since stub hints never have 
                 * missing targets. */
                subiq->num_target_queries = 0; 
-               subiq->priming = 1;
-               subiq->priming_stub = 1;
+               subiq->wait_priming_stub = 1;
        }
        
        /* this module stops, our submodule starts, and does the query. */
@@ -1190,7 +1185,7 @@ prime_supers(struct module_qstate* qstate, int id, struct module_qstate* forq)
        enum response_type type = response_type_from_server(iq->response, 
                &iq->qchase, iq->dp);
 
-       log_assert(iq->priming || iq->priming_stub);
+       log_assert(qstate->is_priming || foriq->wait_priming_stub);
        if(type == RESPONSE_TYPE_ANSWER) {
                /* Convert our response to a delegation point */
                dp = delegpt_from_message(iq->response, forq->region);
@@ -1218,9 +1213,10 @@ prime_supers(struct module_qstate* qstate, int id, struct module_qstate* forq)
 
        /* root priming responses go to init stage 2, priming stub 
         * responses to to stage 3. */
-       if(iq->priming_stub)
+       if(foriq->wait_priming_stub) {
                foriq->state = INIT_REQUEST_3_STATE;
-       else    foriq->state = INIT_REQUEST_2_STATE;
+               foriq->wait_priming_stub = 0;
+       } else  foriq->state = INIT_REQUEST_2_STATE;
        /* because we are finished, the parent will be reactivated */
 }
 
@@ -1257,7 +1253,7 @@ processPrimeResponse(struct module_qstate* qstate, int id)
  * to received target responses (caching, updating the current delegation
  * point, etc).
  * Callback from walk_supers for every super state that is interested in 
- * the results from thiis query.
+ * the results from this query.
  *
  * @param qstate: query state.
  * @param id: module id.
index b102613385a985c70e89dd1f5c39905751420883..fa7146950b0aaaa5aa6e3526a11530c0cbed99b5 100644 (file)
@@ -215,18 +215,11 @@ struct iter_qstate {
        /** the number of times this query as followed a referral. */
        int referral_count;
 
-       /**
-        * This flag, if true, means that this event is a priming query.
-        * In that case priming stub may be set as well.
-        */
-       int priming;
-
        /**
         * This is flag that, if true, means that this event is 
-        * representing a stub priming query. It is meaningless unless 
-        * the finalState is the PRIMING_RESP_STATE.
+        * waiting for a stub priming query. 
         */
-       int priming_stub;
+       int wait_priming_stub;
 
        /**
         * This is a flag that, if true, means that this query is
index df0d4372bd649085f6e9a7824222fcb77c099d74..8c7ff7e3b1d14e3a012bf7b3b2892df068edc19a 100644 (file)
@@ -59,9 +59,9 @@ mesh_state_compare(const void* ap, const void* bp)
        struct mesh_state* a = (struct mesh_state*)ap;
        struct mesh_state* b = (struct mesh_state*)bp;
 
-       if(a->is_priming && !b->is_priming)
+       if(a->s.is_priming && !b->s.is_priming)
                return -1;
-       if(!a->is_priming && b->is_priming)
+       if(!a->s.is_priming && b->s.is_priming)
                return 1;
 
        if((a->s.query_flags&BIT_RD) && !(b->s.query_flags&BIT_RD))
@@ -212,7 +212,6 @@ mesh_state_create(struct module_env* env, struct query_info* qinfo,
        mstate->node.key = mstate;
        mstate->run_node.key = mstate;
        mstate->debug_flags = 0;
-       mstate->is_priming = prime;
        mstate->reply_list = NULL;
        rbtree_init(&mstate->super_set, &mesh_state_ref_compare);
        rbtree_init(&mstate->sub_set, &mesh_state_ref_compare);
@@ -228,9 +227,12 @@ mesh_state_create(struct module_env* env, struct query_info* qinfo,
        }
        /* remove all weird bits from qflags */
        mstate->s.query_flags = (qflags & (BIT_RD|BIT_CD));
+       mstate->s.is_priming = prime;
        mstate->s.reply = NULL;
        mstate->s.region = region;
        mstate->s.curmod = 0;
+       mstate->s.return_rep = 0;
+       mstate->s.return_rcode = LDNS_RCODE_NOERROR;
        mstate->s.env = env;
        mstate->s.mesh_info = mstate;
        /* init modules */
@@ -497,7 +499,7 @@ struct mesh_state* mesh_area_find(struct mesh_area* mesh,
        struct mesh_state* result;
 
        key.node.key = &key;
-       key.is_priming = prime;
+       key.s.is_priming = prime;
        key.s.qinfo = *qinfo;
        key.s.query_flags = qflags;
        
index abb7083b22bed41ee7891fe2e1ccd35cd50ef868..83d3af7d661db8ef6223492ddbd9c003b88fced8 100644 (file)
@@ -106,8 +106,6 @@ struct mesh_state {
        rbnode_t node;
        /** node in mesh_area runnable tree, key is this struct */
        rbnode_t run_node;
-       /** if this is a (stub or root) priming query (with hints) */
-       int is_priming;
        /** the query state. Note that the qinfo and query_flags 
         * may not change. */
        struct module_qstate s;
index b19e197686caca67d4a2000acf25b037579765de..340e37c477503aa1ade3a24bce13749708d29e84 100644 (file)
@@ -271,9 +271,15 @@ struct module_qstate {
        struct query_info qinfo;
        /** flags uint16 from query */
        uint16_t query_flags;
+       /** if this is a (stub or root) priming query (with hints) */
+       int is_priming;
 
        /** comm_reply contains server replies */
        struct comm_reply* reply;
+       /** the reply info, with message for client, calling module */
+       struct reply_info* return_rep;
+       /** the rcode, in case of error, instead of a reply info message */
+       int return_rcode;
        /** region for this query. Cleared when query process finishes. */
        struct region* region;