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

(ModbusSlave): добавил обработку CommFailed

parent 8ff38cde
......@@ -633,6 +633,11 @@ mbErrCode ModbusServer::recv( const std::unordered_set<ModbusRTU::ModbusAddr>& v
{
// cout << "(recv): catch TimeOut " << endl;
}
catch( UniSetTypes::CommFailed )
{
cleanupChannel();
return erSessionClosed;
}
catch( const Exception& ex ) // SystemError
{
dlog->crit() << "(recv): " << ex << endl;
......
......@@ -208,6 +208,7 @@ ModbusRTU::mbErrCode ModbusTCPSession::realReceive( const std::unordered_set<Mod
ModbusRTU::mbErrCode res = erTimeOut;
ptTimeout.setTiming(msec);
try
{
buf.clear();
res = tcp_processing(buf.aduhead);
......@@ -270,6 +271,11 @@ ModbusRTU::mbErrCode ModbusTCPSession::realReceive( const std::unordered_set<Mod
// processing message...
res = processing(buf);
}
catch( UniSetTypes::CommFailed& ex )
{
cancelled = true;
return erSessionClosed;
}
return res;
}
......
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