+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.
/* 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;
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,
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) {