X-Git-Url: http://git.indexdata.com/?p=yazproxy-moved-to-github.git;a=blobdiff_plain;f=src%2Fyaz-proxy.cpp;h=4c176187716eecf8e1649c2b4017ad0ab05b4397;hp=9915853e6e7e0a027d1a4894ea0e696e65119d14;hb=d9997f1b704904dc68a1c6ccf7f66f0009c59a21;hpb=32e20aac80d955f4eaa2b78dfd99788bbc02edb2 diff --git a/src/yaz-proxy.cpp b/src/yaz-proxy.cpp index 9915853..4c17618 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.40 2005-11-29 09:17:37 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, @@ -1105,6 +1107,9 @@ int Yaz_Proxy::send_http_response(int code) m_bytes_sent += len; m_bw_stat.add_bytes(len); logtime(); + + recv_GDU_more(true); + return r; } @@ -1151,6 +1156,9 @@ int Yaz_Proxy::send_srw_response(Z_SRW_PDU *srw_pdu) m_bytes_sent += len; m_bw_stat.add_bytes(len); logtime(); + + recv_GDU_more(true); + return r; } @@ -1797,7 +1805,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 +1816,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 @@ -1830,8 +1836,8 @@ void Yaz_Proxy::recv_GDU_more(bool normal) void Yaz_Proxy::recv_GDU_normal(GDU *gdu) { - Z_GDU *apdu = gdu->get(); - gdu->extract_odr_to(odr_decode()); + Z_GDU *apdu = 0; + gdu->move_away_gdu(odr_decode(), &apdu); delete gdu; if (apdu->which == Z_GDU_Z3950) @@ -2013,9 +2019,10 @@ void Yaz_Proxy::handle_charset_lang_negotiation(Z_APDU *apdu) { ODR_MASK_SET(initResponse->options, Z_Options_negotiationModel); - ODR_MASK_SET(m_initRequest_options, - Z_Options_negotiationModel); - + if (m_initRequest_options) + ODR_MASK_SET(m_initRequest_options, + Z_Options_negotiationModel); + oi->which = Z_OtherInfo_externallyDefinedInfo; oi->information.externallyDefinedInfo = yaz_set_response_charneg( @@ -2453,6 +2460,7 @@ int Yaz_Proxy::file_access(Z_HTTP_Request *hreq) } int len; send_GDU(gdu, &len); + recv_GDU_more(true); return 1; } @@ -2606,7 +2614,8 @@ void Yaz_Proxy::handle_incoming_HTTP(Z_HTTP_Request *hreq) const char *pqf_msg; size_t off; int code = yaz_pqf_error (pqf_parser, &pqf_msg, &off); - yaz_log(YLOG_LOG, "%*s^\n", off+4, ""); + int ioff = off; + yaz_log(YLOG_LOG, "%*s^\n", ioff+4, ""); yaz_log(YLOG_LOG, "Bad PQF: %s (code %d)\n", pqf_msg, code); send_to_srw_client_error(10, 0); @@ -3164,7 +3173,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 +3194,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,