Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Knot DNS
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
22
Issues
22
List
Boards
Labels
Service Desk
Milestones
Merge Requests
17
Merge Requests
17
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Knot projects
Knot DNS
Commits
8e19baae
Commit
8e19baae
authored
Jan 26, 2012
by
Lubos Slovak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup after successful update.
refs #1550 @30m
parent
2b8a5fa3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
42 deletions
+32
-42
src/libknot/updates/xfr-in.c
src/libknot/updates/xfr-in.c
+32
-42
No files found.
src/libknot/updates/xfr-in.c
View file @
8e19baae
...
...
@@ -2786,15 +2786,15 @@ dbg_xfrin_exec(
/*----------------------------------------------------------------------------*/
/*
static void xfrin_cleanup_update(xfrin_changes_t *changes)
static
void
xfrin_cleanup_update
(
xfrin_changes_t
*
changes
)
{
// free old nodes but do not destroy their RRSets
// remove owners also, because of reference counting
for (int i = 0; i < changes->old_nodes_count; ++i) {
dbg_xfrin_detail("Deleting old node: %p\n", changes->old_nodes[i]);
knot_node_dump(changes->old_nodes[i], 0);
knot_node_free(&changes->old_nodes[i], 1, 0);
}
//
for (int i = 0; i < changes->old_nodes_count; ++i) {
//
dbg_xfrin_detail("Deleting old node: %p\n", changes->old_nodes[i]);
//
knot_node_dump(changes->old_nodes[i], 0);
//
knot_node_free(&changes->old_nodes[i], 1, 0);
//
}
// free old RRSets, and destroy also domain names in them
// because of reference counting
...
...
@@ -2815,7 +2815,8 @@ dbg_xfrin_exec(
for
(
int
i
=
0
;
i
<
changes
->
old_rrsets_count
;
++
i
)
{
// knot_rrset_deep_free(&changes->old_rrsets[i], 1, 1, 1);
dbg_xfrin_detail("Deleting old RRSet: %p\n", changes->old_rrsets[i]);
dbg_xfrin_detail
(
"Deleting old RRSet: %p
\n
"
,
changes
->
old_rrsets
[
i
]);
knot_rrset_dump
(
changes
->
old_rrsets
[
i
],
0
);
knot_rrset_free
(
&
changes
->
old_rrsets
[
i
]);
}
...
...
@@ -2823,9 +2824,10 @@ dbg_xfrin_exec(
// delete old RDATA
for
(
int
i
=
0
;
i
<
changes
->
old_rdata_count
;
++
i
)
{
dbg_xfrin_detail
(
"Deleting old RDATA: %p, type: %s
\n
"
,
changes->old_rdata[i],
knot_rrtype_to_string(changes->old_rdata_types[i]));
knot_rdata_dump(changes->old_rdata[i], changes->old_rdata_types[i], 0);
changes
->
old_rdata
[
i
],
knot_rrtype_to_string
(
changes
->
old_rdata_types
[
i
]));
knot_rdata_dump
(
changes
->
old_rdata
[
i
],
changes
->
old_rdata_types
[
i
],
0
);
knot_rdata_t
*
rdata
=
changes
->
old_rdata
[
i
];
assert
(
rdata
!=
NULL
);
do
{
...
...
@@ -2837,20 +2839,21 @@ dbg_xfrin_exec(
changes
->
old_rdata
[
i
]
=
NULL
;
}
// free old hash table items, but do not touch their contents
for (int i = 0; i < changes->old_hash_items_count; ++i) {
free(changes->old_hash_items[i]);
}
free(changes->old_hash_items);
//
// free old hash table items, but do not touch their contents
//
for (int i = 0; i < changes->old_hash_items_count; ++i) {
//
free(changes->old_hash_items[i]);
//
}
//
free(changes->old_hash_items);
// free allocated arrays of nodes and rrsets
free(changes->new_nodes);
free(changes->old_nodes);
free
(
changes
->
new_rrsets
);
free
(
changes
->
new_rdata
);
free
(
changes
->
new_rdata_types
);
free
(
changes
->
old_nodes
);
free
(
changes
->
old_rrsets
);
free
(
changes
->
old_rdata
);
free
(
changes
->
old_rdata_types
);
}
*/
}
/*----------------------------------------------------------------------------*/
...
...
@@ -3119,33 +3122,16 @@ static void xfrin_zone_contents_free2(knot_zone_contents_t **contents)
static
void
xfrin_rollback_update2
(
knot_zone_contents_t
*
contents
,
xfrin_changes_t
*
changes
)
{
/*
* This function is called only when no references were actually set to
* the new nodes, just the new nodes reference other.
* We thus do not need to fix any references, just from the old nodes
* to the new ones.
*/
// discard new nodes, but do not remove RRSets from them
// for (int i = 0; i < changes->new_nodes_count; ++i) {
// knot_node_free(&changes->new_nodes[i], 0, 0);
// }
// // set references from old nodes to new nodes to NULL and remove the
// // old flag
// for (int i = 0; i < changes->old_nodes_count; ++i) {
// knot_node_set_new_node(changes->old_nodes[i], NULL);
// //knot_node_clear_old(changes->old_nodes[i]);
// }
// discard new RRSets
/*! \todo This will create problems if some RRSet is copied more times.
*/
for
(
int
i
=
0
;
i
<
changes
->
new_rrsets_count
;
++
i
)
{
knot_rrset_deep_free
(
&
changes
->
new_rrsets
[
i
],
0
,
1
,
1
);
//knot_rrset_deep_free(&changes->new_rrsets[i], 0, 1, 1);
knot_rrset_free
(
&
changes
->
new_rrsets
[
i
]);
}
/*! \todo What about RDATA?? */
for
(
int
i
=
0
;
i
<
changes
->
new_rdata_count
;
++
i
)
{
knot_rdata_deep_free
(
&
changes
->
new_rdata
[
i
],
changes
->
new_rdata_types
[
i
],
1
);
}
// destroy the shallow copy of zone
xfrin_zone_contents_free2
(
&
contents
);
...
...
@@ -3925,7 +3911,6 @@ int xfrin_apply_changesets(knot_zone_t *zone,
/*
* Apply the changesets.
*/
for
(
int
i
=
0
;
i
<
chsets
->
count
;
++
i
)
{
if
((
ret
=
xfrin_apply_changeset2
(
contents_copy
,
&
changes
,
&
chsets
->
sets
[
i
]))
...
...
@@ -3956,5 +3941,10 @@ int xfrin_apply_changesets(knot_zone_t *zone,
return
ret
;
}
/*
* Cleanup after successful changeset apply.
*/
xfrin_cleanup_update
(
&
changes
);
return
KNOT_EOK
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment