From 6df9b9835b29be108af9d2173b863b3146818669 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Fri, 17 Nov 2006 14:03:45 +0000 Subject: [PATCH] Added 'timeout' setting for filter frontend_net which specifies the number of seconds a session is idle before it is closed. Default timeout is 300 (5 minutes). --- NEWS | 4 + etc/config.xsd | 205 ------------------------------------------- etc/config3.xml | 5 +- src/filter_frontend_net.cpp | 28 ++++-- xml/schema/metaproxy.rnc | 5 +- 5 files changed, 32 insertions(+), 215 deletions(-) delete mode 100644 etc/config.xsd diff --git a/NEWS b/NEWS index f9a9748..8af4187 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +Added 'timeout' setting for filter frontend_net which specifies the number +of seconds a session is idle before it is closed. Default timeout is +300 (5 minutes). + --- 1.0.6 2006/07/07 Database name in records returned set for virt_db/multi filters. diff --git a/etc/config.xsd b/etc/config.xsd deleted file mode 100644 index 9911ef8..0000000 --- a/etc/config.xsd +++ /dev/null @@ -1,205 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/etc/config3.xml b/etc/config3.xml index 878d646..8242396 100644 --- a/etc/config3.xml +++ b/etc/config3.xml @@ -1,5 +1,5 @@ - + @@ -7,6 +7,7 @@ 10 @:9000 + 30 F @@ -18,7 +19,7 @@ db2 - localhost:9999/Default + localhost:9998/Default db3 diff --git a/src/filter_frontend_net.cpp b/src/filter_frontend_net.cpp index 385494b..59fd107 100644 --- a/src/filter_frontend_net.cpp +++ b/src/filter_frontend_net.cpp @@ -1,4 +1,4 @@ -/* $Id: filter_frontend_net.cpp,v 1.21 2006-08-30 10:48:52 adam Exp $ +/* $Id: filter_frontend_net.cpp,v 1.22 2006-11-17 14:03:46 adam Exp $ Copyright (c) 2005-2006, Index Data. See the LICENSE file for details @@ -28,6 +28,7 @@ namespace metaproxy_1 { int m_no_threads; std::vector m_ports; int m_listen_duration; + int m_session_timeout; }; } class My_Timer_Thread : public yazpp_1::ISocketObserver { @@ -81,7 +82,8 @@ namespace metaproxy_1 { ~ZAssocServer(); ZAssocServer(yazpp_1::IPDU_Observable *PDU_Observable, mp::ThreadPoolSocketObserver *m_thread_pool_observer, - const mp::Package *package); + const mp::Package *package, + int timeout); private: yazpp_1::IPDU_Observer* sessionNotify( yazpp_1::IPDU_Observable *the_PDU_Observable, @@ -94,6 +96,7 @@ namespace metaproxy_1 { private: mp::ThreadPoolSocketObserver *m_thread_pool_observer; const mp::Package *m_package; + int m_session_timeout; }; } @@ -210,9 +213,10 @@ void mp::ZAssocChild::connectNotify() } mp::ZAssocServer::ZAssocServer(yazpp_1::IPDU_Observable *PDU_Observable, - mp::ThreadPoolSocketObserver *thread_pool_observer, - const mp::Package *package) - : Z_Assoc(PDU_Observable) + mp::ThreadPoolSocketObserver *thread_pool_observer, + const mp::Package *package, + int timeout) + : Z_Assoc(PDU_Observable), m_session_timeout(timeout) { m_thread_pool_observer = thread_pool_observer; m_package = package; @@ -225,6 +229,7 @@ yazpp_1::IPDU_Observer *mp::ZAssocServer::sessionNotify(yazpp_1::IPDU_Observable mp::ZAssocChild *my = new mp::ZAssocChild(the_PDU_Observable, m_thread_pool_observer, m_package); + my->timeout(m_session_timeout); return my; } @@ -252,6 +257,7 @@ mp::filter::FrontendNet::FrontendNet() : m_p(new Rep) { m_p->m_no_threads = 5; m_p->m_listen_duration = 0; + m_p->m_session_timeout = 300; // 5 minutes } mp::filter::FrontendNet::~FrontendNet() @@ -301,7 +307,8 @@ void mp::filter::FrontendNet::process(Package &package) const yazpp_1::PDU_Assoc *as = new yazpp_1::PDU_Assoc(&mySocketManager); // create ZAssoc with PDU Assoc - az[i] = new mp::ZAssocServer(as, &threadPool, &package); + az[i] = new mp::ZAssocServer(as, &threadPool, &package, + m_p->m_session_timeout); az[i]->server(m_p->m_ports[i].c_str()); } while (mySocketManager.processEvent() > 0) @@ -342,6 +349,15 @@ void mp::filter::FrontendNet::configure(const xmlNode * ptr) + threads_str); m_p->m_no_threads = threads; } + else if (!strcmp((const char *) ptr->name, "timeout")) + { + std::string timeout_str = mp::xml::get_text(ptr); + int timeout = atoi(timeout_str.c_str()); + if (timeout < 1) + throw mp::filter::FilterException("Bad value for timeout: " + + timeout_str); + m_p->m_session_timeout = timeout; + } else { throw mp::filter::FilterException("Bad element " diff --git a/xml/schema/metaproxy.rnc b/xml/schema/metaproxy.rnc index 8e92daa..cea817e 100644 --- a/xml/schema/metaproxy.rnc +++ b/xml/schema/metaproxy.rnc @@ -1,5 +1,5 @@ # Metaproxy XML config file schemas -# $Id: metaproxy.rnc,v 1.5 2006-10-10 15:10:18 marc Exp $ +# $Id: metaproxy.rnc,v 1.6 2006-11-17 14:03:47 adam Exp $ # # Copyright (c) 2005-2006, Index Data. # @@ -81,7 +81,8 @@ filter_frontend_net = attribute id { xsd:NCName }?, attribute name { xsd:NCName }?, element threads { xsd:integer }?, - element port { xsd:string } + element port { xsd:string }, + element timeout { xsd:integer }? filter_http_file = attribute type { "http_file" }, -- 1.7.10.4