X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fpazpar2_config.c;h=290a39a7ea25a47ecf3ea90c39a701172eec5817;hb=24ad8ea356d71c764af19897e2719670a94a3a05;hp=a122f8d3019bca0662e2cae2429ac289fab16653;hpb=b972315420350bd3bf13377559094b552c817e49;p=pazpar2-moved-to-github.git diff --git a/src/pazpar2_config.c b/src/pazpar2_config.c index a122f8d..290a39a 100644 --- a/src/pazpar2_config.c +++ b/src/pazpar2_config.c @@ -53,6 +53,7 @@ struct conf_config struct conf_server *servers; int no_threads; + int max_sockets; WRBUF confdir; char *path; iochan_man_t iochan_man; @@ -1145,15 +1146,14 @@ static void info_service_metadata(struct conf_service *service, WRBUF w) static void info_service_databases(struct conf_service *service, WRBUF w) { - struct database *db; - struct setting *s; - int i; if (service->databases) { + struct database *db; wrbuf_puts(w, " \n"); - for(db = service->databases; db; db = db->next) + for (db = service->databases; db; db = db->next) { + int i; wrbuf_puts(w, " id) { @@ -1164,18 +1164,16 @@ static void info_service_databases(struct conf_service *service, WRBUF w) wrbuf_puts(w, ">\n"); for (i = 0; i < db->num_settings; i++) { - s = db->settings[i]; - while (s != NULL) + struct setting *s = db->settings[i]; + for (; s; s = s->next) { - wrbuf_puts(w, " name); wrbuf_puts(w, "\""); wrbuf_puts(w, " value=\""); wrbuf_xmlputs(w, s->value); wrbuf_puts(w, "\""); wrbuf_puts(w, " />\n"); - s = s->next; } } wrbuf_puts(w, " \n"); @@ -1188,7 +1186,6 @@ void info_services(struct conf_server *server, WRBUF w) { struct conf_service *s = server->service; int i; - struct setting *S; wrbuf_puts(w, " \n"); for (; s; s = s->next) @@ -1203,34 +1200,30 @@ void info_services(struct conf_server *server, WRBUF w) wrbuf_puts(w, ">\n"); if (s->settings) { - for (i=0; isettings->num_settings; i++) + for (i = 0; i < s->settings->num_settings; i++) { - S = s->settings->settings[i]; - while (S != NULL) { - wrbuf_puts(w, " settings->settings[i]; + for (; S; S = S->next) + { + wrbuf_puts(w, " name); wrbuf_puts(w, "\""); wrbuf_puts(w, " value=\""); wrbuf_xmlputs(w, S->value); wrbuf_puts(w, "\""); - if (S->target) { + if (S->target) + { wrbuf_puts(w, " target=\""); wrbuf_xmlputs(w, S->target); wrbuf_puts(w, "\""); } - wrbuf_puts(w, " />\n"); - - S = S->next; } } } info_service_metadata(s, w); info_service_databases(s, w); - wrbuf_puts(w, " "); - - wrbuf_puts(w, "\n"); + wrbuf_puts(w, " \n"); } wrbuf_puts(w, " \n"); } @@ -1260,6 +1253,15 @@ static int parse_config(struct conf_config *config, xmlNode *root) xmlFree(number); } } + else if (!strcmp((const char *) n->name, "sockets")) + { + xmlChar *number = xmlGetProp(n, (xmlChar *) "max"); + if (number) + { + config->max_sockets = atoi((const char *) number); + xmlFree(number); + } + } else if (!strcmp((const char *) n->name, "file")) { xmlChar *path = xmlGetProp(n, (xmlChar *) "path"); @@ -1317,6 +1319,7 @@ struct conf_config *config_create(const char *fname) config->servers = 0; config->path = nmem_strdup(nmem, "."); config->no_threads = 0; + config->max_sockets = 0; config->iochan_man = 0; config->confdir = wrbuf_alloc(); @@ -1419,7 +1422,7 @@ int config_start_listeners(struct conf_config *conf, { struct conf_server *ser; - conf->iochan_man = iochan_man_create(conf->no_threads); + conf->iochan_man = iochan_man_create(conf->no_threads, conf->max_sockets); for (ser = conf->servers; ser; ser = ser->next) { WRBUF w;