X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fstatserv.c;h=7d4af0b346bb3ea024300e982e8cc8f49bd4fa7e;hb=8170d48cb0b650f3d8ec35e3ad1e5fe0046eeecc;hp=a0eb0f5607216c2cadfdda5c32fb76b78ce4bd8b;hpb=275991dfabd62de0128770c061c7f780716cc16e;p=yaz-moved-to-github.git diff --git a/src/statserv.c b/src/statserv.c index a0eb0f5..7d4af0b 100644 --- a/src/statserv.c +++ b/src/statserv.c @@ -1,11 +1,11 @@ /* - * Copyright (C) 1995-2005, Index Data ApS + * Copyright (C) 1995-2006, Index Data ApS * See the file LICENSE for details. * * NT threaded server code by * Chas Woodfield, Fretwell Downing Informatics. * - * $Id: statserv.c,v 1.35 2006-03-22 13:50:46 mike Exp $ + * $Id: statserv.c,v 1.40 2006-07-07 13:02:21 marc Exp $ */ /** @@ -36,7 +36,7 @@ #include #endif -#if HAVE_XML2 +#if YAZ_HAVE_XML2 #include #include #include @@ -93,6 +93,7 @@ statserv_options_block control_block = { 1, /* dynamic mode */ 0, /* threaded mode */ 0, /* one shot (single session) */ + 0, /* __UNUSED_loglevel */ "", /* no PDUs */ "", /* diagnostic output to stderr */ "tcp:@:9999", /* default listener port */ @@ -126,7 +127,8 @@ statserv_options_block control_block = { static int max_sessions = 0; static int logbits_set = 0; -static int log_session = 0; +static int log_session = 0; /* one-line logs for session */ +static int log_sessiondetail = 0; /* more detailed stuff */ static int log_server = 0; /** get_logbits sets global loglevel bits */ @@ -136,6 +138,7 @@ static void get_logbits(int force) { logbits_set = 1; log_session = yaz_log_module_level("session"); + log_sessiondetail = yaz_log_module_level("sessiondetail"); log_server = yaz_log_module_level("server"); } } @@ -143,11 +146,11 @@ static void get_logbits(int force) static int add_listener(char *where, int listen_id); -#if HAVE_XML2 +#if YAZ_HAVE_XML2 static xmlDocPtr xml_config_doc = 0; #endif -#if HAVE_XML2 +#if YAZ_HAVE_XML2 static xmlNodePtr xml_config_get_root() { xmlNodePtr ptr = 0; @@ -167,7 +170,7 @@ static xmlNodePtr xml_config_get_root() } #endif -#if HAVE_XML2 +#if YAZ_HAVE_XML2 static char *nmem_dup_xml_content(NMEM n, xmlNodePtr ptr) { unsigned char *cp; @@ -221,6 +224,9 @@ static struct gfs_server * gfs_server_new() n->directory = 0; n->docpath = 0; n->stylesheet = 0; +#if YAZ_HAVE_XML2 + n->retrieval = yaz_retrieval_create(); +#endif return n; } @@ -264,10 +270,7 @@ int control_association(association *assoc, const char *host, int force_open) *cp = '\0'; host = vhost; } - assoc->cql_transform = 0; - assoc->server_node_ptr = 0; - assoc->docpath = 0; - assoc->stylesheet = 0; + assoc->server = 0; if (control_block.xml_config[0]) { struct gfs_server *gfs; @@ -295,10 +298,7 @@ int control_association(association *assoc, const char *host, int force_open) xfree(assoc->init); assoc->init = 0; } - assoc->docpath = gfs->docpath; - assoc->stylesheet = gfs->stylesheet; - assoc->cql_transform = gfs->cql_transform; - assoc->server_node_ptr = gfs->server_node_ptr; + assoc->server = gfs; assoc->last_control = &gfs->cb; statserv_setcontrol(&gfs->cb); gfs_server_chdir(gfs); @@ -324,7 +324,7 @@ static void xml_config_read() { struct gfs_server **gfsp = &gfs_server_list; struct gfs_listen **gfslp = &gfs_listen_list; -#if HAVE_XML2 +#if YAZ_HAVE_XML2 xmlNodePtr ptr = xml_config_get_root(); if (!ptr) @@ -429,6 +429,16 @@ static void xml_config_read() { ; /* being processed separately */ } + else if (!strcmp((const char *) ptr->name, "retrievalinfo")) + { + if (yaz_retrieval_configure((*gfsp)->retrieval, ptr)) + { + yaz_log(YLOG_FATAL, "%s in config %s", + yaz_retrieval_get_error((*gfsp)->retrieval), + control_block.xml_config); + exit(1); + } + } else { yaz_log(YLOG_FATAL, "Unknown element '%s' in config %s", @@ -459,7 +469,7 @@ static void xml_config_open() #endif gfs_nmem = nmem_create(); -#if HAVE_XML2 +#if YAZ_HAVE_XML2 if (control_block.xml_config[0] == '\0') return; @@ -488,7 +498,7 @@ static void xml_config_open() static void xml_config_close() { -#if HAVE_XML2 +#if YAZ_HAVE_XML2 if (xml_config_doc) { xmlFreeDoc(xml_config_doc); @@ -888,7 +898,7 @@ static void listener(IOCHAN h, int event) return; } - yaz_log(log_session, "Connect from %s", cs_addrstr(new_line)); + yaz_log(log_sessiondetail, "Connect from %s", cs_addrstr(new_line)); no_sessions++; if (control_block.dynamic) @@ -1005,7 +1015,7 @@ static void *new_session (void *vp) #else a = 0; #endif - yaz_log(log_session, "Starting session %d from %s (pid=%ld)", + yaz_log(log_session, "Session - OK %d %s %ld", no_sessions, a ? a : "[Unknown]", (long) getpid()); if (max_sessions && no_sessions >= max_sessions) control_block.one_shot = 1; @@ -1042,7 +1052,7 @@ static void inetd_connection(int what) iochan_setdata(chan, assoc); iochan_settimeout(chan, 60); addr = cs_addrstr(line); - yaz_log(log_session, "Inetd association from %s", + yaz_log(log_sessiondetail, "Inetd association from %s", addr ? addr : "[UNKNOWN]"); assoc->cs_get_mask = EVENT_INPUT; } @@ -1432,7 +1442,7 @@ int check_options(int argc, char **argv) option_copy(control_block.pid_fname, arg); break; case 'f': -#if HAVE_XML2 +#if YAZ_HAVE_XML2 option_copy(control_block.xml_config, arg); #else fprintf(stderr, "%s: Option -f unsupported since YAZ is compiled without Libxml2 support\n", me);