Commit 26775e59 authored by Pavel Vainerman's avatar Pavel Vainerman

(unet): init cache refactoring

parent 87d569a2
......@@ -852,7 +852,16 @@ void UNetReceiver::initIterators() noexcept
// -----------------------------------------------------------------------------
void UNetReceiver::initDCache( UniSetUDP::UDPMessage& pack, bool force ) noexcept
{
CacheInfo& d_info(d_icache_map[pack.getDataID()]);
// CacheInfo& d_info(d_icache_map[pack.getDataID()]);
auto c_it = d_icache_map.find(pack.getDataID());
if( c_it == d_icache_map.end() )
{
auto ret = d_icache_map.insert(std::pair<long, CacheInfo>(pack.getDataID(), CacheInfo()));
c_it = ret.first;
}
CacheInfo& d_info = c_it->second;
if( !force && pack.dcount == d_info.cache.size() )
return;
......@@ -864,8 +873,8 @@ void UNetReceiver::initDCache( UniSetUDP::UDPMessage& pack, bool force ) noexcep
for( ; it != d_icache_map.end(); ++it )
{
CacheInfo& d_info(it->second);
d_cache_init_ok = d_cache_init_ok && d_info.cache_init_ok;
CacheInfo& d_info2(it->second);
d_cache_init_ok = d_cache_init_ok && d_info2.cache_init_ok;
if(d_cache_init_ok == false)
break;
......@@ -896,7 +905,16 @@ void UNetReceiver::initDCache( UniSetUDP::UDPMessage& pack, bool force ) noexcep
// -----------------------------------------------------------------------------
void UNetReceiver::initACache( UniSetUDP::UDPMessage& pack, bool force ) noexcept
{
CacheInfo& a_info(a_icache_map[pack.getDataID()]);
// CacheInfo& a_info(a_icache_map[pack.getDataID()]);
auto c_it = a_icache_map.find(pack.getDataID());
if( c_it == a_icache_map.end() )
{
auto ret = a_icache_map.insert(std::pair<long, CacheInfo>(pack.getDataID(), CacheInfo()));
c_it = ret.first;
}
CacheInfo& a_info = c_it->second;
if( !force && pack.acount == a_info.cache.size() )
return;
......
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