From: Adam Dickmeiss Date: Fri, 1 Jan 2010 20:47:31 +0000 (+0100) Subject: Filter virt_db: close backend for Init rejected X-Git-Tag: v1.0.23~1 X-Git-Url: http://jsfdemo.indexdata.com/cgi-bin?a=commitdiff_plain;h=0d323a3f455c0a0a669fa33e77b670d1af23fec5;p=metaproxy-moved-to-github.git Filter virt_db: close backend for Init rejected Close backend filter session when Init rejected is received from it (in which case it's not really closed yet). This will ensure we don't run out of resources such as FDs in this case. --- diff --git a/src/filter_virt_db.cpp b/src/filter_virt_db.cpp index aca2634..a7d0ae8 100644 --- a/src/filter_virt_db.cpp +++ b/src/filter_virt_db.cpp @@ -236,31 +236,24 @@ yf::VirtualDB::BackendPtr yf::VirtualDB::Frontend::init_backend( { b->m_named_result_sets = true; } - if (!*res->result) + if (*res->result) { - error_code = YAZ_BIB1_DATABASE_UNAVAILABLE; - mp::util::get_init_diagnostics(res, error_code, addinfo); - BackendPtr null; - return null; + m_backend_list.push_back(b); + return b; + } - } - else - { error_code = YAZ_BIB1_DATABASE_UNAVAILABLE; - // addinfo = database; - BackendPtr null; - return null; - } - if (init_package.session().is_closed()) + mp::util::get_init_diagnostics(res, error_code, addinfo); + } + if (!init_package.session().is_closed()) { - error_code = YAZ_BIB1_DATABASE_UNAVAILABLE; - // addinfo = database; - BackendPtr null; - return null; + Package close_package(b->m_backend_session, package.origin()); + close_package.copy_filter(package); + close_package.session().close(); + close_package.move(b->m_route); // closing it } - - m_backend_list.push_back(b); - return b; + BackendPtr null; + return null; } void yf::VirtualDB::Frontend::search(mp::Package &package, Z_APDU *apdu_req)