Commit cb081e64 authored by Pavel Vainerman's avatar Pavel Vainerman

(UNetUDP): исправление ошибки с переключением канала приёма

parent 30d0c144
......@@ -16,7 +16,7 @@
Name: libuniset2
Version: 2.6
Release: alt1
Release: alt2
Summary: UniSet - library for building distributed industrial control systems
License: LGPL
......@@ -508,6 +508,9 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname
# history of current unpublished changes
%changelog
* Mon Nov 21 2016 Pavel Vainerman <pv@altlinux.ru> 2.6-alt2
- UNet: fixed bug in change receive channel
* Fri Nov 11 2016 Pavel Vainerman <pv@altlinux.ru> 2.6-alt1
- build new version
- remove 'fastSaveValue'
......
......@@ -589,9 +589,16 @@ void UNetExchange::sysCommand( const uniset::SystemMessage* sm )
{
if( !logserv_host.empty() && logserv_port != 0 && !logserv->isRunning() )
{
try
{
unetinfo << myname << "(init): run log server " << logserv_host << ":" << logserv_port << endl;
logserv->run(logserv_host, logserv_port, true);
}
catch( std::exception& ex )
{
unetwarn << myname << "(init): run logserver FAILED. ERR: " << ex.what() << endl;
}
}
waitSMReady();
......
......@@ -479,6 +479,9 @@ void UNetReceiver::updateThread() noexcept
unetcrit << myname << "(update_thread): " << ex.what() << endl;
}
// смотрим есть ли связь..
checkConnection();
if( sidRespond != DefaultObjectId )
{
try
......@@ -525,8 +528,6 @@ void UNetReceiver::readEvent( ev::io& watcher ) noexcept
if( !activated )
return;
bool tout = false;
try
{
if( receive() )
......@@ -543,6 +544,11 @@ void UNetReceiver::readEvent( ev::io& watcher ) noexcept
{
unetwarn << myname << "(receive): " << e.what() << std::endl;
}
}
// -----------------------------------------------------------------------------
void UNetReceiver::checkConnection()
{
bool tout = false;
// делаем через промежуточную переменную
// чтобы поскорее освободить mutex
......@@ -590,6 +596,9 @@ void UNetReceiver::updateEvent( ev::periodic& tm, int revents ) noexcept
unetcrit << myname << "(updateEvent): " << ex.what() << std::endl;
}
// смотрим есть ли связь..
checkConnection();
if( sidRespond != DefaultObjectId )
{
try
......@@ -676,6 +685,11 @@ bool UNetReceiver::receive() noexcept
unetcrit << myname << "(receive): recv err: " << ex.displayText() << endl;
return false;
}
catch( exception& ex )
{
unetcrit << myname << "(receive): recv err: " << ex.what() << endl;
return false;
}
if( pack.magic != UniSetUDP::UNETUDP_MAGICNUM )
{
......
......@@ -224,6 +224,7 @@ class UNetReceiver:
void initIterators() noexcept;
bool createConnection( bool throwEx = false );
void checkConnection();
public:
......
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