cache lameness, set reply properly.
git-svn-id: https://unbound.nlnetlabs.nl/svn/trunk@363 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
parent
09a50c0c31
commit
009134dd04
@ -214,6 +214,7 @@ worker_process_query(struct worker* worker, struct work_query* w,
|
||||
(*worker->daemon->modfunc[qstate->curmod]->operate)(qstate,
|
||||
event, qstate->curmod, entry);
|
||||
region_free_all(worker->scratchpad);
|
||||
qstate->reply = NULL;
|
||||
s = qstate->ext_state[qstate->curmod];
|
||||
/* examine results, start further modules, etc. */
|
||||
if(s == module_wait_subquery) {
|
||||
@ -287,7 +288,6 @@ worker_handle_reply(struct comm_point* c, void* arg, int error,
|
||||
if(error != 0) {
|
||||
worker_process_query(worker, w, &w->state,
|
||||
module_event_timeout, NULL);
|
||||
w->state.reply = NULL;
|
||||
return 0;
|
||||
}
|
||||
/* sanity check. */
|
||||
@ -299,11 +299,9 @@ worker_handle_reply(struct comm_point* c, void* arg, int error,
|
||||
* never arrived. */
|
||||
worker_process_query(worker, w, &w->state,
|
||||
module_event_timeout, NULL);
|
||||
w->state.reply = NULL;
|
||||
return 0;
|
||||
}
|
||||
worker_process_query(worker, w, &w->state, module_event_reply, NULL);
|
||||
w->state.reply = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -316,11 +314,10 @@ worker_handle_service_reply(struct comm_point* c, void* arg, int error,
|
||||
struct work_query* w = e->qstate->work_info;
|
||||
struct worker* worker = w->state.env->worker;
|
||||
|
||||
w->state.reply = reply_info;
|
||||
e->qstate->reply = reply_info;
|
||||
if(error != 0) {
|
||||
worker_process_query(worker, w, e->qstate,
|
||||
module_event_timeout, e);
|
||||
w->state.reply = NULL;
|
||||
return 0;
|
||||
}
|
||||
/* sanity check. */
|
||||
@ -332,11 +329,9 @@ worker_handle_service_reply(struct comm_point* c, void* arg, int error,
|
||||
* never arrived. */
|
||||
worker_process_query(worker, w, e->qstate,
|
||||
module_event_timeout, e);
|
||||
w->state.reply = NULL;
|
||||
return 0;
|
||||
}
|
||||
worker_process_query(worker, w, e->qstate, module_event_reply, e);
|
||||
w->state.reply = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,9 @@
|
||||
4 June 2007: Wouter
|
||||
- random selection of equally preferred nameserver targets.
|
||||
- reply info copy routine. Reuses existing code.
|
||||
- cache lameness in response handling.
|
||||
- do not touch qstate after worker_process_query because it may have
|
||||
been deleted by that routine.
|
||||
|
||||
1 June 2007: Wouter
|
||||
- normalize incoming messages. Like unbound-java, with CNAME chain
|
||||
|
@ -48,6 +48,7 @@
|
||||
#include "iterator/iter_resptype.h"
|
||||
#include "iterator/iter_scrub.h"
|
||||
#include "services/cache/dns.h"
|
||||
#include "services/cache/infra.h"
|
||||
#include "util/module.h"
|
||||
#include "util/netevent.h"
|
||||
#include "util/net_help.h"
|
||||
@ -1091,6 +1092,7 @@ processQueryResponse(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||
verbose(VERB_ALGO, "query response was timeout");
|
||||
return next_state(qstate, iq, QUERYTARGETS_STATE);
|
||||
}
|
||||
log_assert(qstate->reply); /* need addr for lameness cache */
|
||||
type = response_type_from_server(iq->response, &qstate->qinfo, iq->dp);
|
||||
if(type == RESPONSE_TYPE_ANSWER) {
|
||||
/* ANSWER type responses terminate the query algorithm,
|
||||
@ -1173,8 +1175,11 @@ processQueryResponse(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||
return next_state(qstate, iq, INIT_REQUEST_STATE);
|
||||
} else if(type == RESPONSE_TYPE_LAME) {
|
||||
/* Cache the LAMEness. */
|
||||
/* TODO mark addr, dp->name, as lame */
|
||||
verbose(VERB_ALGO, "query response was LAME");
|
||||
if(!infra_set_lame(qstate->env->infra_cache,
|
||||
&qstate->reply->addr, qstate->reply->addrlen,
|
||||
iq->dp->name, iq->dp->namelen, time(NULL)))
|
||||
log_err("mark host lame: out of memory");
|
||||
} else if(type == RESPONSE_TYPE_THROWAWAY) {
|
||||
/* LAME and THROWAWAY responses are handled the same way.
|
||||
* In this case, the event is just sent directly back to
|
||||
|
Loading…
Reference in New Issue
Block a user