mirror of
https://github.com/NLnetLabs/unbound.git
synced 2025-12-21 07:10:43 -05:00
Fixup tests.
git-svn-id: file:///svn/unbound/trunk@312 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
parent
49bc2f887c
commit
5f95ede1fc
5 changed files with 18 additions and 4 deletions
|
|
@ -178,6 +178,7 @@ worker_handle_reply(struct comm_point* c, void* arg, int error,
|
||||||
w->state.reply = reply_info;
|
w->state.reply = reply_info;
|
||||||
if(error != 0) {
|
if(error != 0) {
|
||||||
worker_process_query(worker, w, module_event_timeout);
|
worker_process_query(worker, w, module_event_timeout);
|
||||||
|
w->state.reply = NULL;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* sanity check. */
|
/* 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
|
/* error becomes timeout for the module as if this reply
|
||||||
* never arrived. */
|
* never arrived. */
|
||||||
worker_process_query(worker, w, module_event_timeout);
|
worker_process_query(worker, w, module_event_timeout);
|
||||||
|
w->state.reply = NULL;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
worker_process_query(worker, w, module_event_reply);
|
worker_process_query(worker, w, module_event_reply);
|
||||||
|
w->state.reply = NULL;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
11 May 2007: Wouter
|
11 May 2007: Wouter
|
||||||
- iterator/iterator.c module.
|
- iterator/iterator.c module.
|
||||||
|
- fixup to pass reply_info in testcode and in netevent.
|
||||||
|
|
||||||
10 May 2007: Wouter
|
10 May 2007: Wouter
|
||||||
- created release-0.3 svn tag.
|
- created release-0.3 svn tag.
|
||||||
|
|
|
||||||
|
|
@ -234,12 +234,14 @@ iter_operate(struct module_qstate* qstate, enum module_ev event, int id)
|
||||||
}
|
}
|
||||||
if(event == module_event_timeout) {
|
if(event == module_event_timeout) {
|
||||||
/* try TCP if UDP fails */
|
/* try TCP if UDP fails */
|
||||||
|
/* TODO: disabled now, make better retry with EDNS.
|
||||||
if(qstate->reply->c->type == comm_udp) {
|
if(qstate->reply->c->type == comm_udp) {
|
||||||
qinfo_query_encode(qstate->buf, &qstate->qinfo);
|
qinfo_query_encode(qstate->buf, &qstate->qinfo);
|
||||||
(*env->send_query)(qstate->buf, &ie->fwd_addr,
|
(*env->send_query)(qstate->buf, &ie->fwd_addr,
|
||||||
ie->fwd_addrlen, TCP_QUERY_TIMEOUT, qstate, 1);
|
ie->fwd_addrlen, TCP_QUERY_TIMEOUT, qstate, 1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
qstate->ext_state[id] = module_error;
|
qstate->ext_state[id] = module_error;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -255,7 +255,7 @@ outnet_udp_cb(struct comm_point* c, void* arg, int error,
|
||||||
}
|
}
|
||||||
comm_timer_disable(p->timer);
|
comm_timer_disable(p->timer);
|
||||||
verbose(VERB_ALGO, "outnet handle udp reply");
|
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);
|
pending_delete(outnet, p);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -262,6 +262,7 @@ answer_callback_from_entry(struct replay_runtime* runtime,
|
||||||
struct entry* entry, struct fake_pending* pend)
|
struct entry* entry, struct fake_pending* pend)
|
||||||
{
|
{
|
||||||
struct comm_point c;
|
struct comm_point c;
|
||||||
|
struct comm_reply repinfo;
|
||||||
memset(&c, 0, sizeof(c));
|
memset(&c, 0, sizeof(c));
|
||||||
c.fd = -1;
|
c.fd = -1;
|
||||||
c.buffer = ldns_buffer_new(runtime->bufsize);
|
c.buffer = ldns_buffer_new(runtime->bufsize);
|
||||||
|
|
@ -269,7 +270,10 @@ answer_callback_from_entry(struct replay_runtime* runtime,
|
||||||
if(pend->transport == transport_tcp)
|
if(pend->transport == transport_tcp)
|
||||||
c.type = comm_tcp;
|
c.type = comm_tcp;
|
||||||
fill_buffer_with_reply(c.buffer, entry, pend->pkt);
|
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");
|
fatal_exit("testbound: unexpected: callback returned 1");
|
||||||
}
|
}
|
||||||
ldns_buffer_free(c.buffer);
|
ldns_buffer_free(c.buffer);
|
||||||
|
|
@ -347,6 +351,7 @@ fake_pending_callback(struct replay_runtime* runtime,
|
||||||
struct replay_moment* todo, int error)
|
struct replay_moment* todo, int error)
|
||||||
{
|
{
|
||||||
struct fake_pending* p = runtime->pending_list;
|
struct fake_pending* p = runtime->pending_list;
|
||||||
|
struct comm_reply repinfo;
|
||||||
struct comm_point c;
|
struct comm_point c;
|
||||||
memset(&c, 0, sizeof(c));
|
memset(&c, 0, sizeof(c));
|
||||||
if(!p) fatal_exit("No pending queries.");
|
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) {
|
if(todo->evt_type == repevt_back_reply && todo->match) {
|
||||||
fill_buffer_with_reply(c.buffer, todo->match, p->pkt);
|
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");
|
fatal_exit("unexpected: pending callback returned 1");
|
||||||
}
|
}
|
||||||
/* delete the pending item. */
|
/* delete the pending item. */
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue