Commit b4ed97c3 authored by Pavel Vainerman's avatar Pavel Vainerman

(UNetUDP): оптимизация обработки (спасибо uzum), корректировка значений

по умолчанию.
parent 28f23413
......@@ -8,7 +8,7 @@
Name: libuniset
Version: 1.8
Release: alt3
Release: alt4
Summary: UniSet - library for building distributed industrial control systems
License: GPL
......@@ -339,6 +339,9 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname
%changelog
* Fri Mar 13 2015 Pavel Vainerman <pv@altlinux.ru> 1.8-alt4
- unetudp: minor optimization (thank`s uzum)
* Sun Mar 01 2015 Pavel Vainerman <pv@altlinux.ru> 1.8-alt3
- ModbusMaster: fixed bug in initialization (close setbug #5583)
......
......@@ -26,7 +26,7 @@ updatepause(100),
udp(0),
recvTimeout(5000),
prepareTime(2000),
lostTimeout(5000),
lostTimeout(200), /* 2*updatepause */
lostPackets(0),
sidRespond(UniSetTypes::DefaultObjectId),
respondInvert(false),
......@@ -35,7 +35,7 @@ activated(false),
r_thr(0),
u_thr(0),
pnum(0),
maxDifferens(1000),
maxDifferens(20),
waitClean(false),
rnum(0),
maxProcessingCount(100),
......@@ -241,10 +241,20 @@ void UNetReceiver::real_update()
// чтобы констатировать потерю пакета..
if( sub > 1 && sub < maxDifferens )
{
// если p.num < pnum, то это какой-то "дубль",
// т.к мы все пакеты <= pnum уже "отработали".
// а значит можно не ждать, а откидывать пакет и
// дальше работать..
if( p.num < pnum )
{
qpack.pop();
continue;
}
if( !ptLostTimeout.checkTime() )
return;
lostPackets++;
lostPackets += sub;
}
else if( p.num == pnum )
{
......@@ -252,9 +262,16 @@ void UNetReceiver::real_update()
* для надёжности лучше обрабатывать..
* для "оптимизации".. лучше игнорировать
*/
qpack.pop(); // пока выбрали вариант "оптимизации"
qpack.pop(); // пока выбрали вариант "оптимизации" (выкидываем из очереди и идём дальше)
continue;
}
if( sub >= maxDifferens )
{
// считаем сколько пакетов потеряли..
if( p.num > pnum )
lostPackets+=sub;
}
}
ptLostTimeout.reset();
......
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