Commit 93881190 authored by Pavel Vainerman's avatar Pavel Vainerman

(LogServer): переделал механизм посылки сообщение о лимите подключений.

Теперь посылается сообщение и соединение закрывается.
parent 4830c243
......@@ -167,8 +167,6 @@ void LogServer::work()
}
}
cerr << "*** LOG SERVER THREAD STOPPED.." << endl;
{
// uniset_rwmutex_wrlock l(mutSList);
for( auto& i: slist )
......
......@@ -288,7 +288,7 @@ void NullLogSession::run()
{
while( !cancelled )
{
{
{ // lock slist
uniset_rwmutex_wrlock l(smutex);
for( auto i=slist.begin(); !cancelled && i!=slist.end(); ++i )
{
......@@ -308,14 +308,27 @@ void NullLogSession::run()
{
(*s.get()) << msg << endl;
s->sync();
s->disconnect(); // послали сообщение и закрываем соединение..
}
}
}
slist.clear();
} // unlock slist
if( cancelled )
break;
msleep(5000);
msleep(5000); // делаем паузу, чтобы освободить на время "список"..
}
{
uniset_rwmutex_wrlock l(smutex);
for( auto i=slist.begin(); i!=slist.end(); ++i )
{
auto s(*i);
if( s )
s->disconnect();
}
}
}
// ---------------------------------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment