From cc9c205d8826c4b4f9363412c3de81784ec3b19c Mon Sep 17 00:00:00 2001 From: Wouter Wijngaards Date: Wed, 20 Jun 2007 13:01:30 +0000 Subject: [PATCH] Fixups. git-svn-id: file:///svn/unbound/trunk@406 be551aaa-1e26-0410-a405-d3ace91eadb9 --- daemon/unbound.c | 18 ++++++++++-------- daemon/worker.c | 1 + doc/Changelog | 3 +++ iterator/iterator.c | 20 ++++++++++++++------ services/outside_network.c | 1 + 5 files changed, 29 insertions(+), 14 deletions(-) diff --git a/daemon/unbound.c b/daemon/unbound.c index a5057f2ef..81fc80635 100644 --- a/daemon/unbound.c +++ b/daemon/unbound.c @@ -96,7 +96,7 @@ checkrlimits(struct config_file* cfg) log_warn("getrlimit: %s", strerror(errno)); return; } - if(rlim.rlim_cur == RLIM_INFINITY) + if(rlim.rlim_cur == (rlim_t)RLIM_INFINITY) return; if((size_t)rlim.rlim_cur < total) { log_err("Not enough sockets available. Increase " @@ -113,11 +113,12 @@ checkrlimits(struct config_file* cfg) static void print_rlim_pretty(const char* str, struct rlimit* rlim) { - if(rlim->rlim_cur == RLIM_INFINITY && rlim->rlim_max == RLIM_INFINITY) + if(rlim->rlim_cur == (rlim_t)RLIM_INFINITY && + rlim->rlim_max == (rlim_t)RLIM_INFINITY) log_info("%s unlimited, max unlimited", str); - else if(rlim->rlim_max == RLIM_INFINITY) + else if(rlim->rlim_max == (rlim_t)RLIM_INFINITY) log_info("%s %d, max unlimited", str, (int)rlim->rlim_cur); - else if(rlim->rlim_cur == RLIM_INFINITY) + else if(rlim->rlim_cur == (rlim_t)RLIM_INFINITY) log_info("%s unlimited, max %d", str, (int)rlim->rlim_max); else log_info("%s %d, max %d", str, (int)rlim->rlim_cur, (int)rlim->rlim_max); @@ -133,14 +134,15 @@ do_coredump_enable() return; } print_rlim_pretty("rlimit(core) is", &rlim); - if(rlim.rlim_cur == RLIM_INFINITY && rlim.rlim_max == RLIM_INFINITY) { + if(rlim.rlim_cur == (rlim_t)RLIM_INFINITY && + rlim.rlim_max == (rlim_t)RLIM_INFINITY) { return; } - if(rlim.rlim_cur > 10000) { + if(rlim.rlim_cur > (rlim_t)10000) { return; } - rlim.rlim_cur = RLIM_INFINITY; - rlim.rlim_max = RLIM_INFINITY; + rlim.rlim_cur = (rlim_t)RLIM_INFINITY; + rlim.rlim_max = (rlim_t)RLIM_INFINITY; if(setrlimit(RLIMIT_CORE, &rlim) < 0) { log_warn("setrlimit(core): %s", strerror(errno)); return; diff --git a/daemon/worker.c b/daemon/worker.c index 58e251723..8225e3478 100644 --- a/daemon/worker.c +++ b/daemon/worker.c @@ -389,6 +389,7 @@ worker_handle_service_reply(struct comm_point* c, void* arg, int error, || LDNS_QDCOUNT(ldns_buffer_begin(c->buffer)) > 1) { /* error becomes timeout for the module as if this reply * never arrived. */ + verbose(VERB_ALGO, "worker: bad reply handled as timeout"); worker_process_query(worker, w, e->qstate, module_event_timeout, e); return 0; diff --git a/doc/Changelog b/doc/Changelog index 79a8a87df..cbcb9e6cf 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -3,6 +3,9 @@ - doc update. - fixup CNAME generation by scrubber, and memory allocation of it. - fixup deletion of serviced queries when all callbacks delete too. + - set num target queries to 0 when you move them to slumber list. + - typo in check caused subquery errors to be ignored, fixed. + - make lint happy about rlim_t. 19 June 2007: Wouter - nicer layout in stats.c, review 0.3 change. diff --git a/iterator/iterator.c b/iterator/iterator.c index 0ebdf660d..0a914cbf4 100644 --- a/iterator/iterator.c +++ b/iterator/iterator.c @@ -1081,6 +1081,7 @@ processQueryTargets(struct module_qstate* qstate, struct iter_qstate* iq, /* move other targets to slumber list */ if(iq->num_target_queries>0) { (*qstate->env->remove_subqueries)(qstate); + iq->num_target_queries = 0; } /* We have a valid target. */ @@ -1143,7 +1144,9 @@ processQueryResponse(struct module_qstate* qstate, struct iter_qstate* iq, return error_response(qstate, id, LDNS_RCODE_SERVFAIL); /* close down outstanding requests to be discarded */ outbound_list_clear(&iq->outlist); + iq->num_current_queries = 0; (*qstate->env->remove_subqueries)(qstate); + iq->num_target_queries = 0; return final_state(iq); } else if(type == RESPONSE_TYPE_REFERRAL) { /* REFERRAL type responses get a reset of the @@ -1161,8 +1164,6 @@ processQueryResponse(struct module_qstate* qstate, struct iter_qstate* iq, if(!iq->dp) return error_response(qstate, id, LDNS_RCODE_SERVFAIL); delegpt_log(iq->dp); - iq->num_current_queries = 0; - iq->num_target_queries = 0; /* Count this as a referral. */ iq->referral_count++; @@ -1171,7 +1172,9 @@ processQueryResponse(struct module_qstate* qstate, struct iter_qstate* iq, * handled? Say by a subquery that inherits the outbound_entry. */ outbound_list_clear(&iq->outlist); + iq->num_current_queries = 0; (*qstate->env->remove_subqueries)(qstate); + iq->num_target_queries = 0; verbose(VERB_ALGO, "cleared outbound list for next round"); return next_state(iq, QUERYTARGETS_STATE); } else if(type == RESPONSE_TYPE_CNAME) { @@ -1201,8 +1204,6 @@ processQueryResponse(struct module_qstate* qstate, struct iter_qstate* iq, /* Clear the query state, since this is a query restart. */ iq->deleg_msg = NULL; iq->dp = NULL; - iq->num_current_queries = 0; - iq->num_target_queries = 0; /* Note the query restart. */ iq->query_restart_count++; @@ -1211,7 +1212,9 @@ processQueryResponse(struct module_qstate* qstate, struct iter_qstate* iq, * handled? Say by a subquery that inherits the outbound_entry. */ outbound_list_clear(&iq->outlist); + iq->num_current_queries = 0; (*qstate->env->remove_subqueries)(qstate); + iq->num_target_queries = 0; verbose(VERB_ALGO, "cleared outbound list for query restart"); /* go to INIT_REQUEST_STATE for new qname. */ return next_state(iq, INIT_REQUEST_STATE); @@ -1346,6 +1349,7 @@ processTargetResponse(struct module_qstate* qstate, struct iter_qstate* iq, /* FIXME: maybe store this nameserver address in the cache * anyways? */ /* If not, just stop processing this event */ + verbose(VERB_ALGO, "subq: parent not interested anymore"); return 0; } @@ -1590,12 +1594,15 @@ process_subq_error(struct module_qstate* qstate, struct iter_qstate* iq, return; } /* see if we are still interested in this subquery result */ - - if(!iq->dp) + if(iq->dp) dpns = delegpt_find_ns(iq->dp, errinf.qname, errinf.qname_len); if(!dpns) { /* not interested */ + verbose(VERB_ALGO, "got subq error, but not interested"); + log_nametypeclass(VERB_ALGO, "errname", + errinf.qname, errinf.qtype, errinf.qclass); + delegpt_log(iq->dp); return; } dpns->resolved = 1; /* mark as failed */ @@ -1672,6 +1679,7 @@ iter_clear(struct module_qstate* qstate, int id) } if(iq) { outbound_list_clear(&iq->outlist); + iq->num_current_queries = 0; } qstate->minfo[id] = NULL; } diff --git a/services/outside_network.c b/services/outside_network.c index ddd0759b9..ffe975a43 100644 --- a/services/outside_network.c +++ b/services/outside_network.c @@ -1010,6 +1010,7 @@ serviced_callbacks(struct serviced_query* sq, int error, struct comm_point* c, (void)(*p->cb)(c, p->cb_arg, error, rep); p = n; } + log_assert(sq->cblist == NULL); serviced_delete(sq); } -- 2.47.2