2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-01 15:05:23 +00:00

view cachedb support (API change)

This commit is contained in:
Bob Halley
1999-08-12 07:53:05 +00:00
parent 6975ca36a8
commit 5787fc1ed4

View File

@@ -54,7 +54,6 @@
#include "../../isc/util.h" /* XXXRTH */ #include "../../isc/util.h" /* XXXRTH */
static ns_dbinfo_t * cache_dbi;
static isc_task_t * server_task; static isc_task_t * server_task;
static dns_db_t * version_db; static dns_db_t * version_db;
static dns_view_t * version_view; static dns_view_t * version_view;
@@ -107,9 +106,15 @@ load(ns_dbinfo_t *dbi, char *view_name) {
printf("loaded\n"); printf("loaded\n");
if (dbi->iscache) { if (dbi->iscache) {
INSIST(cache_dbi == NULL); /*
dns_dbtable_adddefault(view->dbtable, dbi->db); * XXXRTH We must ensure that this is safe, since the
cache_dbi = dbi; * field is not covered by the view's lock.
*
* We're OK for now, but we'll have to be careful
* when we start processing the config file.
*/
INSIST(view->cachedb == NULL);
dns_db_attach(dbi->db, &view->cachedb);
} else if (dns_dbtable_add(view->dbtable, dbi->db) != DNS_R_SUCCESS) } else if (dns_dbtable_add(view->dbtable, dbi->db) != DNS_R_SUCCESS)
goto db_detach; goto db_detach;
@@ -232,12 +237,8 @@ unload_all(void) {
if (dbi->view != NULL) { if (dbi->view != NULL) {
INSIST(dbi->db != NULL); INSIST(dbi->db != NULL);
if (dns_db_iszone(dbi->db)) if (dns_db_iszone(dbi->db))
dns_dbtable_remove(dbi->view->dbtable, dbi->db); dns_dbtable_remove(dbi->view->dbtable,
else { dbi->db);
INSIST(dbi == cache_dbi);
dns_dbtable_removedefault(dbi->view->dbtable);
cache_dbi = NULL;
}
dns_db_detach(&dbi->db); dns_db_detach(&dbi->db);
dns_view_detach(&dbi->view); dns_view_detach(&dbi->view);
} }
@@ -312,18 +313,18 @@ ns_server_init(void) {
dns_view_t *view, *view_next; dns_view_t *view, *view_next;
/* /*
* XXXRTH The view management code here will probably move to its own module * XXXRTH The view management code here will probably move to its
* when we start using the config file. * own module when we start using the config file.
*/ */
view = NULL; view = NULL;
result = dns_view_create(ns_g_mctx, dns_rdataclass_in, "default/IN", result = dns_view_create(ns_g_mctx, dns_rdataclass_in, "default/IN",
NULL, &view); NULL, NULL, &view);
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
goto cleanup_views; goto cleanup_views;
ISC_LIST_APPEND(ns_g_viewlist, view, link); ISC_LIST_APPEND(ns_g_viewlist, view, link);
view = NULL; view = NULL;
result = dns_view_create(ns_g_mctx, dns_rdataclass_ch, "default/CHAOS", result = dns_view_create(ns_g_mctx, dns_rdataclass_ch, "default/CHAOS",
NULL, &view); NULL, NULL, &view);
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
goto cleanup_views; goto cleanup_views;
ISC_LIST_APPEND(ns_g_viewlist, view, link); ISC_LIST_APPEND(ns_g_viewlist, view, link);