From: Maxim Mamontov Date: Thu, 3 Feb 2011 14:23:05 +0000 (+0200) Subject: Виправлено помилку що призводила до масових дисконнектів після масових X-Git-Tag: 2.407-rc3~188 X-Git-Url: https://git.stg.codes/stg.git/commitdiff_plain/c0fa85ff6e91e2ad63d86bffad45a66164d9e24a?ds=sidebyside;hp=1346670131134bfcb44cffe8bcbcc6e8d762980f Виправлено помилку що призводила до масових дисконнектів після масових коннектів close #14 --- diff --git a/projects/rscriptd/listener.cpp b/projects/rscriptd/listener.cpp index 82dd6318..814eb1d8 100644 --- a/projects/rscriptd/listener.cpp +++ b/projects/rscriptd/listener.cpp @@ -331,16 +331,10 @@ return false; //----------------------------------------------------------------------------- void LISTENER::ProcessPending() { -std::list localPending; - - { - STG_LOCKER lock(&mutex, __FILE__, __LINE__); - printfd(__FILE__, "Pending data size: %d\n", pending.size()); - localPending.swap(pending); - } - -std::list::iterator it(localPending.begin()); -while (it != localPending.end()) +std::list::iterator it(pending.begin()); +size_t count = 0; +printfd(__FILE__, "Pending: %d\n", pending.size()); +while (it != pending.end() && count < 256) { std::vector::iterator uit( std::lower_bound( @@ -381,7 +375,10 @@ while (it != localPending.end()) } } ++it; + ++count; } +STG_LOCKER lock(&mutex, __FILE__, __LINE__); +pending.erase(pending.begin(), it); } //----------------------------------------------------------------------------- void LISTENER::ProcessTimeouts()