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

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

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