From: Adam Dickmeiss Date: Fri, 27 Feb 2004 00:42:57 +0000 (+0000) Subject: Make workaround for FILE handles for libxml2 on Solaris where X-Git-Tag: YAZPP.0.7.10 X-Git-Url: http://lists.indexdata.dk/?a=commitdiff_plain;h=598464a40f5eea658ae9afafab11e5eaf0c1124c;p=yazpp-moved-to-github.git Make workaround for FILE handles for libxml2 on Solaris where maximum is 256 on 32-bit systems. Unix fd handles are OK. --- diff --git a/ChangeLog b/ChangeLog index c3303fa..1da5e86 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ --- 0.7.10 2004/02/27 Internal release. +Make workaround for FILE handles for libxml2 on Solaris where +maximum is 256 on 32-bit systems. Unix fd handles are OK. + Revise proxy algorithm for backend target selection. --- 0.7.9 2004/02/25 Internal release. diff --git a/etc/config.xml b/etc/config.xml index d06d163..a15fa3f 100644 --- a/etc/config.xml +++ b/etc/config.xml @@ -1,5 +1,5 @@ - + indexdata.dk @@ -27,7 +27,6 @@ localhost:9999 - localhost:9998 300 180 diff --git a/include/yaz++/proxy.h b/include/yaz++/proxy.h index e876aec..aafef3c 100644 --- a/include/yaz++/proxy.h +++ b/include/yaz++/proxy.h @@ -2,7 +2,7 @@ * Copyright (c) 1998-2004, Index Data. * See the file LICENSE for details. * - * $Id: proxy.h,v 1.40 2004-02-24 20:55:57 adam Exp $ + * $Id: proxy.h,v 1.41 2004-02-27 00:42:57 adam Exp $ */ #include @@ -93,7 +93,6 @@ private: int m_copy; int match_list(int v, const char *m); int atoi_l(const char **cp); - }; class YAZ_EXPORT Yaz_RecordCache { @@ -287,6 +286,10 @@ class YAZ_EXPORT Yaz_Proxy : public Yaz_Z_Assoc { Z_ElementSetNames *mk_esn_from_schema(ODR o, const char *schema); Z_ReferenceId *m_referenceId; NMEM m_referenceId_mem; +#define NO_SPARE_SOLARIS_FD 10 + int m_lo_fd[NO_SPARE_SOLARIS_FD]; + void low_socket_open(); + void low_socket_close(); public: Yaz_Proxy(IYaz_PDU_Observable *the_PDU_Observable, Yaz_Proxy *parent = 0); diff --git a/src/yaz-proxy.cpp b/src/yaz-proxy.cpp index d226e7b..5528cb1 100644 --- a/src/yaz-proxy.cpp +++ b/src/yaz-proxy.cpp @@ -2,11 +2,14 @@ * Copyright (c) 1998-2004, Index Data. * See the file LICENSE for details. * - * $Id: yaz-proxy.cpp,v 1.104 2004-02-26 23:43:07 adam Exp $ + * $Id: yaz-proxy.cpp,v 1.105 2004-02-27 00:42:58 adam Exp $ */ +#include #include #include +#include +#include #include #include @@ -128,6 +131,8 @@ Yaz_Proxy::Yaz_Proxy(IYaz_PDU_Observable *the_PDU_Observable, m_s2z_packing = Z_SRW_recordPacking_string; m_time_tv.tv_sec = 0; m_time_tv.tv_usec = 0; + if (!m_parent) + low_socket_open(); } Yaz_Proxy::~Yaz_Proxy() @@ -151,6 +156,8 @@ Yaz_Proxy::~Yaz_Proxy() odr_destroy(m_s2z_odr_init); if (m_s2z_odr_search) odr_destroy(m_s2z_odr_search); + if (!m_parent) + low_socket_close(); delete m_config; } @@ -639,6 +646,7 @@ void Yaz_Proxy::convert_xsl_delay() yaz_log(LOG_LOG, "%sXSLT convert %d", m_session_str, m_stylesheet_offset); res = xsltApplyStylesheet(m_stylesheet_xsp, doc, 0); + if (res) { xmlChar *out_buf; @@ -652,6 +660,7 @@ void Yaz_Proxy::convert_xsl_delay() xmlFree(out_buf); xmlFreeDoc(res); } + xmlFreeDoc(doc); } } @@ -1567,12 +1576,17 @@ Z_APDU *Yaz_Proxy::handle_syntax_validation(Z_APDU *apdu) &addinfo, &stylesheet_name, &m_schema); if (stylesheet_name) { + m_parent->low_socket_close(); + if (m_stylesheet_xsp) xsltFreeStylesheet(m_stylesheet_xsp); + m_stylesheet_xsp = xsltParseStylesheetFile((const xmlChar*) stylesheet_name); m_stylesheet_offset = 0; xfree(stylesheet_name); + + m_parent->low_socket_open(); } if (err == -1) { @@ -1609,12 +1623,17 @@ Z_APDU *Yaz_Proxy::handle_syntax_validation(Z_APDU *apdu) &addinfo, &stylesheet_name, &m_schema); if (stylesheet_name) { + m_parent->low_socket_close(); + if (m_stylesheet_xsp) xsltFreeStylesheet(m_stylesheet_xsp); + m_stylesheet_xsp = xsltParseStylesheetFile((const xmlChar*) stylesheet_name); m_stylesheet_offset = 0; xfree(stylesheet_name); + + m_parent->low_socket_open(); } if (err == -1) { @@ -2558,6 +2577,21 @@ void Yaz_ProxyClient::recv_Z_PDU(Z_APDU *apdu, int len) } } +void Yaz_Proxy::low_socket_close() +{ + int i; + for (i = 0; i= 0) + ::close(m_lo_fd[i]); +} + +void Yaz_Proxy::low_socket_open() +{ + int i; + for (i = 0; i