Commit e8b033a1 authored by Pavel Vaynerman's avatar Pavel Vaynerman Committed by Pavel Vainerman

(UNetUDP): исправлена ошибка в логике переключения каналов (мигание датчика…

(UNetUDP): исправлена ошибка в логике переключения каналов (мигание датчика связи, в случае отсутствия связи по обоим каналам)
parent 2c82a9c5
......@@ -3,7 +3,7 @@
Name: libuniset
Version: 1.4
Release: alt5
Release: alt6
Summary: UniSet - library for building distributed industrial control systems
License: GPL
Group: Development/C++
......@@ -213,6 +213,9 @@ rm -f %buildroot%_libdir/*.la
%changelog
* Tue Jul 10 2012 Pavel Vaynerman <pv@server> 1.4-alt6
- (unetudp): fixed bug in the logic of switching channels
* Thu Jun 14 2012 Pavel Vainerman <pv@altlinux.ru> 1.4-alt5
- (codegen): fixed bug in validation 'iotype'
......
......@@ -39,6 +39,7 @@ sender2(0)
<< "' nodes-filter-value='" << n_fvalue << "'" << endl;
int recvTimeout = conf->getArgPInt("--unet-recv-timeout",it.getProp("recvTimeout"), 5000);
int prepareTime = conf->getArgPInt("--unet-preapre-time",it.getProp("prepareTime"), 2000);
int lostTimeout = conf->getArgPInt("--unet-lost-timeout",it.getProp("lostTimeout"), recvTimeout);
int recvpause = conf->getArgPInt("--unet-recvpause",it.getProp("recvpause"), 10);
int sendpause = conf->getArgPInt("--unet-sendpause",it.getProp("sendpause"), 150);
......@@ -247,6 +248,7 @@ sender2(0)
r->setLockUpdate(false);
r->setReceiveTimeout(recvTimeout);
r->setPrepareTime(prepareTime);
r->setLostTimeout(lostTimeout);
r->setReceivePause(recvpause);
r->setUpdatePause(updatepause);
......
......@@ -25,6 +25,7 @@ recvpause(10),
updatepause(100),
udp(0),
recvTimeout(5000),
prepareTime(2000),
lostTimeout(5000),
lostPackets(0),
sidRespond(UniSetTypes::DefaultObjectId),
......@@ -78,6 +79,7 @@ a_cache_init_ok(false)
u_thr = new ThreadCreator<UNetReceiver>(this, &UNetReceiver::update);
ptRecvTimeout.setTiming(recvTimeout);
ptPrepare.setTiming(prepareTime);
}
// -----------------------------------------------------------------------------
UNetReceiver::~UNetReceiver()
......@@ -93,6 +95,12 @@ void UNetReceiver::setReceiveTimeout( timeout_t msec )
ptRecvTimeout.setTiming(msec);
}
// -----------------------------------------------------------------------------
void UNetReceiver::setPrepareTime( timeout_t msec )
{
prepareTime = msec;
ptPrepare.setTiming(msec);
}
// -----------------------------------------------------------------------------
void UNetReceiver::setLostTimeout( timeout_t msec )
{
lostTimeout = msec;
......@@ -136,6 +144,8 @@ void UNetReceiver::setLockUpdate( bool st )
{
uniset_mutex_lock l(lockMutex,200);
lockUpdate = st;
if( !st )
ptPrepare.reset();
}
// -----------------------------------------------------------------------------
void UNetReceiver::resetTimeout()
......@@ -157,7 +167,7 @@ void UNetReceiver::start()
// -----------------------------------------------------------------------------
void UNetReceiver::update()
{
cerr << "******************* udpate start" << endl;
cerr << "******************* update start" << endl;
while(activated)
{
try
......@@ -398,7 +408,8 @@ void UNetReceiver::receive()
tout = ptRecvTimeout.checkTime();
}
if( trTimeout.change(tout) )
// только если "режим подготовки закончился, то можем генерировать "события"
if( ptPrepare.checkTime() && trTimeout.change(tout) )
{
if( tout )
slEvent(this,evTimeout);
......
......@@ -73,6 +73,7 @@ class UNetReceiver
void setReceivePause( timeout_t msec );
void setUpdatePause( timeout_t msec );
void setLostTimeout( timeout_t msec );
void setPrepareTime( timeout_t msec );
void setMaxDifferens( unsigned long set );
void setRespondID( UniSetTypes::ObjectId id, bool invert=false );
......@@ -116,7 +117,9 @@ class UNetReceiver
UniSetTypes::uniset_mutex pollMutex;
PassiveTimer ptRecvTimeout;
PassiveTimer ptPrepare;
timeout_t recvTimeout;
timeout_t prepareTime;
timeout_t lostTimeout;
PassiveTimer ptLostTimeout;
unsigned long lostPackets; /*!< счётчик потерянных пакетов */
......
......@@ -51,8 +51,7 @@ class StorageInterface
private:
};
// ---------------------------------------------------------------------------
class STLStorage:
public StorageInterface
{
......@@ -76,7 +75,6 @@ class STLStorage:
protected:
private:
};
// ---------------------------------------------------------------------------
#endif
// ---------------------------------------------------------------------------
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