X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=src%2Fstatserv.c;h=a0392513abaf51ef97704da821ecdb9808b0da97;hp=d340a179a99f23a856baebf61d110ee7e4ce271b;hb=7d7e192def2fef342d235ea894eddb1e89edd714;hpb=f0d23836907782b75c45f9572ff0df25561b2cf8 diff --git a/src/statserv.c b/src/statserv.c index d340a17..a039251 100644 --- a/src/statserv.c +++ b/src/statserv.c @@ -1,5 +1,5 @@ /* This file is part of the YAZ toolkit. - * Copyright (C) 1995-2010 Index Data + * Copyright (C) 1995-2011 Index Data * See the file LICENSE for details. */ @@ -8,10 +8,13 @@ * \brief Implements GFS logic */ +#if HAVE_CONFIG_H +#include +#endif + #include #include #include -#include #ifdef WIN32 #include @@ -60,6 +63,7 @@ #include "session.h" #include #include +#include static IOCHAN pListener = NULL; @@ -191,7 +195,7 @@ static char *nmem_dup_xml_content(NMEM n, xmlNodePtr ptr) cp = p->content; if (first) { - while(*cp && isspace(*cp)) + while(*cp && yaz_isspace(*cp)) cp++; if (*cp) first = 0; /* reset if we got non-whitespace out */ @@ -201,7 +205,7 @@ static char *nmem_dup_xml_content(NMEM n, xmlNodePtr ptr) } /* remove trailing whitespace */ cp = strlen((const char *)str) + str; - while (cp != str && isspace(cp[-1])) + while (cp != str && yaz_isspace(cp[-1])) cp--; *cp = '\0'; /* return resulting string */ @@ -414,9 +418,14 @@ static void xml_config_read(void) } else if (!strcmp((const char *) ptr->name, "cql2rpn")) { - gfs->cql_transform = cql_transform_open_fname( - nmem_dup_xml_content(gfs_nmem, ptr->children) - ); + char *name = nmem_dup_xml_content(gfs_nmem, ptr->children); + gfs->cql_transform = cql_transform_open_fname(name); + if (!gfs->cql_transform) + { + yaz_log(YLOG_FATAL|YLOG_ERRNO, + "open CQL transform file '%s'", name); + exit(1); + } } else if (!strcmp((const char *) ptr->name, "ccl2rpn")) { @@ -606,6 +615,8 @@ static void xml_config_bend_stop(void) } } +static void remove_listeners(void); + /* * handle incoming connect requests. * The dynamic mode is a bit tricky mostly because we want to avoid @@ -905,6 +916,9 @@ static void listener(IOCHAN h, int event) return; } + if (control_block.one_shot) + remove_listeners(); + yaz_log(log_sessiondetail, "Connect from %s", cs_addrstr(new_line)); no_sessions++; @@ -1125,6 +1139,13 @@ static int add_listener(char *where, int listen_id) return 0; /* OK */ } +static void remove_listeners(void) +{ + IOCHAN l = pListener; + for (; l; l = l->next) + iochan_destroy(l); +} + #ifndef WIN32 /* UNIX only (for windows we don't need to catch the signals) */ static void catchchld(int num)