From: Wouter Wijngaards Date: Fri, 11 May 2007 14:33:38 +0000 (+0000) Subject: Fixup tests. X-Git-Tag: release-0.4~154 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5f95ede1fcd71e219f503c0e0724ed132d55a58c;p=thirdparty%2Funbound.git Fixup tests. git-svn-id: file:///svn/unbound/trunk@312 be551aaa-1e26-0410-a405-d3ace91eadb9 --- diff --git a/daemon/worker.c b/daemon/worker.c index 0382197c3..d5e3c4644 100644 --- a/daemon/worker.c +++ b/daemon/worker.c @@ -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; } diff --git a/doc/Changelog b/doc/Changelog index 91a6f8303..fe0bb47fd 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -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. diff --git a/iterator/iterator.c b/iterator/iterator.c index 2853eb8fa..a5e8b05d4 100644 --- a/iterator/iterator.c +++ b/iterator/iterator.c @@ -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; } diff --git a/services/outside_network.c b/services/outside_network.c index e43d74ca0..1eccd6d21 100644 --- a/services/outside_network.c +++ b/services/outside_network.c @@ -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; } diff --git a/testcode/fake_event.c b/testcode/fake_event.c index ca545078d..ad358b617 100644 --- a/testcode/fake_event.c +++ b/testcode/fake_event.c @@ -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."); @@ -357,8 +362,11 @@ fake_pending_callback(struct replay_runtime* runtime, c.type = comm_tcp; 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. */