Commit 5e03f449 authored by Pavel Vainerman's avatar Pavel Vainerman

Очередная попытка исправить периодиеские подвисания ModbusSlave.

parent 9ce79082
......@@ -3,7 +3,7 @@
Name: libuniset
Version: 1.0
Release: alt37
Release: alt38
Summary: UniSet - library for building distributed industrial control systems
License: GPL
Group: Development/C++
......@@ -207,6 +207,9 @@ rm -f %buildroot%_libdir/*.la
%changelog
* Thu Jun 09 2011 Pavel Vainerman <pv@altlinux.ru> 1.0-alt38
- fied bug in ComPort::cleanupChannel()
* Sun Jun 05 2011 Pavel Vainerman <pv@altlinux.ru> 1.0-alt37
- add cleanup before send for ComPort
......
......@@ -309,6 +309,10 @@ void ComPort::cleanupChannel()
*/
unsigned char tmpbuf[100];
int k = 0;
bool old_waiting = waiting;
waiting = false;
int mask = fcntl(fd,F_GETFL);
fcntl(fd,F_SETFL,O_NONBLOCK);
try
{
do
......@@ -319,9 +323,8 @@ void ComPort::cleanupChannel()
}
catch(...){}
// #warning Обнулять нельзя, может надо делать что-то интелектуальнее...
// curSym = 0;
// bufLength = 0;
fcntl(fd,F_SETFL,mask);
waiting = old_waiting;
}
// --------------------------------------------------------------------------------
void ComPort::setSpeed( std::string s )
......
......@@ -81,6 +81,7 @@ mbErrCode ModbusRTUSlave::receive( ModbusRTU::ModbusAddr addr, timeout_t timeout
}
// dlog[Debug::WARN] << "(receive): " << mbErr2Str(res) << endl;
// cerr << "**** (receive): " << mbErr2Str(res) << endl;
usleep(10000);
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