Commit cb081e64 authored by Pavel Vainerman's avatar Pavel Vainerman

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

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