diff options
author | Leyla Farazha <leyla@lindenlab.com> | 2010-08-04 17:11:01 -0700 |
---|---|---|
committer | Leyla Farazha <leyla@lindenlab.com> | 2010-08-04 17:11:01 -0700 |
commit | c7d49b4cb22ceac5778a8e178aa6ce62fa42c72e (patch) | |
tree | 7a352289afec31e8af8f3d6845f57c01260e9629 /indra/llmessage | |
parent | 6f256e2d57d6814fdb97809405989c54ab148c6b (diff) |
DEV-52354 Username shown in local chat if idle for over 90 seconds
reviewd by richard
Diffstat (limited to 'indra/llmessage')
-rw-r--r-- | indra/llmessage/llavatarnamecache.cpp | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/indra/llmessage/llavatarnamecache.cpp b/indra/llmessage/llavatarnamecache.cpp index 912f34fcae..803d1e268d 100644 --- a/indra/llmessage/llavatarnamecache.cpp +++ b/indra/llmessage/llavatarnamecache.cpp @@ -86,7 +86,7 @@ namespace LLAvatarNameCache LLFrameTimer sRequestTimer; // Periodically clean out expired entries from the cache - LLFrameTimer sEraseExpiredTimer; + //LLFrameTimer sEraseExpiredTimer; //----------------------------------------------------------------------- // Internal methods @@ -505,11 +505,16 @@ void LLAvatarNameCache::idle() //} // Must be large relative to above - const F32 ERASE_EXPIRED_TIMEOUT = 60.f; // seconds - if (sEraseExpiredTimer.checkExpirationAndReset(ERASE_EXPIRED_TIMEOUT)) - { - eraseExpired(); - } + + // No longer deleting expired entries, just re-requesting in the get + // this way first synchronous get call on an expired entry won't return + // legacy name. LF + + //const F32 ERASE_EXPIRED_TIMEOUT = 60.f; // seconds + //if (sEraseExpiredTimer.checkExpirationAndReset(ERASE_EXPIRED_TIMEOUT)) + //{ + // eraseExpired(); + //} if (sAskQueue.empty()) { @@ -581,7 +586,12 @@ bool LLAvatarNameCache::get(const LLUUID& agent_id, LLAvatarName *av_name) if (it != sCache.end()) { *av_name = it->second; - return true; + + // re-request name if entry is expired, otherwise return + if (av_name->mExpires > LLFrameTimer::getTotalSeconds()) + { + return true; + } } } else @@ -624,9 +634,15 @@ void LLAvatarNameCache::get(const LLUUID& agent_id, callback_slot_t slot) std::map<LLUUID,LLAvatarName>::iterator it = sCache.find(agent_id); if (it != sCache.end()) { - // ...name already exists in cache, fire callback now - fireSignal(agent_id, slot, it->second); - return; + const LLAvatarName& av_name = it->second; + + if (av_name.mExpires > LLFrameTimer::getTotalSeconds()) + { + // ...name already exists in cache, fire callback now + fireSignal(agent_id, slot, av_name); + + return; + } } } else |