From 0d323a3f455c0a0a669fa33e77b670d1af23fec5 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Fri, 1 Jan 2010 21:47:31 +0100 Subject: [PATCH] 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. --- src/filter_virt_db.cpp | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) 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) -- 1.7.10.4