From 8a5c15d9e63b15fa2ea9399521a7eeacebbab13e Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Mon, 16 Feb 2004 10:47:37 +0000 Subject: [PATCH] For yaz-proxy, allow maximum number of files to be specified (setrlimit) with option -n for yaz-proxy. Log the number of max files with getrlimit always. --- ChangeLog | 23 +++++++++++++---------- src/yaz-proxy-main.cpp | 34 +++++++++++++++++++++++++++------- src/yaz-proxy.cpp | 6 +++++- 3 files changed, 45 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index f1e1190..ff7529c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,27 +1,30 @@ -Fixed SEGV bug that occured when duplicate init requests was received and -no cached init response was available. +For yaz-proxy, allow maximum number of files to be specified (setrlimit) with +option -n for yaz-proxy. Log the number of max files with getrlimit always. -Add MODS version 3 conversion, MARC21slim2MODS3.xsl. Update voyager.xml, -config.xml to use it. Default "mods" is still MODS v2. +For yaz-proxy, fixed SEGV bug that occured when duplicate init requests was received and no cached init response was available. + +For yaz-proxy, added MODS version 3 conversion, MARC21slim2MODS3.xsl. +Updated voyager.xml, config.xml to use it. Default "mods" is still MODS v2. --- 0.7.7 2004/02/10 Internal release. Make proxy perform keepalive when receiving SIGBUS. -Fix problem with fixup of referenceId's. +For yaz-proxy, fixed problem with fixup of referenceId's. --- 0.7.6 2004/02/05 Internal release. -Force correct referenceID's. +For yaz-proxy, force correct referenceID's. -Log libxml2/libxslt errors in yaz log. +For yaz-proxy, log libxml2/libxslt errors in yaz log. -Update proxy to work with SRW diagnostic code as a URI/string. +Update yaz-proxy to work with SRW diagnostic code as a URI/string. Proxy now throws 'unsupported transfer syntax' / 'unsupported ESN' properly. -Multiple explain records may exist for one target. Proxy checks contents of -database element in explain record to validate database. +For yaz-proxy, multiple explain records may exist for one target. +Proxy checks contents of database element in explain record to +validate database. --- 0.7.5 2004/01/15 Internal release. diff --git a/src/yaz-proxy-main.cpp b/src/yaz-proxy-main.cpp index 8c7c32e..98c93cc 100644 --- a/src/yaz-proxy-main.cpp +++ b/src/yaz-proxy-main.cpp @@ -2,7 +2,7 @@ * Copyright (c) 1998-2004, Index Data. * See the file LICENSE for details. * - * $Id: yaz-proxy-main.cpp,v 1.33 2004-02-12 17:17:31 adam Exp $ + * $Id: yaz-proxy-main.cpp,v 1.34 2004-02-16 10:47:37 adam Exp $ */ #include @@ -34,6 +34,7 @@ static char *pid_fname = 0; static char *uid = 0; static char *log_file = 0; static int debug = 0; +static int no_limit_files = 0; int args(Yaz_Proxy *proxy, int argc, char **argv) { @@ -42,7 +43,7 @@ int args(Yaz_Proxy *proxy, int argc, char **argv) char *prog = argv[0]; int ret; - while ((ret = options("o:a:t:v:c:u:i:m:l:T:p:U:X", + while ((ret = options("o:a:t:v:c:u:i:m:l:T:p:U:n:X", argv, argc, &arg)) != -2) { int err; @@ -97,6 +98,9 @@ int args(Yaz_Proxy *proxy, int argc, char **argv) case 'T': proxy->set_target_idletime(atoi(arg)); break; + case 'n': + no_limit_files = atoi(arg); + break; case 'X': debug = 1; break; @@ -161,6 +165,22 @@ static void child_run(Yaz_SocketManager *m, int run) xmlSetGenericErrorFunc(0, proxy_xml_error_handler); #endif yaz_log(LOG_LOG, "0 proxy run=%d pid=%ld", run, (long) getpid()); + + if (no_limit_files) + { +#if HAVE_SETRLIMIT + struct rlimit limit_data; + limit_data.rlim_cur = no_limit_files; + limit_data.rlim_max = no_limit_files; + + yaz_log(LOG_LOG, "0 setrlimit NOFILE cur=%d max=%d", + limit_data.rlim_cur, limit_data.rlim_max); + if (setrlimit(RLIMIT_NOFILE, &limit_data)) + yaz_log(LOG_ERRNO|LOG_WARN, "setrlimit"); +#else + yaz_log(LOG_WARN, "setrlimit unavablable. Option -n ignored"); +#endif + } if (pid_fname) { FILE *f = fopen(pid_fname, "w"); @@ -195,12 +215,12 @@ static void child_run(Yaz_SocketManager *m, int run) xfree(uid); } #if HAVE_GETRLIMIT - struct rlimit limit_data; - getrlimit(RLIMIT_NOFILE, &limit_data); - yaz_log(LOG_LOG, "0 get limit NOFILE cur=%d max=%d", - limit_data.rlim_cur, limit_data.rlim_max); + struct rlimit limit_data; + getrlimit(RLIMIT_NOFILE, &limit_data); + yaz_log(LOG_LOG, "0 getrlimit NOFILE cur=%d max=%d", + limit_data.rlim_cur, limit_data.rlim_max); #endif - + while (m->processEvent() > 0) ; diff --git a/src/yaz-proxy.cpp b/src/yaz-proxy.cpp index 656af5b..86da0d8 100644 --- a/src/yaz-proxy.cpp +++ b/src/yaz-proxy.cpp @@ -2,7 +2,7 @@ * Copyright (c) 1998-2004, Index Data. * See the file LICENSE for details. * - * $Id: yaz-proxy.cpp,v 1.101 2004-02-15 16:41:14 adam Exp $ + * $Id: yaz-proxy.cpp,v 1.102 2004-02-16 10:47:37 adam Exp $ */ #include @@ -1983,6 +1983,8 @@ void Yaz_Proxy::handle_incoming_Z_PDU(Z_APDU *apdu) ODR_MASK_SET(apdu->u.initRequest->options, i); ODR_MASK_CLEAR(apdu->u.initRequest->options, Z_Options_negotiationModel); + ODR_MASK_CLEAR(apdu->u.initRequest->options, + Z_Options_concurrentOperations); // make new version m_initRequest_version = apdu->u.initRequest->protocolVersion; @@ -2182,6 +2184,8 @@ void Yaz_ProxyClient::pre_init_client() ODR_MASK_SET(req->options, i); ODR_MASK_CLEAR(apdu->u.initRequest->options, Z_Options_negotiationModel); + ODR_MASK_CLEAR(apdu->u.initRequest->options, + Z_Options_concurrentOperations); for (i = 0; i<= 10; i++) ODR_MASK_SET(req->protocolVersion, i); -- 1.7.10.4