Commit a1fbe1d8 authored by Pavel Vainerman's avatar Pavel Vainerman

(ModbusTCPSession): исправил ошибку с "зависанием соединения"

(uniset-log): исправил ошибку с "загрузкой процессора" в случае закрытия "канала"
parent ac610fd2
......@@ -13,7 +13,7 @@
Name: libuniset2
Version: 2.1
Release: alt22
Release: alt23
Summary: UniSet - library for building distributed industrial control systems
......@@ -456,6 +456,10 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname
# ..
%changelog
* Mon Sep 07 2015 Pavel Vainerman <pv@altlinux.ru> 2.1-alt23
- (ModbusPersistentSlave): fixed bug in end connection processing
- (uniset-log): fixed bug in end connection processing
* Sun Sep 06 2015 Pavel Vainerman <pv@altlinux.ru> 2.1-alt22
- refactoring (use shared_ptr), change pollfactor realisation..
......
......@@ -84,8 +84,16 @@ void ModbusTCPSession::run()
ModbusRTU::mbErrCode res = erTimeOut;
cancelled = false;
char pbuf[3];
while( !cancelled && isPending(Socket::pendingInput, timeout) )
{
ssize_t n = peek( pbuf, sizeof(pbuf) );
// кажется сервер закрыл канал
if( n == 0 )
break;
res = receive(addr, timeout);
if( res == erSessionClosed )
......
......@@ -299,7 +299,7 @@ void LogReader::readlogs( const std::string& _addr, ost::tpport_t _port, LogServ
while( tcp->isPending(ost::Socket::pendingInput, inTimeout) )
{
int n = tcp->peek( buf, sizeof(buf) - 1 );
ssize_t n = tcp->peek( buf, sizeof(buf) - 1 );
if( n > 0 )
{
......@@ -308,6 +308,8 @@ void LogReader::readlogs( const std::string& _addr, ost::tpport_t _port, LogServ
log << buf;
}
else if( n == 0 && readcount <=0 )
break;
if( rcount > 0 && readcount > 0 )
rcount--;
......
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