Commit e9a19faa authored by Pavel Vainerman's avatar Pavel Vainerman

Сделал перрывание программы (std::terminate) в случае критических ошибок,

и другие мелкие правки
parent fea40455
...@@ -87,7 +87,7 @@ int main( int argc, char** argv ) ...@@ -87,7 +87,7 @@ int main( int argc, char** argv )
LogServerTypes::Command cmd = LogServerTypes::cmdNOP; LogServerTypes::Command cmd = LogServerTypes::cmdNOP;
int cmdonly = 0; int cmdonly = 0;
timeout_t tout = UniSetTimer::WaitUpTime; timeout_t tout = UniSetTimer::WaitUpTime;
timeout_t rdelay = 5000; timeout_t rdelay = 8000;
string logfile(""); string logfile("");
bool logtruncate = false; bool logtruncate = false;
......
...@@ -670,8 +670,8 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::waitSM( int wait_msec, ObjectId _te ...@@ -670,8 +670,8 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::waitSM( int wait_msec, ObjectId _te
mycrit &lt;&lt; err.str() &lt;&lt; endl; mycrit &lt;&lt; err.str() &lt;&lt; endl;
// terminate(); // terminate();
// abort(); // abort();
raise(SIGTERM); // raise(SIGTERM);
terminate(); std::terminate();
// throw SystemError(err.str()); // throw SystemError(err.str());
} }
...@@ -685,7 +685,8 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::waitSM( int wait_msec, ObjectId _te ...@@ -685,7 +685,8 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::waitSM( int wait_msec, ObjectId _te
mycrit &lt;&lt; err.str() &lt;&lt; endl; mycrit &lt;&lt; err.str() &lt;&lt; endl;
// terminate(); // terminate();
// abort(); // abort();
raise(SIGTERM); //raise(SIGTERM);
std::terminate();
// throw SystemError(err.str()); // throw SystemError(err.str());
} }
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
ulimit -Sc 1000000 ulimit -Sc 1000000
uniset2-start.sh -f ./test --name TestProc --confile test.xml --ulog-add-levels warn,crit \ uniset2-start.sh -f ./test --name TestProc --confile test.xml --ulog-add-levels system,warn,crit \
--test-sm-ready-timeout 15000 --test-run-logserver --test-logserver-host 192.192.192.192 --test-sm-ready-timeout 15000 --test-run-logserver --test-logserver-host 192.192.192.192
#--test-log-add-levels any $* #--test-log-add-levels any $*
......
...@@ -180,7 +180,7 @@ void LogReader::sendCommand(const std::string& _addr, int _port, std::vector<Com ...@@ -180,7 +180,7 @@ void LogReader::sendCommand(const std::string& _addr, int _port, std::vector<Com
msg.data = c.data; msg.data = c.data;
msg.setLogName(c.logfilter); msg.setLogName(c.logfilter);
unsigned int n = 2; // две попытки на посылку size_t n = 2; // две попытки на посылку
while( n > 0 ) while( n > 0 )
{ {
...@@ -244,7 +244,7 @@ void LogReader::sendCommand(const std::string& _addr, int _port, std::vector<Com ...@@ -244,7 +244,7 @@ void LogReader::sendCommand(const std::string& _addr, int _port, std::vector<Com
// теперь ждём ответ.. // теперь ждём ответ..
try try
{ {
int a = 2; size_t a = 2;
while( a > 0 && tcp->poll(UniSetTimer::millisecToPoco(reply_timeout), Poco::Net::Socket::SELECT_READ) ) while( a > 0 && tcp->poll(UniSetTimer::millisecToPoco(reply_timeout), Poco::Net::Socket::SELECT_READ) )
{ {
......
...@@ -137,6 +137,14 @@ void LogSession::logOnEvent( const std::string& s ) noexcept ...@@ -137,6 +137,14 @@ void LogSession::logOnEvent( const std::string& s ) noexcept
if( logbuf.size() >= maxRecordsNum ) if( logbuf.size() >= maxRecordsNum )
{ {
numLostMsg++; numLostMsg++;
if( numLostMsg > maxRecordsNum )
{
// видимо клиент отвалился или совсем не успевает читать
// разрываем сессию..
if( mylog.is_info() )
mylog.info() << peername << "(LogSession::onEvent): too many lost messages. Close session.." << endl;
cancelled = true;
}
if( !lostMsg ) if( !lostMsg )
{ {
......
...@@ -343,6 +343,8 @@ void UniSetManager::objects(OManagerCommand cmd) ...@@ -343,6 +343,8 @@ void UniSetManager::objects(OManagerCommand cmd)
{ {
ucrit << myname << "(objects): " << ex << endl; ucrit << myname << "(objects): " << ex << endl;
ucrit << myname << "(objects): не смог зарегистрировать (разрегистрировать) объект -->" << li->getName() << endl; ucrit << myname << "(objects): не смог зарегистрировать (разрегистрировать) объект -->" << li->getName() << endl;
if( cmd == activ )
std::terminate();
} }
catch( const CORBA::SystemException& ex ) catch( const CORBA::SystemException& ex )
{ {
...@@ -360,6 +362,9 @@ void UniSetManager::objects(OManagerCommand cmd) ...@@ -360,6 +362,9 @@ void UniSetManager::objects(OManagerCommand cmd)
ucrit << myname << "(objects): file: " << fe.file() ucrit << myname << "(objects): file: " << fe.file()
<< " line: " << fe.line() << " line: " << fe.line()
<< " mesg: " << fe.errmsg() << endl; << " mesg: " << fe.errmsg() << endl;
if( cmd == activ )
std::terminate();
} }
} }
} // unlock } // unlock
......
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