Skip to content
Snippets Groups Projects
Commit c292c3a5 authored by Marek Vavrusa's avatar Marek Vavrusa
Browse files

Removed duplicated search for following reasons:

* Exactly the same complexity if it finds an exact match.
* One less lookup if it doesnt.
parent 300bbf46
No related branches found
No related tags found
1 merge request!86Cleanup of response_add_rrset_* int parameters to flags
......@@ -2146,19 +2146,11 @@ static int ns_answer_from_zone(const knot_zone_contents_t *zone,
uint16_t qtype = knot_packet_qtype(resp);
search:
// Searching for a name directly is faster than when we need previous dname
node = knot_zone_contents_find_node(zone, qname);
if (node != NULL) {
// If node is found, closest_encloser is equal to node itself
closest_encloser = node;
find_ret = KNOT_ZONE_NAME_FOUND;
} else {
// We need previous and closest encloser, full search has to be done
find_ret = knot_zone_contents_find_dname(zone, qname, &node,
&closest_encloser, &previous);
if (find_ret == KNOT_EINVAL) {
return NS_ERR_SERVFAIL;
}
// We need previous and closest encloser, full search has to be done
find_ret = knot_zone_contents_find_dname(zone, qname, &node,
&closest_encloser, &previous);
if (find_ret == KNOT_EINVAL) {
return NS_ERR_SERVFAIL;
}
dbg_ns_exec_verb(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment