Skip to content

Commit

Permalink
consumer member zones in rbtree...
Browse files Browse the repository at this point in the history
instead of double linked list
  • Loading branch information
wtoorop committed Jan 10, 2024
1 parent 2ae6fac commit a526bc1
Show file tree
Hide file tree
Showing 5 changed files with 295 additions and 221 deletions.
15 changes: 6 additions & 9 deletions options.c
Original file line number Diff line number Diff line change
Expand Up @@ -568,13 +568,12 @@ zone_options_delete(struct nsd_options* opt, struct zone_options* zone)
region_recycle(opt->region, zone, sizeof(*zone));
return;
}
/* Unlink the member zone if needed */
if(member_zone->prev_next_ptr) {
*member_zone->prev_next_ptr = member_zone->next;
}
if(member_zone->next) {
member_zone->next->prev_next_ptr = member_zone->prev_next_ptr;
}
/* member_zone->member_id == NULL because catalog member zones are
* deleted either through catalog_del_consumer_member_zone() or
* through xfrd_del_catalog_producer_member(), which both set
* member_id to NULL.
*/
assert(member_zone->member_id == NULL);
if(member_zone->member_id) {
region_recycle(opt->region, (void*)member_zone->member_id,
dname_total_size(member_zone->member_id));
Expand Down Expand Up @@ -944,8 +943,6 @@ catalog_member_zone_create(region_type* region)
member_zone->options.part_of_config = 0;
member_zone->options.is_catalog_member_zone = 1;
member_zone->member_id = NULL;
member_zone->prev_next_ptr = NULL;
member_zone->next = NULL;
member_zone->node = *RBTREE_NULL;
member_zone->node.key = (void*)member_zone;
return member_zone;
Expand Down
4 changes: 1 addition & 3 deletions options.h
Original file line number Diff line number Diff line change
Expand Up @@ -351,9 +351,7 @@ struct zone_options {
struct catalog_member_zone {
struct zone_options options;
const struct dname* member_id;
struct catalog_member_zone** prev_next_ptr;
struct catalog_member_zone* next;
/* member_id index in the associated catalog producer */
/* node in the associated catalog consumer or producer zone */
rbnode_type node;
} ATTR_PACKED;

Expand Down
2 changes: 1 addition & 1 deletion remote.c
Original file line number Diff line number Diff line change
Expand Up @@ -1058,7 +1058,7 @@ print_zonestatus(RES* ssl, xfrd_state_type* xfrd, struct zone_options* zo)
read_uint32(rdata_atom_data(
zone->soa_rrset->rrs[0].rdatas[2])),
consumer_zone
? consumer_zone->n_member_zones : 0))
? consumer_zone->member_ids.count : 0))
return 0;

} else if(!ssl_printf(ssl, "\n"))
Expand Down
Loading

0 comments on commit a526bc1

Please sign in to comment.