X-Git-Url: http://sru.miketaylor.org.uk/?a=blobdiff_plain;f=src%2Ffilter_limit.cpp;h=784f68a171a61e15f619567d63c711d968016363;hb=23520f51076f0833f9a1716e87633fd92e9d0b69;hp=c43608ff9b8237df41f365633713111cfb966d81;hpb=4cd9e521c5e96e3fcc5dcec6192571b54a1351c4;p=metaproxy-moved-to-github.git diff --git a/src/filter_limit.cpp b/src/filter_limit.cpp index c43608f..784f68a 100644 --- a/src/filter_limit.cpp +++ b/src/filter_limit.cpp @@ -1,5 +1,5 @@ /* This file is part of Metaproxy. - Copyright (C) 2005-2009 Index Data + Copyright (C) 2005-2010 Index Data Metaproxy is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free @@ -21,9 +21,12 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include #include -#include -#include "package.hpp" -#include "util.hpp" +#include +#include +#include +#ifdef WIN32 +#include +#endif namespace mp = metaproxy_1; namespace yf = mp::filter; @@ -32,9 +35,9 @@ namespace metaproxy_1 { namespace filter { class Limit::Ses { public: - yazpp_1::Yaz_bw bw_stat; - yazpp_1::Yaz_bw pdu_stat; - yazpp_1::Yaz_bw search_stat; + yazpp_1::TimeStat bw_stat; + yazpp_1::TimeStat pdu_stat; + yazpp_1::TimeStat search_stat; Ses() : bw_stat(60), pdu_stat(60), search_stat(60) {}; }; @@ -183,12 +186,19 @@ void yf::Limit::Impl::process(mp::Package &package) } } if (package.session().is_closed()) + { m_sessions.erase(package.session()); + delete ses; + } } if (reduce) { yaz_log(YLOG_LOG, "sleeping %d seconds", reduce); +#ifdef WIN32 + Sleep(reduce * 1000); +#else sleep(reduce); +#endif } }