X-Git-Url: http://sru.miketaylor.org.uk/?a=blobdiff_plain;f=src%2Fyaz-proxy.cpp;h=0dc0669c5adfa10dd72be481aa4b69dbe8440bad;hb=7e3e46d9a207d1c6d56704b64c2ebee58b170795;hp=c5bd0a7170c8bc7079db41301c6486d441f8b676;hpb=72ab66893bb6ab593313e144d03bf7ee0806b9f0;p=yazpp-moved-to-github.git diff --git a/src/yaz-proxy.cpp b/src/yaz-proxy.cpp index c5bd0a7..0dc0669 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.65 2003-10-23 09:08:52 adam Exp $ + * $Id: yaz-proxy.cpp,v 1.70 2003-11-08 18:51:10 adam Exp $ */ #include @@ -72,7 +72,7 @@ Yaz_Proxy::Yaz_Proxy(IYaz_PDU_Observable *the_PDU_Observable, m_client_idletime = 600; m_target_idletime = 600; m_optimize = xstrdup ("1"); - strcpy(m_session_str, "0"); + strcpy(m_session_str, "0 "); m_session_no=0; m_bytes_sent = m_bytes_recv = 0; m_bw_hold_PDU = 0; @@ -895,7 +895,6 @@ void Yaz_Proxy::recv_Z_PDU(Z_APDU *apdu, int len) if (cp) sprintf(cp+1, "%d ", m_request_no); - int reduce = 0; m_bytes_recv += len; if (m_log_mask & PROXY_LOG_APDU_CLIENT) @@ -913,6 +912,7 @@ void Yaz_Proxy::recv_Z_PDU(Z_APDU *apdu, int len) yaz_log(LOG_LOG, "%sstat bw=%d pdu=%d limit-bw=%d limit-pdu=%d", m_session_str, bw_total, pdu_total, m_bw_max, m_pdu_max); + int reduce = 0; if (m_bw_max) { if (bw_total > m_bw_max) @@ -924,7 +924,7 @@ void Yaz_Proxy::recv_Z_PDU(Z_APDU *apdu, int len) { if (pdu_total > m_pdu_max) { - int nreduce = (60/m_pdu_max); + int nreduce = (m_pdu_max >= 60) ? 1 : 60/m_pdu_max; reduce = (reduce > nreduce) ? reduce : nreduce; } } @@ -1340,8 +1340,8 @@ void Yaz_Proxy::pre_init() other++; } } - yaz_log(LOG_LOG, "%s pre-init %s %s use=%d other=%d spare=%d preinit=%d", - m_session_str, + yaz_log(LOG_LOG, "%spre-init %s %s use=%d other=%d spare=%d " + "preinit=%d",m_session_str, name, zurl_in_use[j], in_use, other, spare, pre_init); if (spare < pre_init) { @@ -1529,11 +1529,14 @@ void Yaz_ProxyClient::recv_Z_PDU(Z_APDU *apdu, int len) } } -void Yaz_Proxy::server(const char *addr) +int Yaz_Proxy::server(const char *addr) { - Yaz_Z_Assoc::server(addr); - - yaz_log(LOG_LOG, "started OK"); - timeout(1); + int r = Yaz_Z_Assoc::server(addr); + if (!r) + { + yaz_log(LOG_LOG, "%sStarted listener on %s", m_session_str, addr); + timeout(1); + } + return r; }