Fixup tests.

git-svn-id: file:///svn/unbound/trunk@312 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
Wouter Wijngaards 2007-05-11 14:33:38 +00:00
parent 49bc2f887c
commit 5f95ede1fc
5 changed files with 18 additions and 4 deletions

View file

@ -178,6 +178,7 @@ worker_handle_reply(struct comm_point* c, void* arg, int error,
w->state.reply = reply_info;
if(error != 0) {
worker_process_query(worker, w, module_event_timeout);
w->state.reply = NULL;
return 0;
}
/* sanity check. */
@ -188,9 +189,11 @@ worker_handle_reply(struct comm_point* c, void* arg, int error,
/* error becomes timeout for the module as if this reply
* never arrived. */
worker_process_query(worker, w, module_event_timeout);
w->state.reply = NULL;
return 0;
}
worker_process_query(worker, w, module_event_reply);
w->state.reply = NULL;
return 0;
}

View file

@ -1,5 +1,6 @@
11 May 2007: Wouter
- iterator/iterator.c module.
- fixup to pass reply_info in testcode and in netevent.
10 May 2007: Wouter
- created release-0.3 svn tag.

View file

@ -234,12 +234,14 @@ iter_operate(struct module_qstate* qstate, enum module_ev event, int id)
}
if(event == module_event_timeout) {
/* try TCP if UDP fails */
/* TODO: disabled now, make better retry with EDNS.
if(qstate->reply->c->type == comm_udp) {
qinfo_query_encode(qstate->buf, &qstate->qinfo);
(*env->send_query)(qstate->buf, &ie->fwd_addr,
ie->fwd_addrlen, TCP_QUERY_TIMEOUT, qstate, 1);
return;
}
*/
qstate->ext_state[id] = module_error;
return;
}

View file

@ -255,7 +255,7 @@ outnet_udp_cb(struct comm_point* c, void* arg, int error,
}
comm_timer_disable(p->timer);
verbose(VERB_ALGO, "outnet handle udp reply");
(void)(*p->cb)(p->c, p->cb_arg, NETEVENT_NOERROR, NULL);
(void)(*p->cb)(p->c, p->cb_arg, NETEVENT_NOERROR, reply_info);
pending_delete(outnet, p);
return 0;
}

View file

@ -262,6 +262,7 @@ answer_callback_from_entry(struct replay_runtime* runtime,
struct entry* entry, struct fake_pending* pend)
{
struct comm_point c;
struct comm_reply repinfo;
memset(&c, 0, sizeof(c));
c.fd = -1;
c.buffer = ldns_buffer_new(runtime->bufsize);
@ -269,7 +270,10 @@ answer_callback_from_entry(struct replay_runtime* runtime,
if(pend->transport == transport_tcp)
c.type = comm_tcp;
fill_buffer_with_reply(c.buffer, entry, pend->pkt);
if((*pend->callback)(&c, pend->cb_arg, NETEVENT_NOERROR, NULL)) {
repinfo.c = &c;
repinfo.addrlen = pend->addrlen;
memcpy(&repinfo.addr, &pend->addr, pend->addrlen);
if((*pend->callback)(&c, pend->cb_arg, NETEVENT_NOERROR, &repinfo)) {
fatal_exit("testbound: unexpected: callback returned 1");
}
ldns_buffer_free(c.buffer);
@ -347,6 +351,7 @@ fake_pending_callback(struct replay_runtime* runtime,
struct replay_moment* todo, int error)
{
struct fake_pending* p = runtime->pending_list;
struct comm_reply repinfo;
struct comm_point c;
memset(&c, 0, sizeof(c));
if(!p) fatal_exit("No pending queries.");
@ -358,7 +363,10 @@ fake_pending_callback(struct replay_runtime* runtime,
if(todo->evt_type == repevt_back_reply && todo->match) {
fill_buffer_with_reply(c.buffer, todo->match, p->pkt);
}
if((*p->callback)(&c, p->cb_arg, error, NULL)) {
repinfo.c = &c;
repinfo.addrlen = p->addrlen;
memcpy(&repinfo.addr, &p->addr, p->addrlen);
if((*p->callback)(&c, p->cb_arg, error, &repinfo)) {
fatal_exit("unexpected: pending callback returned 1");
}
/* delete the pending item. */