* Copyright (C) 1995-2005, Index Data ApS
* See the file LICENSE for details.
*
- * $Id: seshigh.c,v 1.50 2005-03-05 09:17:27 adam Exp $
+ * $Id: seshigh.c,v 1.51 2005-03-05 12:14:12 adam Exp $
*/
/**
* \file seshigh.c
if (!strcmp((const char *) ptr->name, "explain"))
{
int len;
- ptr = xmlCopyNode(ptr, 1);
+ xmlDocPtr doc = xmlNewDoc("1.0");
+ xmlChar *buf_out;
+ char *content;
- xmlDocPtr doc = xmlNewDoc((const xmlChar *) "1.0");
+ ptr = xmlCopyNode(ptr, 1);
xmlDocSetRootElement(doc, ptr);
- xmlChar *buf_out;
xmlDocDumpMemory(doc, &buf_out, &len);
- char *content = (char*) odr_malloc(rr->stream, 1+len);
+ content = (char*) odr_malloc(rr->stream, 1+len);
memcpy(content, buf_out, len);
content[len] = '\0';
{
if (assoc->cql_transform)
{
+ int srw_error;
bsrr->scanClause = 0;
bsrr->attributeset = VAL_NONE;
bsrr->term = odr_malloc(assoc->decode, sizeof(*bsrr->term));
- int srw_error = cql2pqf_scan(assoc->encode,
+ srw_error = cql2pqf_scan(assoc->encode,
srw_req->scanClause.cql,
assoc->cql_transform,
bsrr->term);
assoc->init->implementation_name,
odr_prepend(assoc->encode, "GFS", resp->implementationName));
- version = odr_strdup(assoc->encode, "$Revision: 1.50 $");
+ version = odr_strdup(assoc->encode, "$Revision: 1.51 $");
if (strlen(version) > 10) /* check for unexpanded CVS strings */
version[strlen(version)-2] = '\0';
resp->implementationVersion = odr_prepend(assoc->encode,
* NT threaded server code by
* Chas Woodfield, Fretwell Downing Informatics.
*
- * $Id: statserv.c,v 1.24 2005-03-03 23:16:20 adam Exp $
+ * $Id: statserv.c,v 1.25 2005-03-05 12:14:12 adam Exp $
*/
/**
static char *me = "statserver"; /* log prefix */
static char *programname="statserver"; /* full program name */
-#if YAZ_POSIX_THREADS
+#ifdef WIN32
+DWORD current_control_tls;
+static int init_control_tls = 0;
+#elif YAZ_POSIX_THREADS
static pthread_key_t current_control_tls;
static int init_control_tls = 0;
#else
assoc->server_node_ptr = gfs->server_node_ptr;
assoc->last_control = &gfs->cb;
statserv_setcontrol(&gfs->cb);
+ yaz_log(YLOG_DEBUG, "server select: %s", gfs->cb.configname);
return 1;
}
}
assoc->last_control = 0;
assoc->cql_transform = 0;
assoc->server_node_ptr = 0;
+ yaz_log(YLOG_DEBUG, "server select: no match");
return 0;
}
else
assoc->last_control = &control_block;
assoc->cql_transform = 0;
assoc->server_node_ptr = 0;
+ yaz_log(YLOG_DEBUG, "server select: config=%s", control_block.configname);
return 1;
}
}
return;
for (ptr = ptr->children; ptr; ptr = ptr->next)
{
+ struct _xmlAttr *attr;
if (ptr->type != XML_ELEMENT_NODE)
continue;
- struct _xmlAttr *attr = ptr->properties;
+ attr = ptr->properties;
if (!strcmp((const char *) ptr->name, "listen"))
{
/*
static void xml_config_open()
{
+#ifdef WIN32
+ init_control_tls = 1;
+ current_control_tls = TlsAlloc();
+#elif YAZ_POSIX_THREADS
+ init_control_tls = 1;
+ pthread_key_create(¤t_control_tls, 0);
+#endif
+
gfs_nmem = nmem_create();
#if HAVE_XML2
if (control_block.xml_config[0] == '\0')
}
}
xml_config_read();
-
#endif
}
#endif
gfs_server_list = 0;
nmem_destroy(gfs_nmem);
+#ifdef WIN32
+ if (init_control_tls)
+ TlsFree(current_control_tls);
+#elif YAZ_POSIX_THREADS
+ if (init_control_tls)
+ pthread_key_delete(current_control_tls);
+#endif
}
static void xml_config_add_listeners()
yaz_log(YLOG_DEBUG, "Accept ok");
if (!(new_chan = iochan_create(cs_fileno(new_line), ir_session,
- EVENT_INPUT, parent_chan->port)))
+ EVENT_INPUT, parent_chan->chan_id)))
{
yaz_log(YLOG_FATAL, "Failed to create iochan");
iochan_destroy(h);
iochan_destroy(p);
}
xml_config_close();
-#if YAZ_POSIX_THREADS
- pthread_key_delete(current_control_tls);
-#endif
}
void sigterm(int sig)
statserv_options_block *statserv_getcontrol(void)
{
-#if YAZ_POSIX_THREADS
+#ifdef WIN32
+ if (init_control_tls)
+ return (statserv_options_block *) TlsGetValue(current_control_tls);
+ else
+ return &control_block;
+#elif YAZ_POSIX_THREADS
if (init_control_tls)
return pthread_getspecific(current_control_tls);
else
void statserv_setcontrol(statserv_options_block *block)
{
-#if YAZ_POSIX_THREADS
+#ifdef WIN32
+ if (init_control_tls)
+ TlsSetValue(current_control_tls, block);
+#elif YAZ_POSIX_THREADS
if (init_control_tls)
pthread_setspecific(current_control_tls, block);
#else
if (control_block.options_func(argc, argv))
return 1;
-#if YAZ_POSIX_THREADS
- init_control_tls = 1;
- pthread_key_create(¤t_control_tls, 0);
-#endif
-
xml_config_open();
xml_config_bend_start();