mirror of
https://github.com/NLnetLabs/unbound.git
synced 2025-12-28 10:39:33 -05:00
Small off by one in targetcount and double-callback fixup.
git-svn-id: file:///svn/unbound/trunk@389 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
parent
c7b302f43a
commit
7608c92bb7
3 changed files with 29 additions and 1 deletions
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue