From 92c0519af66131a46fbb398ce037009be2e8d0c5 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Mon, 20 Oct 2003 18:31:43 +0000 Subject: [PATCH] Better reporting of statistics. Handling of ODR decode improved --- include/yaz++/proxy.h | 4 ++-- src/config.xml | 12 ++++++------ src/yaz-pdu-assoc.cpp | 4 ++-- src/yaz-proxy-config.cpp | 5 ++--- src/yaz-proxy.cpp | 28 ++++++++++++++++++++++------ src/yaz-z-assoc.cpp | 6 ++++-- 6 files changed, 38 insertions(+), 21 deletions(-) diff --git a/include/yaz++/proxy.h b/include/yaz++/proxy.h index be82f31..78ecf4c 100644 --- a/include/yaz++/proxy.h +++ b/include/yaz++/proxy.h @@ -2,7 +2,7 @@ * Copyright (c) 1998-2003, Index Data. * See the file LICENSE for details. * - * $Id: proxy.h,v 1.19 2003-10-16 16:10:43 adam Exp $ + * $Id: proxy.h,v 1.20 2003-10-20 18:31:43 adam Exp $ */ #include @@ -59,7 +59,7 @@ public: private: void operator=(const Yaz_ProxyConfig &conf); #if HAVE_XML2 - int mycmp(const char *hay, const char *item, int len); + int mycmp(const char *hay, const char *item, size_t len); xmlDocPtr m_docPtr; xmlNodePtr m_proxyPtr; void return_target_info(xmlNodePtr ptr, const char **url, diff --git a/src/config.xml b/src/config.xml index 4d4b08e..b07af96 100644 --- a/src/config.xml +++ b/src/config.xml @@ -1,10 +1,10 @@ - + - z3950.loc.gov:7090/voyager - z3950.loc.gov:7094/voyager + z3950.loc.gov:7090 + z3950.loc.gov:7094 500000 500 @@ -16,12 +16,12 @@ - 300 + 240 180 - 0 + 2 localhost:9999 @@ -38,7 +38,7 @@ - 2 + 0 diff --git a/src/yaz-pdu-assoc.cpp b/src/yaz-pdu-assoc.cpp index 2eec370..aa149d6 100644 --- a/src/yaz-pdu-assoc.cpp +++ b/src/yaz-pdu-assoc.cpp @@ -2,7 +2,7 @@ * Copyright (c) 1998-2003, Index Data. * See the file LICENSE for details. * - * $Id: yaz-pdu-assoc.cpp,v 1.34 2003-10-16 16:10:43 adam Exp $ + * $Id: yaz-pdu-assoc.cpp,v 1.35 2003-10-20 18:31:44 adam Exp $ */ #include @@ -210,9 +210,9 @@ void Yaz_PDU_Assoc::socketNotify(int event) return; m_PDU_Observer->recv_PDU(m_input_buf, res); - m_destroyed = 0; if (destroyed) // it really was destroyed, return now. return; + m_destroyed = 0; } while (m_cs && cs_more (m_cs)); if (m_cs && m_state == Ready) { diff --git a/src/yaz-proxy-config.cpp b/src/yaz-proxy-config.cpp index 9306899..1e75fde 100644 --- a/src/yaz-proxy-config.cpp +++ b/src/yaz-proxy-config.cpp @@ -2,7 +2,7 @@ * Copyright (c) 1998-2003, Index Data. * See the file LICENSE for details. * - * $Id: yaz-proxy-config.cpp,v 1.11 2003-10-16 16:10:43 adam Exp $ + * $Id: yaz-proxy-config.cpp,v 1.12 2003-10-20 18:31:44 adam Exp $ */ #include @@ -283,7 +283,6 @@ int Yaz_ProxyConfig::check_type_1_structure(ODR odr, xmlNodePtr ptr, Z_RPNStructure *q, char **addinfo) { - int c; if (q->which == Z_RPNStructure_complex) { int e = check_type_1_structure(odr, ptr, q->u.complex->s1, addinfo); @@ -497,7 +496,7 @@ int Yaz_ProxyConfig::get_target_no(int no, return 0; } -int Yaz_ProxyConfig::mycmp(const char *hay, const char *item, int len) +int Yaz_ProxyConfig::mycmp(const char *hay, const char *item, size_t len) { if (len == strlen(item) && memcmp(hay, item, len) == 0) return 1; diff --git a/src/yaz-proxy.cpp b/src/yaz-proxy.cpp index 5f323b7..996f258 100644 --- a/src/yaz-proxy.cpp +++ b/src/yaz-proxy.cpp @@ -2,7 +2,7 @@ * Copyright (c) 1998-2003, Index Data. * See the file LICENSE for details. * - * $Id: yaz-proxy.cpp,v 1.62 2003-10-16 16:10:43 adam Exp $ + * $Id: yaz-proxy.cpp,v 1.63 2003-10-20 18:31:44 adam Exp $ */ #include @@ -258,6 +258,11 @@ Yaz_ProxyClient *Yaz_Proxy::get_client(Z_APDU *apdu) Yaz_ProxyConfig *cfg = check_reconfigure(); if (proxy_host) { +#if 0 +/* only to be enabled for debugging... */ + if (!strcmp(proxy_host, "stop")) + exit(0); +#endif xfree(m_default_target); m_default_target = xstrdup(proxy_host); proxy_host = m_default_target; @@ -1321,15 +1326,26 @@ void Yaz_Proxy::pre_init() { Yaz_ProxyClient *c; int spare = 0; + int in_use = 0; + int other = 0; for (c = m_clientPool; c; c = c->m_next) { - if (!strcmp(zurl_in_use[j], c->get_hostname()) - && c->m_server == 0 && c->m_cookie == 0) - spare++; + if (!strcmp(zurl_in_use[j], c->get_hostname())) + { + if (c->m_cookie == 0) + { + if (c->m_server == 0) + spare++; + else + in_use++; + } + else + other++; + } } - yaz_log(LOG_LOG, "%s pre-init %s %s spare=%d pre_init=%d", + yaz_log(LOG_LOG, "%s pre-init %s %s use=%d other=%d spare=%d preinit=%d", m_session_str, - name, zurl_in_use[j], spare, pre_init); + name, zurl_in_use[j], in_use, other, spare, pre_init); if (spare < pre_init) { c = new Yaz_ProxyClient(m_PDU_Observable->clone(), this); diff --git a/src/yaz-z-assoc.cpp b/src/yaz-z-assoc.cpp index 08e1976..bb696ce 100644 --- a/src/yaz-z-assoc.cpp +++ b/src/yaz-z-assoc.cpp @@ -1,8 +1,8 @@ /* - * Copyright (c) 1998-2001, Index Data. + * Copyright (c) 1998-2003, Index Data. * See the file LICENSE for details. * - * $Id: yaz-z-assoc.cpp,v 1.28 2003-10-16 16:10:43 adam Exp $ + * $Id: yaz-z-assoc.cpp,v 1.29 2003-10-20 18:31:44 adam Exp $ */ #include @@ -63,6 +63,7 @@ int Yaz_Z_Assoc::set_APDU_yazlog(int v) { int old = m_APDU_yazlog; m_APDU_yazlog = v; + return old; } const char *Yaz_Z_Assoc::get_APDU_log() @@ -92,6 +93,7 @@ void Yaz_Z_Assoc::recv_PDU(const char *buf, int len) else { close(); + failNotify(); } } -- 1.7.10.4