Commit c2131e6a authored by Marek Vavruša's avatar Marek Vavruša

cleanup

parent 709a3d7d
......@@ -914,7 +914,7 @@ int internet_query_plan(struct query_plan *plan)
}
/*! \brief Process answer to SOA query. */
static int internet_answer_soa(knot_pkt_t *pkt, struct answer_data *data)
static int process_soa_answer(knot_pkt_t *pkt, struct answer_data *data)
{
zone_t *zone = data->param->zone;
......@@ -957,7 +957,7 @@ int internet_process_answer(knot_pkt_t *pkt, struct answer_data *data)
/* As of now, server can only issue SOA queries. */
switch(knot_pkt_qtype(pkt)) {
case KNOT_RRTYPE_SOA:
return internet_answer_soa(pkt, data);
return process_soa_answer(pkt, data);
default:
return NS_PROC_NOOP;
}
......
......@@ -203,8 +203,7 @@ static int apply_remove(zone_contents_t *contents, changeset_t *chset)
const knot_rrset_t *rr = rr_node->rr;
// Find node for this owner
zone_node_t *node = zone_contents_find_node_for_rr(contents,
rr);
zone_node_t *node = zone_contents_find_node_for_rr(contents, rr);
if (!can_remove(node, rr)) {
// Nothing to remove from, skip.
continue;
......@@ -364,13 +363,12 @@ static int mark_empty(zone_node_t **node_p, void *data)
return KNOT_EOK;
}
/*! \brief Removes node that were previously marked as empty. */
static int remove_empty_nodes(zone_contents_t *z)
static int remove_empty_tree_nodes(zone_tree_t *tree)
{
list_t l;
init_list(&l);
// walk through the zone and select nodes to be removed
int ret = zone_tree_apply(z->nodes, mark_empty, &l);
int ret = zone_tree_apply(tree, mark_empty, &l);
if (ret != KNOT_EOK) {
return ret;
}
......@@ -379,7 +377,7 @@ static int remove_empty_nodes(zone_contents_t *z)
node_t *nxt = NULL;
WALK_LIST_DELSAFE(n, nxt, l) {
zone_node_t *node = (zone_node_t *)n->d;
ret = zone_contents_remove_node(z, node->owner);
int ret = zone_tree_remove(tree, node->owner, &node);
if (ret != KNOT_EOK) {
return ret;
}
......@@ -387,24 +385,18 @@ static int remove_empty_nodes(zone_contents_t *z)
free(n);
}
init_list(&l);
// Do the same with NSEC3 nodes.
ret = zone_tree_apply(z->nsec3_nodes, mark_empty, &l);
return KNOT_EOK;
}
/*! \brief Removes node that were previously marked as empty. */
static int remove_empty_nodes(zone_contents_t *z)
{
int ret = remove_empty_tree_nodes(z->nodes);
if (ret != KNOT_EOK) {
return ret;
}
WALK_LIST_DELSAFE(n, nxt, l) {
zone_node_t *node = (zone_node_t *)n->d;
ret = zone_contents_remove_nsec3_node(z, node->owner);
if (ret != KNOT_EOK) {
return ret;
}
node_free(&node);
free(n);
}
return KNOT_EOK;
return remove_empty_tree_nodes(z->nsec3_nodes);
}
/* --------------------- Zone copy and finalization ------------------------- */
......
......@@ -51,9 +51,7 @@ int apply_changesets(zone_t *zone, changesets_t *chsets,
* \param contents Zone contents to apply the changesets to. Will be modified.
* \param chsets Changesets to be applied to the zone.
*
* \retval KNOT_EOK if successful.
* \retval KNOT_EINVAL if given one of the arguments is NULL.
* \return Other error code if the application went wrong.
* \return KNOT_E*
*/
int apply_changesets_directly(zone_contents_t *contents,
changesets_t *chsets);
......
......@@ -150,8 +150,7 @@ int main(int argc, char *argv[])
/* Test requestor in connected environment. */
test_connected(&requestor, &remote);
/* TSIG secured. */
#warning TODO: when ported sign_packet/verify_packet
/*! \todo #243 TSIG secured requests test should be implemented. */
/* Terminate responder. */
int responder = net_connected_socket(SOCK_STREAM, &remote.addr, NULL, 0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment