Commit 7d51a102 authored by Pavel Vainerman's avatar Pavel Vainerman

(MBTCPMaster): убрал лишний неиспользуемый код

parent 881268b3
......@@ -286,7 +286,7 @@ class MBExchange:
RTUDeviceMap devices;
InitList initRegList; /*!< список регистров для инициализации */
UniSetTypes::uniset_rwmutex pollMutex;
// UniSetTypes::uniset_rwmutex pollMutex;
virtual std::shared_ptr<ModbusClient> initMB( bool reopen = false ) = 0;
......
......@@ -238,7 +238,6 @@ class MBTCPMaster:
virtual std::shared_ptr<ModbusClient> initMB( bool reopen = false ) override;
virtual void sigterm( int signo ) override;
UniSetTypes::uniset_rwmutex mbMutex;
std::string iaddr;
int port;
......
......@@ -32,8 +32,6 @@ MBTCPMultiMaster::MBTCPMultiMaster( UniSetTypes::ObjectId objId, UniSetTypes::Ob
MBExchange(objId, shmId, ic, prefix),
force_disconnect(true)
{
tcpMutex.setName(myname + "_tcpMutex");
if( objId == DefaultObjectId )
throw UniSetTypes::SystemError("(MBTCPMultiMaster): objId=-1?!! Use --" + prefix + "-name" );
......@@ -226,8 +224,6 @@ std::shared_ptr<ModbusClient> MBTCPMultiMaster::initMB( bool reopen )
}
{
uniset_rwmutex_wrlock l(tcpMutex);
// сперва надо обновить все ignore
// т.к. фактически флаги выставляются и сбрасываются только здесь
for( auto it = mblist.rbegin(); it != mblist.rend(); ++it )
......@@ -268,8 +264,6 @@ std::shared_ptr<ModbusClient> MBTCPMultiMaster::initMB( bool reopen )
// проходим по списку (в обратном порядке, т.к. самый приоритетный в конце)
for( auto it = mblist.rbegin(); it != mblist.rend(); ++it )
{
uniset_rwmutex_wrlock l(tcpMutex);
if( it->respond && !it->ignore && it->init(mblog) )
{
mbi = it;
......@@ -286,8 +280,6 @@ std::shared_ptr<ModbusClient> MBTCPMultiMaster::initMB( bool reopen )
// значит сейчас просто находим первый у кого есть связь и делаем его главным
for( auto it = mblist.rbegin(); it != mblist.rend(); ++it )
{
uniset_rwmutex_wrlock l(tcpMutex);
if( it->respond && it->check() && it->init(mblog) )
{
mbi = it;
......@@ -302,7 +294,6 @@ std::shared_ptr<ModbusClient> MBTCPMultiMaster::initMB( bool reopen )
// значит всё-таки связи реально нет...
{
uniset_rwmutex_wrlock l(tcpMutex);
mbi = mblist.rend();
mb = nullptr;
}
......@@ -458,11 +449,8 @@ void MBTCPMultiMaster::check_thread()
mbcrit << myname << "(check): (respond) " << it->myname << " : " << ex.what() << std::endl;
}
{
uniset_rwmutex_wrlock l(tcpMutex);
it->respond = r;
}
}
catch( const std::exception& ex )
{
mbcrit << myname << "(check): (respond) " << it->myname << " : " << ex.what() << std::endl;
......
......@@ -332,8 +332,6 @@ class MBTCPMultiMaster:
// т.к. TCP может "зависнуть" на подключении к недоступному узлу
// делаем опрос в отдельном потоке
std::shared_ptr< ThreadCreator<MBTCPMultiMaster> > pollThread; /*!< поток опроса */
UniSetTypes::uniset_rwmutex tcpMutex;
std::shared_ptr< ThreadCreator<MBTCPMultiMaster> > checkThread; /*!< поток проверки связи по другим каналам */
};
// -----------------------------------------------------------------------------
......
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