From 6eae0f60b55fed625a37954651ac3cf9cc39bf53 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Wed, 5 Oct 2011 13:29:58 +0200 Subject: [PATCH] Resolve host for database just before search Postpone resolving of host for database till just befor search so that we can take care of a setting to set the actual URL for target rather than use database ID as before. --- src/database.c | 7 ------- src/pazpar2_config.c | 2 -- src/session.c | 5 +++-- src/settings.h | 1 - 4 files changed, 3 insertions(+), 12 deletions(-) diff --git a/src/database.c b/src/database.c index 1a450af..2844d1b 100644 --- a/src/database.c +++ b/src/database.c @@ -124,13 +124,6 @@ int resolve_database(struct conf_service *service, struct database *db) return 0; } -void resolve_databases(struct conf_service *service) -{ - struct database *db = service->databases; - for (; db; db = db->next) - resolve_database(service, db); -} - struct database *new_database(const char *id, NMEM nmem) { struct database *db; diff --git a/src/pazpar2_config.c b/src/pazpar2_config.c index ba1e55a..c6567bd 100644 --- a/src/pazpar2_config.c +++ b/src/pazpar2_config.c @@ -625,7 +625,6 @@ struct conf_service *service_create(struct conf_server *server, if (service) { inherit_server_settings(service); - resolve_databases(service); assert(service->mutex == 0); pazpar2_mutex_create(&service->mutex, "conf"); } @@ -979,7 +978,6 @@ void config_process_events(struct conf_config *conf) for (;s ; s = s->next) { - resolve_databases(s); assert(s->mutex == 0); pazpar2_mutex_create(&s->mutex, "service"); } diff --git a/src/session.c b/src/session.c index 4478ece..06e49e8 100644 --- a/src/session.c +++ b/src/session.c @@ -526,6 +526,9 @@ static void select_targets_callback(struct session *se, { struct client *cl = client_create(); struct client_list *l; + + resolve_database(se->service, db->database); + client_set_database(cl, db); client_set_session(cl, se); @@ -717,8 +720,6 @@ static struct session_database *load_session_database(struct session *se, { struct database *db = new_database(id, se->session_nmem); - resolve_database(se->service, db); - session_init_databases_fun((void*) se, db); // New sdb is head of se->databases list diff --git a/src/settings.h b/src/settings.h index e6e70f4..4d1156a 100644 --- a/src/settings.h +++ b/src/settings.h @@ -70,7 +70,6 @@ int settings_num(struct conf_service *service); int settings_create_offset(struct conf_service *service, const char *name); int settings_lookup_offset(struct conf_service *service, const char *name); void init_settings(struct conf_service *service); -void resolve_databases(struct conf_service *service); void settings_read_node_x(xmlNode *n, void *client_data, void (*fun)(void *client_data, -- 1.7.10.4