From 7608c92bb7fd2be700fcaa746a7bce950aeb5cdc Mon Sep 17 00:00:00 2001 From: Wouter Wijngaards Date: Fri, 15 Jun 2007 08:40:30 +0000 Subject: [PATCH] Small off by one in targetcount and double-callback fixup. git-svn-id: file:///svn/unbound/trunk@389 be551aaa-1e26-0410-a405-d3ace91eadb9 --- doc/Changelog | 10 ++++++++++ iterator/iterator.c | 2 +- services/outside_network.c | 18 ++++++++++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/doc/Changelog b/doc/Changelog index 21bf25977..0e4b55bcb 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,3 +1,13 @@ +15 June 2007: Wouter + - if a query asks to be notified of the same serviced query result + multiple times, this will succeed. Only one callback will happen; + multiple outbound-list entries result (but the double cleanup of it + will not matter). + +14 June 2007: Wouter + - num query targets was > 0 , not >= 0 compared, so that fetch + policy of 0 did nothing. + 13 June 2007: Wouter - debug option: configure --enable-static-exe for compile where ldns and libevent are linked statically. Default is off. diff --git a/iterator/iterator.c b/iterator/iterator.c index c734dc114..093f1721b 100644 --- a/iterator/iterator.c +++ b/iterator/iterator.c @@ -940,7 +940,7 @@ query_for_targets(struct module_qstate* qstate, struct iter_qstate* iq, /* if maxtargets is negative, there is no maximum, * otherwise only query for ntarget names. */ - if(maxtargets > 0 && ++target_count > maxtargets) + if(maxtargets >= 0 && ++target_count > maxtargets) break; } *num = query_count; diff --git a/services/outside_network.c b/services/outside_network.c index cd96ea9ed..2e83417b7 100644 --- a/services/outside_network.c +++ b/services/outside_network.c @@ -1130,6 +1130,18 @@ serviced_udp_callback(struct comm_point* c, void* arg, int error, return 0; } +/** find callback in list */ +static struct service_callback* +callback_list_find(struct serviced_query* sq, void* cb_arg) +{ + struct service_callback* p; + for(p = sq->cblist; p; p = p->next) { + if(p->cb_arg == cb_arg) + return p; + } + return NULL; +} + struct serviced_query* outnet_serviced_query(struct outside_network* outnet, uint8_t* qname, size_t qnamelen, uint16_t qtype, uint16_t qclass, @@ -1141,6 +1153,12 @@ outnet_serviced_query(struct outside_network* outnet, struct service_callback* cb; serviced_gen_query(buff, qname, qnamelen, qtype, qclass, flags); sq = lookup_serviced(outnet, buff, dnssec, addr, addrlen); + if(sq) { + /* see if it is a duplicate notification request for cb_arg */ + if((cb = callback_list_find(sq, callback_arg))) { + return sq; + } + } if(!(cb = (struct service_callback*)malloc(sizeof(*cb)))) return NULL; if(!sq) { -- 2.47.2