Commit 3de2c879 authored by Pavel Vainerman's avatar Pavel Vainerman

make style..

parent d40f8a8c
...@@ -55,7 +55,7 @@ static void print_help() ...@@ -55,7 +55,7 @@ static void print_help()
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
int main( int argc, char** argv ) int main( int argc, char** argv )
{ {
// std::ios::sync_with_stdio(false); // нельзя отключать.. тогда "обмен с сервером" рассинхронизируется // std::ios::sync_with_stdio(false); // нельзя отключать.. тогда "обмен с сервером" рассинхронизируется
int optindex = 0; int optindex = 0;
int opt = 0; int opt = 0;
......
...@@ -34,7 +34,7 @@ static void print_help() ...@@ -34,7 +34,7 @@ static void print_help()
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
int main( int argc, char** argv ) int main( int argc, char** argv )
{ {
// std::ios::sync_with_stdio(false); // std::ios::sync_with_stdio(false);
int optindex = 0; int optindex = 0;
int opt = 0; int opt = 0;
......
...@@ -13,6 +13,7 @@ int main( int argc, const char** argv ) ...@@ -13,6 +13,7 @@ int main( int argc, const char** argv )
auto conf = uniset_init(argc, argv); auto conf = uniset_init(argc, argv);
xmlNode* cnode = conf->getNode("Skel"); xmlNode* cnode = conf->getNode("Skel");
if( cnode == NULL ) if( cnode == NULL )
{ {
cerr << "(Skel): not found <Skel> in conffile" << endl; cerr << "(Skel): not found <Skel> in conffile" << endl;
......
...@@ -145,8 +145,14 @@ class DBServer_MySQL: ...@@ -145,8 +145,14 @@ class DBServer_MySQL:
/*! глобальная функция для вывода help-а */ /*! глобальная функция для вывода help-а */
static void help_print( int argc, const char* const* argv ); static void help_print( int argc, const char* const* argv );
inline std::shared_ptr<LogAgregator> getLogAggregator(){ return loga; } inline std::shared_ptr<LogAgregator> getLogAggregator()
inline std::shared_ptr<DebugStream> log(){ return dblog; } {
return loga;
}
inline std::shared_ptr<DebugStream> log()
{
return dblog;
}
protected: protected:
typedef std::map<int, std::string> DBTableMap; typedef std::map<int, std::string> DBTableMap;
......
...@@ -8,7 +8,7 @@ using namespace std; ...@@ -8,7 +8,7 @@ using namespace std;
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
// std::ios::sync_with_stdio(false); // std::ios::sync_with_stdio(false);
try try
{ {
......
...@@ -21,8 +21,14 @@ class DBServer_PostgreSQL: ...@@ -21,8 +21,14 @@ class DBServer_PostgreSQL:
/*! глобальная функция для вывода help-а */ /*! глобальная функция для вывода help-а */
static void help_print( int argc, const char* const* argv ); static void help_print( int argc, const char* const* argv );
inline std::shared_ptr<LogAgregator> getLogAggregator(){ return loga; } inline std::shared_ptr<LogAgregator> getLogAggregator()
inline std::shared_ptr<DebugStream> log(){ return dblog; } {
return loga;
}
inline std::shared_ptr<DebugStream> log()
{
return dblog;
}
protected: protected:
typedef std::map<int, std::string> DBTableMap; typedef std::map<int, std::string> DBTableMap;
......
...@@ -8,7 +8,7 @@ using namespace std; ...@@ -8,7 +8,7 @@ using namespace std;
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
// std::ios::sync_with_stdio(false); // std::ios::sync_with_stdio(false);
try try
{ {
......
...@@ -145,8 +145,14 @@ class DBServer_SQLite: ...@@ -145,8 +145,14 @@ class DBServer_SQLite:
/*! глобальная функция для вывода help-а */ /*! глобальная функция для вывода help-а */
static void help_print( int argc, const char* const* argv ); static void help_print( int argc, const char* const* argv );
inline std::shared_ptr<LogAgregator> getLogAggregator(){ return loga; } inline std::shared_ptr<LogAgregator> getLogAggregator()
inline std::shared_ptr<DebugStream> log(){ return dblog; } {
return loga;
}
inline std::shared_ptr<DebugStream> log()
{
return dblog;
}
protected: protected:
typedef std::map<int, std::string> DBTableMap; typedef std::map<int, std::string> DBTableMap;
......
...@@ -13,7 +13,7 @@ static void short_usage() ...@@ -13,7 +13,7 @@ static void short_usage()
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
// std::ios::sync_with_stdio(false); // std::ios::sync_with_stdio(false);
try try
{ {
......
...@@ -76,7 +76,7 @@ static struct option longopts[] = ...@@ -76,7 +76,7 @@ static struct option longopts[] =
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
// std::ios::sync_with_stdio(false); // std::ios::sync_with_stdio(false);
comedi_t* card; comedi_t* card;
const char* dev = "/dev/comedi0"; const char* dev = "/dev/comedi0";
lsampl_t data = 0; lsampl_t data = 0;
......
...@@ -11,7 +11,7 @@ using namespace UniSetExtensions; ...@@ -11,7 +11,7 @@ using namespace UniSetExtensions;
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
int main(int argc, const char** argv) int main(int argc, const char** argv)
{ {
// std::ios::sync_with_stdio(false); // std::ios::sync_with_stdio(false);
if( argc > 1 && strcmp(argv[1], "--help") == 0 ) if( argc > 1 && strcmp(argv[1], "--help") == 0 )
{ {
......
...@@ -9,7 +9,7 @@ using namespace UniSetExtensions; ...@@ -9,7 +9,7 @@ using namespace UniSetExtensions;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
int main(int argc, const char** argv) int main(int argc, const char** argv)
{ {
// std::ios::sync_with_stdio(false); // std::ios::sync_with_stdio(false);
try try
{ {
......
...@@ -11,7 +11,7 @@ using namespace UniSetExtensions; ...@@ -11,7 +11,7 @@ using namespace UniSetExtensions;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
int main(int argc, const char** argv) int main(int argc, const char** argv)
{ {
// std::ios::sync_with_stdio(false); // std::ios::sync_with_stdio(false);
if( argc > 1 && (!strcmp(argv[1], "--help") || !strcmp(argv[1], "-h")) ) if( argc > 1 && (!strcmp(argv[1], "--help") || !strcmp(argv[1], "-h")) )
{ {
......
...@@ -217,8 +217,14 @@ class MBExchange: ...@@ -217,8 +217,14 @@ class MBExchange:
void execute(); void execute();
inline std::shared_ptr<LogAgregator> getLogAggregator(){ return loga; } inline std::shared_ptr<LogAgregator> getLogAggregator()
inline std::shared_ptr<DebugStream> log(){ return mblog; } {
return loga;
}
inline std::shared_ptr<DebugStream> log()
{
return mblog;
}
protected: protected:
virtual void step(); virtual void step();
......
...@@ -14,7 +14,7 @@ static void print_help() ...@@ -14,7 +14,7 @@ static void print_help()
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
int main( int argc, const char** argv ) int main( int argc, const char** argv )
{ {
// std::ios::sync_with_stdio(false); // std::ios::sync_with_stdio(false);
unsigned short v1 = 0; unsigned short v1 = 0;
unsigned short v2 = 0; unsigned short v2 = 0;
const char* type = ""; const char* type = "";
......
...@@ -58,7 +58,7 @@ static void readMTR( ModbusRTUMaster* mb, ModbusRTU::ModbusAddr addr, ...@@ -58,7 +58,7 @@ static void readMTR( ModbusRTUMaster* mb, ModbusRTU::ModbusAddr addr,
int main( int argc, char** argv ) int main( int argc, char** argv )
{ {
// std::ios::sync_with_stdio(false); // std::ios::sync_with_stdio(false);
Command cmd = cmdNOP; Command cmd = cmdNOP;
int optindex = 0; int optindex = 0;
int opt = 0; int opt = 0;
......
...@@ -74,7 +74,7 @@ static char* checkArg( int ind, int argc, char* argv[] ); ...@@ -74,7 +74,7 @@ static char* checkArg( int ind, int argc, char* argv[] );
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
int main( int argc, char** argv ) int main( int argc, char** argv )
{ {
// std::ios::sync_with_stdio(false); // std::ios::sync_with_stdio(false);
Command cmd = cmdNOP; Command cmd = cmdNOP;
int optindex = 0; int optindex = 0;
int opt = 0; int opt = 0;
......
...@@ -9,7 +9,7 @@ using namespace UniSetExtensions; ...@@ -9,7 +9,7 @@ using namespace UniSetExtensions;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
int main( int argc, char** argv ) int main( int argc, char** argv )
{ {
// std::ios::sync_with_stdio(false); // std::ios::sync_with_stdio(false);
try try
{ {
......
...@@ -349,8 +349,14 @@ class MBSlave: ...@@ -349,8 +349,14 @@ class MBSlave:
return askCount; return askCount;
} }
inline std::shared_ptr<LogAgregator> getLogAggregator(){ return loga; } inline std::shared_ptr<LogAgregator> getLogAggregator()
inline std::shared_ptr<DebugStream> log(){ return mblog; } {
return loga;
}
inline std::shared_ptr<DebugStream> log()
{
return mblog;
}
protected: protected:
......
...@@ -15,7 +15,7 @@ using namespace std; ...@@ -15,7 +15,7 @@ using namespace std;
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
int main(int argc, const char** argv) int main(int argc, const char** argv)
{ {
// std::ios::sync_with_stdio(false); // std::ios::sync_with_stdio(false);
if( argc > 1 && (!strcmp(argv[1], "--help") || !strcmp(argv[1], "-h")) ) if( argc > 1 && (!strcmp(argv[1], "--help") || !strcmp(argv[1], "-h")) )
{ {
......
...@@ -15,7 +15,7 @@ using namespace std; ...@@ -15,7 +15,7 @@ using namespace std;
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
int main(int argc, const char** argv) int main(int argc, const char** argv)
{ {
// std::ios::sync_with_stdio(false); // std::ios::sync_with_stdio(false);
if( argc > 1 && (!strcmp(argv[1], "--help") || !strcmp(argv[1], "-h")) ) if( argc > 1 && (!strcmp(argv[1], "--help") || !strcmp(argv[1], "-h")) )
{ {
......
...@@ -72,8 +72,14 @@ class RRDServer: ...@@ -72,8 +72,14 @@ class RRDServer:
/*! глобальная функция для вывода help-а */ /*! глобальная функция для вывода help-а */
static void help_print( int argc, const char* const* argv ); static void help_print( int argc, const char* const* argv );
inline std::shared_ptr<LogAgregator> getLogAggregator(){ return loga; } inline std::shared_ptr<LogAgregator> getLogAggregator()
inline std::shared_ptr<DebugStream> log(){ return mylog; } {
return loga;
}
inline std::shared_ptr<DebugStream> log()
{
return mylog;
}
protected: protected:
RRDServer(); RRDServer();
......
...@@ -11,7 +11,7 @@ using namespace UniSetExtensions; ...@@ -11,7 +11,7 @@ using namespace UniSetExtensions;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
int main( int argc, const char** argv ) int main( int argc, const char** argv )
{ {
// std::ios::sync_with_stdio(false); // std::ios::sync_with_stdio(false);
if( argc > 1 && (!strcmp(argv[1], "--help") || !strcmp(argv[1], "-h")) ) if( argc > 1 && (!strcmp(argv[1], "--help") || !strcmp(argv[1], "-h")) )
{ {
......
...@@ -539,7 +539,7 @@ void SharedMemory::sendEvent( UniSetTypes::SystemMessage& sm ) ...@@ -539,7 +539,7 @@ void SharedMemory::sendEvent( UniSetTypes::SystemMessage& sm )
{ {
try try
{ {
ui->send(it,tm); ui->send(it, tm);
ok = true; ok = true;
break; break;
} }
......
...@@ -374,8 +374,14 @@ class SharedMemory: ...@@ -374,8 +374,14 @@ class SharedMemory:
return histSaveTime; /*!< период между точками "дампа", мсек */ return histSaveTime; /*!< период между точками "дампа", мсек */
} }
inline std::shared_ptr<LogAgregator> getLogAggregator(){ return loga; } inline std::shared_ptr<LogAgregator> getLogAggregator()
inline std::shared_ptr<DebugStream> log(){ return smlog; } {
return loga;
}
inline std::shared_ptr<DebugStream> log()
{
return smlog;
}
protected: protected:
typedef std::list<Restorer_XML::ReaderSlot> ReadSlotList; typedef std::list<Restorer_XML::ReaderSlot> ReadSlotList;
......
...@@ -10,7 +10,7 @@ using namespace UniSetExtensions; ...@@ -10,7 +10,7 @@ using namespace UniSetExtensions;
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
int main(int argc, const char** argv) int main(int argc, const char** argv)
{ {
// std::ios::sync_with_stdio(false); // std::ios::sync_with_stdio(false);
if( argc > 1 && ( strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-h") == 0 ) ) if( argc > 1 && ( strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-h") == 0 ) )
{ {
......
...@@ -32,7 +32,7 @@ void TestObject::sysCommand( const UniSetTypes::SystemMessage* sm ) ...@@ -32,7 +32,7 @@ void TestObject::sysCommand( const UniSetTypes::SystemMessage* sm )
{ {
// фиксируем что SM прислала WDT при своём запуске // фиксируем что SM прислала WDT при своём запуске
if( sm->command == SystemMessage::WatchDog ) if( sm->command == SystemMessage::WatchDog )
evntIsOK = true; evntIsOK = true;
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void TestObject::stopHeartbeat() void TestObject::stopHeartbeat()
......
...@@ -14,12 +14,18 @@ class TestObject: ...@@ -14,12 +14,18 @@ class TestObject:
void askNotifyChange(); void askNotifyChange();
void askNotifyFirstNotNull(); void askNotifyFirstNotNull();
inline bool getEvnt(){ return evntIsOK; } inline bool getEvnt()
{
return evntIsOK;
}
void stopHeartbeat(); void stopHeartbeat();
void runHeartbeat( int max=3 ); void runHeartbeat( int max = 3 );
inline timeout_t getHeartbeatTime(){ return ptHeartBeat.getInterval(); } inline timeout_t getHeartbeatTime()
{
return ptHeartBeat.getInterval();
}
protected: protected:
TestObject(); TestObject();
......
...@@ -65,7 +65,7 @@ int main(int argc, char* argv[] ) ...@@ -65,7 +65,7 @@ int main(int argc, char* argv[] )
xmlNode* o_node = conf->getNode("TestObject"); xmlNode* o_node = conf->getNode("TestObject");
obj = make_shared<TestObject>(o_id,o_node); obj = make_shared<TestObject>(o_id, o_node);
act->add(obj); act->add(obj);
auto nullsm = make_shared<NullSM>(ns_id, "reserv-sm-configure.xml"); auto nullsm = make_shared<NullSM>(ns_id, "reserv-sm-configure.xml");
......
...@@ -35,7 +35,7 @@ std::list< ThreadCreator<IOControl>* > lst_iothr; ...@@ -35,7 +35,7 @@ std::list< ThreadCreator<IOControl>* > lst_iothr;
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
int main( int argc, const char** argv ) int main( int argc, const char** argv )
{ {
// std::ios::sync_with_stdio(false); // std::ios::sync_with_stdio(false);
if( argc > 1 && ( strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-h") == 0 ) ) if( argc > 1 && ( strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-h") == 0 ) )
{ {
......
...@@ -99,8 +99,14 @@ class UNetExchange: ...@@ -99,8 +99,14 @@ class UNetExchange:
bool checkExistUNetHost( const std::string& host, ost::tpport_t port ); bool checkExistUNetHost( const std::string& host, ost::tpport_t port );
inline std::shared_ptr<LogAgregator> getLogAggregator(){ return loga; } inline std::shared_ptr<LogAgregator> getLogAggregator()
inline std::shared_ptr<DebugStream> log(){ return unetlog; } {
return loga;
}
inline std::shared_ptr<DebugStream> log()
{
return unetlog;
}
protected: protected:
......
...@@ -9,7 +9,7 @@ using namespace UniSetExtensions; ...@@ -9,7 +9,7 @@ using namespace UniSetExtensions;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
int main( int argc, const char** argv ) int main( int argc, const char** argv )
{ {
// std::ios::sync_with_stdio(false); // std::ios::sync_with_stdio(false);
try try
{ {
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
ВСЕ ВАШИ ИЗМЕНЕНИЯ БУДУТ ПОТЕРЯНЫ. ВСЕ ВАШИ ИЗМЕНЕНИЯ БУДУТ ПОТЕРЯНЫ.
*/ */
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// generate timestamp: 2015-05-24+03:00 // generate timestamp: 2015-05-30+03:00
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#ifndef UObject_SK_H_ #ifndef UObject_SK_H_
#define UObject_SK_H_ #define UObject_SK_H_
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
ВСЕ ВАШИ ИЗМЕНЕНИЯ БУДУТ ПОТЕРЯНЫ. ВСЕ ВАШИ ИЗМЕНЕНИЯ БУДУТ ПОТЕРЯНЫ.
*/ */
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// generate timestamp: 2015-05-24+03:00 // generate timestamp: 2015-05-30+03:00
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#include <memory> #include <memory>
#include "Configuration.h" #include "Configuration.h"
...@@ -117,17 +117,17 @@ UObject_SK::UObject_SK( ObjectId id, xmlNode* cnode, const std::string& _argpref ...@@ -117,17 +117,17 @@ UObject_SK::UObject_SK( ObjectId id, xmlNode* cnode, const std::string& _argpref
loga->add(ulog()); loga->add(ulog());
logserv = make_shared<LogServer>(loga); logserv = make_shared<LogServer>(loga);
logserv->init( argprefix + "-logserver", confnode ); logserv->init( argprefix + "logserver", confnode );
UniXML::iterator it(cnode); UniXML::iterator it(cnode);
// ------- init logserver --- // ------- init logserver ---
if( findArgParam("--" + argprefix + "-run-logserver", conf->getArgc(), conf->getArgv()) != -1 ) if( findArgParam("--" + argprefix + "run-logserver", conf->getArgc(), conf->getArgv()) != -1 )
{ {
logserv_host = conf->getArg2Param("--" + argprefix + "-logserver-host", it.getProp("logserverHost"), "localhost"); logserv_host = conf->getArg2Param("--" + argprefix + "logserver-host", it.getProp("logserverHost"), "localhost");
logserv_port = conf->getArgPInt("--" + argprefix + "-logserver-port", it.getProp("logserverPort"), getId()); logserv_port = conf->getArgPInt("--" + argprefix + "logserver-port", it.getProp("logserverPort"), getId());
} }
forceOut = conf->getArgPInt("--" + argprefix + "force-out", it.getProp("forceOut"), false); forceOut = conf->getArgPInt("--" + argprefix + "force-out", it.getProp("forceOut"), false);
...@@ -309,7 +309,7 @@ void UObject_SK::preSysCommand( const SystemMessage* _sm ) ...@@ -309,7 +309,7 @@ void UObject_SK::preSysCommand( const SystemMessage* _sm )
switch( _sm->command ) switch( _sm->command )
{ {
case SystemMessage::WatchDog: case SystemMessage::WatchDog:
ulogany << myname << "(preSysCommand): WatchDog" << endl; uinfo << myname << "(preSysCommand): WatchDog" << endl;
if( !active || !ptStartUpTimeout.checkTime() ) if( !active || !ptStartUpTimeout.checkTime() )
{ {
...@@ -458,8 +458,15 @@ void UObject_SK::callback() ...@@ -458,8 +458,15 @@ void UObject_SK::callback()
// "сердцебиение" // "сердцебиение"
if( idHeartBeat != DefaultObjectId && ptHeartBeat.checkTime() ) if( idHeartBeat != DefaultObjectId && ptHeartBeat.checkTime() )
{ {
ui->setValue(idHeartBeat, maxHeartBeat, UniversalIO::AI); try
ptHeartBeat.reset(); {
ui->setValue(idHeartBeat, maxHeartBeat);
ptHeartBeat.reset();
}
catch( const Exception& ex )
{
ucrit << myname << "(execute): " << ex << endl;
}
} }
// обновление выходов // обновление выходов
......
...@@ -55,7 +55,7 @@ class Pulse ...@@ -55,7 +55,7 @@ class Pulse
ostate = false; ostate = false;
// учитываем что step мог вызваться гораздо позже.. // учитываем что step мог вызваться гораздо позже..
t0.setTiming( t0_msec - t1.getCurrent()%t1.getInterval() ); t0.setTiming( t0_msec - t1.getCurrent() % t1.getInterval() );
} }
if( !ostate && t0.checkTime() ) if( !ostate && t0.checkTime() )
...@@ -63,7 +63,7 @@ class Pulse ...@@ -63,7 +63,7 @@ class Pulse
ostate = true; ostate = true;
// учитываем что step мог вызваться гораздо позже.. // учитываем что step мог вызваться гораздо позже..
t1.setTiming(t1_msec - t0.getCurrent()%t0.getInterval() ); t1.setTiming(t1_msec - t0.getCurrent() % t0.getInterval() );
} }
return ostate; return ostate;
......
...@@ -113,7 +113,7 @@ std::list<LogAgregator::LogInfo> LogAgregator::getLogList() ...@@ -113,7 +113,7 @@ std::list<LogAgregator::LogInfo> LogAgregator::getLogList()
{ {
std::list<LogAgregator::LogInfo> l; std::list<LogAgregator::LogInfo> l;
for( auto&& i : lmap ) for( auto && i : lmap )
l.push_back(i.second); l.push_back(i.second);
return std::move(l); return std::move(l);
...@@ -122,10 +122,12 @@ std::list<LogAgregator::LogInfo> LogAgregator::getLogList() ...@@ -122,10 +122,12 @@ std::list<LogAgregator::LogInfo> LogAgregator::getLogList()
std::list<LogAgregator::LogInfo> LogAgregator::getLogList( const std::string& regex_str ) std::list<LogAgregator::LogInfo> LogAgregator::getLogList( const std::string& regex_str )
{ {
std::list<LogAgregator::LogInfo> l; std::list<LogAgregator::LogInfo> l;
try try
{ {
std::regex rule(regex_str); std::regex rule(regex_str);
for( auto&& i : lmap )
for( auto && i : lmap )
{ {
if( std::regex_match(i.second.log->getLogName(), rule) ) if( std::regex_match(i.second.log->getLogName(), rule) )
l.push_back(i.second); l.push_back(i.second);
......
...@@ -177,6 +177,7 @@ void LogReader::readlogs( const std::string& _addr, ost::tpport_t _port, LogServ ...@@ -177,6 +177,7 @@ void LogReader::readlogs( const std::string& _addr, ost::tpport_t _port, LogServ
if( tcp->isPending(ost::Socket::pendingOutput, outTimeout) ) if( tcp->isPending(ost::Socket::pendingOutput, outTimeout) )
{ {
rlog.info() << "(LogReader): ** send command: cmd='" << msg.cmd << "' logname='" << msg.logname << "' data='" << msg.data << "'" << endl; rlog.info() << "(LogReader): ** send command: cmd='" << msg.cmd << "' logname='" << msg.logname << "' data='" << msg.data << "'" << endl;
for( size_t i = 0; i < sizeof(msg); i++ ) for( size_t i = 0; i < sizeof(msg); i++ )
(*tcp) << ((unsigned char*)(&msg))[i]; (*tcp) << ((unsigned char*)(&msg))[i];
...@@ -186,14 +187,14 @@ void LogReader::readlogs( const std::string& _addr, ost::tpport_t _port, LogServ ...@@ -186,14 +187,14 @@ void LogReader::readlogs( const std::string& _addr, ost::tpport_t _port, LogServ
else else
rlog.warn() << "(LogReader): **** SEND COMMAND ('" << msg.cmd << "' FAILED!" << endl; rlog.warn() << "(LogReader): **** SEND COMMAND ('" << msg.cmd << "' FAILED!" << endl;
if( cmdonly && msg.cmd!=LogServerTypes::cmdList ) if( cmdonly && msg.cmd != LogServerTypes::cmdList )
{ {
disconnect(); disconnect();
return; return;
} }
} }
while( (!cmdonly || msg.cmd==LogServerTypes::cmdList) && tcp->isPending(ost::Socket::pendingInput, inTimeout) ) while( (!cmdonly || msg.cmd == LogServerTypes::cmdList) && tcp->isPending(ost::Socket::pendingInput, inTimeout) )
{ {
int n = tcp->peek( buf, sizeof(buf) - 1 ); int n = tcp->peek( buf, sizeof(buf) - 1 );
...@@ -203,7 +204,7 @@ void LogReader::readlogs( const std::string& _addr, ost::tpport_t _port, LogServ ...@@ -203,7 +204,7 @@ void LogReader::readlogs( const std::string& _addr, ost::tpport_t _port, LogServ
buf[n] = '\0'; buf[n] = '\0';
log << buf; log << buf;
if( msg.cmd==LogServerTypes::cmdList ) if( msg.cmd == LogServerTypes::cmdList )
break; break;
} }
else else
......
...@@ -149,6 +149,7 @@ void LogSession::run() ...@@ -149,6 +149,7 @@ void LogSession::run()
} }
s << "=====================" << endl; s << "=====================" << endl;
if( isPending(Socket::pendingOutput, cmdTimeout) ) if( isPending(Socket::pendingOutput, cmdTimeout) )
{ {
...@@ -158,7 +159,7 @@ void LogSession::run() ...@@ -158,7 +159,7 @@ void LogSession::run()
} }
// обрабатываем команды только если нашли log // обрабатываем команды только если нашли log
for( auto&& li: loglist ) for( auto && li : loglist )
{ {
// Обработка команд.. // Обработка команд..
// \warning Работа с логом ведётся без mutex-а, хотя он разделяется отдельными потоками // \warning Работа с логом ведётся без mutex-а, хотя он разделяется отдельными потоками
...@@ -166,15 +167,15 @@ void LogSession::run() ...@@ -166,15 +167,15 @@ void LogSession::run()
{ {
case LogServerTypes::cmdSetLevel: case LogServerTypes::cmdSetLevel:
li.log->level( (Debug::type)msg.data ); li.log->level( (Debug::type)msg.data );
break; break;
case LogServerTypes::cmdAddLevel: case LogServerTypes::cmdAddLevel:
li.log->addLevel( (Debug::type)msg.data ); li.log->addLevel( (Debug::type)msg.data );
break; break;
case LogServerTypes::cmdDelLevel: case LogServerTypes::cmdDelLevel:
li.log->delLevel( (Debug::type)msg.data ); li.log->delLevel( (Debug::type)msg.data );
break; break;
case LogServerTypes::cmdRotate: case LogServerTypes::cmdRotate:
{ {
...@@ -184,11 +185,11 @@ void LogSession::run() ...@@ -184,11 +185,11 @@ void LogSession::run()
break; break;
case LogServerTypes::cmdList: // обработали выше (в начале) case LogServerTypes::cmdList: // обработали выше (в начале)
break; break;
case LogServerTypes::cmdOffLogFile: case LogServerTypes::cmdOffLogFile:
li.log->logFile(""); li.log->logFile("");
break; break;
case LogServerTypes::cmdOnLogFile: case LogServerTypes::cmdOnLogFile:
{ {
......
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