From 32c6e333211e98fe4ad78fb86f2c9acd444ca24f Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Mon, 26 Sep 2005 09:25:05 +0000 Subject: [PATCH] Make room for limit-search and limit-connect --- include/yazproxy/proxy.h | 5 +++-- src/proxyp.h | 5 ++++- src/yaz-proxy-config.cpp | 41 ++++++++++++++++++++++++++++++++++------- src/yaz-proxy.cpp | 11 ++++++----- 4 files changed, 47 insertions(+), 15 deletions(-) diff --git a/include/yazproxy/proxy.h b/include/yazproxy/proxy.h index 7473539..4c41242 100644 --- a/include/yazproxy/proxy.h +++ b/include/yazproxy/proxy.h @@ -1,4 +1,4 @@ -/* $Id: proxy.h,v 1.23 2005-08-15 12:54:02 adam Exp $ +/* $Id: proxy.h,v 1.24 2005-09-26 09:25:05 adam Exp $ Copyright (c) 1998-2005, Index Data. This file is part of the yaz-proxy. @@ -102,10 +102,11 @@ class YAZ_EXPORT Yaz_Proxy : public yazpp_1::Z_Assoc { timeout_xsl } m_timeout_mode; + int m_connect_max; + int m_search_max; Yaz_bw m_bw_stat; int m_pdu_max; Yaz_bw m_pdu_stat; - Z_GDU *m_bw_hold_PDU; int m_max_record_retrieve; void handle_max_record_retrieve(Z_APDU *apdu); void display_diagrecs(Z_DiagRec **pp, int num); diff --git a/src/proxyp.h b/src/proxyp.h index c7c6a6c..7ab1ea0 100644 --- a/src/proxyp.h +++ b/src/proxyp.h @@ -1,4 +1,4 @@ -/* $Id: proxyp.h,v 1.9 2005-06-25 15:58:33 adam Exp $ +/* $Id: proxyp.h,v 1.10 2005-09-26 09:25:05 adam Exp $ Copyright (c) 1998-2005, Index Data. This file is part of the yaz-proxy. @@ -90,6 +90,8 @@ public: int *limit_bw, int *limit_pdu, int *limit_req, + int *limit_search, + int *limit_connect, int *target_idletime, int *client_idletime, int *max_clients, @@ -106,6 +108,7 @@ public: void get_target_info(const char *name, const char **url, int *limit_bw, int *limit_pdu, int *limit_req, + int *limit_search, int *limit_connect, int *target_idletime, int *client_idletime, int *max_clients, int *keepalive_limit_bw, int *keepalive_limit_pdu, diff --git a/src/yaz-proxy-config.cpp b/src/yaz-proxy-config.cpp index 8b98f11..5bc04fc 100644 --- a/src/yaz-proxy-config.cpp +++ b/src/yaz-proxy-config.cpp @@ -1,4 +1,4 @@ -/* $Id: yaz-proxy-config.cpp,v 1.22 2005-06-25 15:58:33 adam Exp $ +/* $Id: yaz-proxy-config.cpp,v 1.23 2005-09-26 09:25:06 adam Exp $ Copyright (c) 1998-2005, Index Data. This file is part of the yaz-proxy. @@ -39,6 +39,7 @@ class Yaz_ProxyConfigP { xmlNodePtr m_proxyPtr; void return_target_info(xmlNodePtr ptr, const char **url, int *limit_bw, int *limit_pdu, int *limit_req, + int *limit_search, int *limit_connect, int *target_idletime, int *client_idletime, int *keepalive_limit_bw, int *keepalive_limit_pdu, int *pre_init, const char **cql2rpn, @@ -46,7 +47,8 @@ class Yaz_ProxyConfigP { const char **negotiation_lang, const char **target_charset); void return_limit(xmlNodePtr ptr, - int *limit_bw, int *limit_pdu, int *limit_req); + int *limit_bw, int *limit_pdu, int *limit_req, + int *limit_search, int *limit_connect); int check_type_1(ODR odr, xmlNodePtr ptr, Z_RPNQuery *query, char **addinfo); xmlNodePtr find_target_node(const char *name, const char *db); @@ -166,9 +168,11 @@ const char *Yaz_ProxyConfigP::get_text(xmlNodePtr ptr) #if HAVE_XSLT void Yaz_ProxyConfigP::return_limit(xmlNodePtr ptr, - int *limit_bw, - int *limit_pdu, - int *limit_req) + int *limit_bw, + int *limit_pdu, + int *limit_req, + int *limit_search, + int *limit_connect) { for (ptr = ptr->children; ptr; ptr = ptr->next) { @@ -193,6 +197,20 @@ void Yaz_ProxyConfigP::return_limit(xmlNodePtr ptr, if (t) *limit_pdu = atoi(t); } + if (ptr->type == XML_ELEMENT_NODE + && !strcmp((const char *) ptr->name, "search")) + { + const char *t = get_text(ptr); + if (t) + *limit_search = atoi(t); + } + if (ptr->type == XML_ELEMENT_NODE + && !strcmp((const char *) ptr->name, "connect")) + { + const char *t = get_text(ptr); + if (t) + *limit_connect = atoi(t); + } } } #endif @@ -203,6 +221,8 @@ void Yaz_ProxyConfigP::return_target_info(xmlNodePtr ptr, int *limit_bw, int *limit_pdu, int *limit_req, + int *limit_search, + int *limit_connect, int *target_idletime, int *client_idletime, int *keepalive_limit_bw, @@ -241,11 +261,12 @@ void Yaz_ProxyConfigP::return_target_info(xmlNodePtr ptr, *keepalive_limit_bw = 500000; *keepalive_limit_pdu = 1000; return_limit(ptr, keepalive_limit_bw, keepalive_limit_pdu, - &dummy); + &dummy, &dummy, &dummy); } if (ptr->type == XML_ELEMENT_NODE && !strcmp((const char *) ptr->name, "limit")) - return_limit(ptr, limit_bw, limit_pdu, limit_req); + return_limit(ptr, limit_bw, limit_pdu, limit_req, + limit_search, limit_connect); if (ptr->type == XML_ELEMENT_NODE && !strcmp((const char *) ptr->name, "target-timeout")) { @@ -900,6 +921,8 @@ int Yaz_ProxyConfig::get_target_no(int no, int *limit_bw, int *limit_pdu, int *limit_req, + int *limit_search, + int *limit_connect, int *target_idletime, int *client_idletime, int *max_clients, @@ -935,6 +958,7 @@ int Yaz_ProxyConfig::get_target_no(int no, m_cp->return_target_info( ptr, url, limit_bw, limit_pdu, limit_req, + limit_search, limit_connect, target_idletime, client_idletime, keepalive_limit_bw, keepalive_limit_pdu, pre_init, cql2rpn, @@ -1129,6 +1153,8 @@ void Yaz_ProxyConfig::get_target_info(const char *name, int *limit_bw, int *limit_pdu, int *limit_req, + int *limit_search, + int *limit_connect, int *target_idletime, int *client_idletime, int *max_clients, @@ -1172,6 +1198,7 @@ void Yaz_ProxyConfig::get_target_info(const char *name, url[1] = 0; } m_cp->return_target_info(ptr, url, limit_bw, limit_pdu, limit_req, + limit_search, limit_connect, target_idletime, client_idletime, keepalive_limit_bw, keepalive_limit_pdu, pre_init, cql2rpn, diff --git a/src/yaz-proxy.cpp b/src/yaz-proxy.cpp index 9915853..f096210 100644 --- a/src/yaz-proxy.cpp +++ b/src/yaz-proxy.cpp @@ -1,4 +1,4 @@ -/* $Id: yaz-proxy.cpp,v 1.36 2005-09-12 20:09:14 adam Exp $ +/* $Id: yaz-proxy.cpp,v 1.37 2005-09-26 09:25:06 adam Exp $ Copyright (c) 1998-2005, Index Data. This file is part of the yaz-proxy. @@ -219,9 +219,10 @@ Yaz_Proxy::Yaz_Proxy(IPDU_Observable *the_PDU_Observable, m_session_no = 0; m_bytes_sent = 0; m_bytes_recv = 0; - m_bw_hold_PDU = 0; m_bw_max = 0; m_pdu_max = 0; + m_search_max = 0; + m_connect_max = 0; m_timeout_mode = timeout_normal; m_timeout_gdu = 0; m_max_record_retrieve = 0; @@ -537,6 +538,7 @@ Yaz_ProxyClient *Yaz_Proxy::get_client(Z_APDU *apdu, const char *cookie, int pre_init = 0; cfg->get_target_info(proxy_host, url, &m_bw_max, &m_pdu_max, &m_max_record_retrieve, + &m_search_max, &m_connect_max, &m_target_idletime, &client_idletime, &parent->m_max_clients, &m_keepalive_limit_bw, @@ -1797,7 +1799,6 @@ void Yaz_Proxy::recv_GDU_reduce(GDU *gdu) /* uncomment to force a big reduce */ m_timeout_mode = timeout_reduce; m_timeout_gdu = gdu; - // m_bw_hold_PDU = apdu; // save PDU and signal "on hold" timeout(3); // call us reduce seconds later return; #endif @@ -1809,7 +1810,6 @@ void Yaz_Proxy::recv_GDU_reduce(GDU *gdu) m_timeout_mode = timeout_reduce; m_timeout_gdu = gdu; - // m_bw_hold_PDU = apdu; // save PDU and signal "on hold" timeout(reduce); // call us reduce seconds later } else @@ -3164,7 +3164,7 @@ void Yaz_Proxy::pre_init() int i; const char *name = 0; const char *zurl_in_use[MAX_ZURL_PLEX]; - int limit_bw, limit_pdu, limit_req; + int limit_bw, limit_pdu, limit_req, limit_search, limit_connect; int target_idletime, client_idletime; int max_clients; int keepalive_limit_bw, keepalive_limit_pdu; @@ -3185,6 +3185,7 @@ void Yaz_Proxy::pre_init() for (i = 0; cfg && cfg->get_target_no(i, &name, zurl_in_use, &limit_bw, &limit_pdu, &limit_req, + &limit_search, &limit_connect, &target_idletime, &client_idletime, &max_clients, &keepalive_limit_bw, -- 1.7.10.4