git-svn-id: file:///svn/unbound/trunk@406 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
Wouter Wijngaards 2007-06-20 13:01:30 +00:00
parent 191e347415
commit cc9c205d88
5 changed files with 29 additions and 14 deletions

View file

@ -96,7 +96,7 @@ checkrlimits(struct config_file* cfg)
log_warn("getrlimit: %s", strerror(errno)); log_warn("getrlimit: %s", strerror(errno));
return; return;
} }
if(rlim.rlim_cur == RLIM_INFINITY) if(rlim.rlim_cur == (rlim_t)RLIM_INFINITY)
return; return;
if((size_t)rlim.rlim_cur < total) { if((size_t)rlim.rlim_cur < total) {
log_err("Not enough sockets available. Increase " log_err("Not enough sockets available. Increase "
@ -113,11 +113,12 @@ checkrlimits(struct config_file* cfg)
static void static void
print_rlim_pretty(const char* str, struct rlimit* rlim) 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); 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); 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); log_info("%s unlimited, max %d", str, (int)rlim->rlim_max);
else log_info("%s %d, max %d", str, (int)rlim->rlim_cur, else log_info("%s %d, max %d", str, (int)rlim->rlim_cur,
(int)rlim->rlim_max); (int)rlim->rlim_max);
@ -133,14 +134,15 @@ do_coredump_enable()
return; return;
} }
print_rlim_pretty("rlimit(core) is", &rlim); 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; return;
} }
if(rlim.rlim_cur > 10000) { if(rlim.rlim_cur > (rlim_t)10000) {
return; return;
} }
rlim.rlim_cur = RLIM_INFINITY; rlim.rlim_cur = (rlim_t)RLIM_INFINITY;
rlim.rlim_max = RLIM_INFINITY; rlim.rlim_max = (rlim_t)RLIM_INFINITY;
if(setrlimit(RLIMIT_CORE, &rlim) < 0) { if(setrlimit(RLIMIT_CORE, &rlim) < 0) {
log_warn("setrlimit(core): %s", strerror(errno)); log_warn("setrlimit(core): %s", strerror(errno));
return; return;

View file

@ -389,6 +389,7 @@ worker_handle_service_reply(struct comm_point* c, void* arg, int error,
|| LDNS_QDCOUNT(ldns_buffer_begin(c->buffer)) > 1) { || LDNS_QDCOUNT(ldns_buffer_begin(c->buffer)) > 1) {
/* error becomes timeout for the module as if this reply /* error becomes timeout for the module as if this reply
* never arrived. */ * never arrived. */
verbose(VERB_ALGO, "worker: bad reply handled as timeout");
worker_process_query(worker, w, e->qstate, worker_process_query(worker, w, e->qstate,
module_event_timeout, e); module_event_timeout, e);
return 0; return 0;

View file

@ -3,6 +3,9 @@
- doc update. - doc update.
- fixup CNAME generation by scrubber, and memory allocation of it. - fixup CNAME generation by scrubber, and memory allocation of it.
- fixup deletion of serviced queries when all callbacks delete too. - 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 19 June 2007: Wouter
- nicer layout in stats.c, review 0.3 change. - nicer layout in stats.c, review 0.3 change.

View file

@ -1081,6 +1081,7 @@ processQueryTargets(struct module_qstate* qstate, struct iter_qstate* iq,
/* move other targets to slumber list */ /* move other targets to slumber list */
if(iq->num_target_queries>0) { if(iq->num_target_queries>0) {
(*qstate->env->remove_subqueries)(qstate); (*qstate->env->remove_subqueries)(qstate);
iq->num_target_queries = 0;
} }
/* We have a valid target. */ /* 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); return error_response(qstate, id, LDNS_RCODE_SERVFAIL);
/* close down outstanding requests to be discarded */ /* close down outstanding requests to be discarded */
outbound_list_clear(&iq->outlist); outbound_list_clear(&iq->outlist);
iq->num_current_queries = 0;
(*qstate->env->remove_subqueries)(qstate); (*qstate->env->remove_subqueries)(qstate);
iq->num_target_queries = 0;
return final_state(iq); return final_state(iq);
} else if(type == RESPONSE_TYPE_REFERRAL) { } else if(type == RESPONSE_TYPE_REFERRAL) {
/* REFERRAL type responses get a reset of the /* REFERRAL type responses get a reset of the
@ -1161,8 +1164,6 @@ processQueryResponse(struct module_qstate* qstate, struct iter_qstate* iq,
if(!iq->dp) if(!iq->dp)
return error_response(qstate, id, LDNS_RCODE_SERVFAIL); return error_response(qstate, id, LDNS_RCODE_SERVFAIL);
delegpt_log(iq->dp); delegpt_log(iq->dp);
iq->num_current_queries = 0;
iq->num_target_queries = 0;
/* Count this as a referral. */ /* Count this as a referral. */
iq->referral_count++; 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. * handled? Say by a subquery that inherits the outbound_entry.
*/ */
outbound_list_clear(&iq->outlist); outbound_list_clear(&iq->outlist);
iq->num_current_queries = 0;
(*qstate->env->remove_subqueries)(qstate); (*qstate->env->remove_subqueries)(qstate);
iq->num_target_queries = 0;
verbose(VERB_ALGO, "cleared outbound list for next round"); verbose(VERB_ALGO, "cleared outbound list for next round");
return next_state(iq, QUERYTARGETS_STATE); return next_state(iq, QUERYTARGETS_STATE);
} else if(type == RESPONSE_TYPE_CNAME) { } 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. */ /* Clear the query state, since this is a query restart. */
iq->deleg_msg = NULL; iq->deleg_msg = NULL;
iq->dp = NULL; iq->dp = NULL;
iq->num_current_queries = 0;
iq->num_target_queries = 0;
/* Note the query restart. */ /* Note the query restart. */
iq->query_restart_count++; 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. * handled? Say by a subquery that inherits the outbound_entry.
*/ */
outbound_list_clear(&iq->outlist); outbound_list_clear(&iq->outlist);
iq->num_current_queries = 0;
(*qstate->env->remove_subqueries)(qstate); (*qstate->env->remove_subqueries)(qstate);
iq->num_target_queries = 0;
verbose(VERB_ALGO, "cleared outbound list for query restart"); verbose(VERB_ALGO, "cleared outbound list for query restart");
/* go to INIT_REQUEST_STATE for new qname. */ /* go to INIT_REQUEST_STATE for new qname. */
return next_state(iq, INIT_REQUEST_STATE); 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 /* FIXME: maybe store this nameserver address in the cache
* anyways? */ * anyways? */
/* If not, just stop processing this event */ /* If not, just stop processing this event */
verbose(VERB_ALGO, "subq: parent not interested anymore");
return 0; return 0;
} }
@ -1590,12 +1594,15 @@ process_subq_error(struct module_qstate* qstate, struct iter_qstate* iq,
return; return;
} }
/* see if we are still interested in this subquery result */ /* see if we are still interested in this subquery result */
if(iq->dp)
if(!iq->dp)
dpns = delegpt_find_ns(iq->dp, errinf.qname, dpns = delegpt_find_ns(iq->dp, errinf.qname,
errinf.qname_len); errinf.qname_len);
if(!dpns) { if(!dpns) {
/* not interested */ /* 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; return;
} }
dpns->resolved = 1; /* mark as failed */ dpns->resolved = 1; /* mark as failed */
@ -1672,6 +1679,7 @@ iter_clear(struct module_qstate* qstate, int id)
} }
if(iq) { if(iq) {
outbound_list_clear(&iq->outlist); outbound_list_clear(&iq->outlist);
iq->num_current_queries = 0;
} }
qstate->minfo[id] = NULL; qstate->minfo[id] = NULL;
} }

View file

@ -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); (void)(*p->cb)(c, p->cb_arg, error, rep);
p = n; p = n;
} }
log_assert(sq->cblist == NULL);
serviced_delete(sq); serviced_delete(sq);
} }