From: Adam Dickmeiss Date: Wed, 1 Feb 2012 11:58:40 +0000 (+0100) Subject: session_shared: Simplify ttl conditional X-Git-Tag: v1.3.22~7 X-Git-Url: http://lists.indexdata.dk/?a=commitdiff_plain;h=51bd69f6e778ab83e4017172625c0decc8465e1b;p=metaproxy-moved-to-github.git session_shared: Simplify ttl conditional A result set ttl of 0 will make immediate reuse of a set. --- diff --git a/src/filter_session_shared.cpp b/src/filter_session_shared.cpp index e4b9efc..7118476 100644 --- a/src/filter_session_shared.cpp +++ b/src/filter_session_shared.cpp @@ -582,8 +582,8 @@ void yf::SessionShared::Frontend::override_set( BackendSetList::iterator set_it = (*it)->m_sets.begin(); for (; set_it != (*it)->m_sets.end(); set_it++) { - if (now >= (*set_it)->m_time_last_use && - now - (*set_it)->m_time_last_use > bc->m_backend_set_ttl) + if (now < (*set_it)->m_time_last_use || + now - (*set_it)->m_time_last_use >= bc->m_backend_set_ttl) { found_backend = *it; result_set_id = (*set_it)->m_result_set_id; @@ -1002,8 +1002,7 @@ void yf::SessionShared::BackendClass::expire_class() { bit++; } - else if ((now >= last_use && now - last_use > m_backend_expiry_ttl) - || (now < last_use)) + else if (now < last_use || now - last_use > m_backend_expiry_ttl) { mp::odr odr; (*bit)->m_close_package->response() = odr.create_close(