From: W.C.A. Wijngaards Date: Tue, 9 Jan 2024 11:09:39 +0000 (+0100) Subject: - fast-reload, in forwards_swap_tree set protection of trees with locks. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9c1274ed303628712830eac50c540cd058469003;p=thirdparty%2Funbound.git - fast-reload, in forwards_swap_tree set protection of trees with locks. --- diff --git a/iterator/iter_fwd.c b/iterator/iter_fwd.c index e2697bab4..7954f865c 100644 --- a/iterator/iter_fwd.c +++ b/iterator/iter_fwd.c @@ -544,6 +544,14 @@ void forwards_swap_tree(struct iter_forwards* fwd, struct iter_forwards* data) { rbtree_type* oldtree = fwd->tree; + if(oldtree) { + lock_unprotect(&fwd->lock, oldtree); + } + if(data->tree) { + lock_unprotect(&data->lock, data->tree); + } fwd->tree = data->tree; data->tree = oldtree; + lock_protect(&fwd->lock, fwd->tree, sizeof(*fwd->tree)); + lock_protect(&data->lock, data->tree, sizeof(*data->tree)); }