Also a little v2 cleanup snuck in.
This commit is contained in:
Shyotl
2011-04-28 01:20:42 -05:00
parent 0909a4ddbe
commit 722a1dda04

View File

@@ -562,14 +562,13 @@ void LLAvatarNameCache::idle()
bool LLAvatarNameCache::isRequestPending(const LLUUID& agent_id) bool LLAvatarNameCache::isRequestPending(const LLUUID& agent_id)
{ {
const F64 PENDING_TIMEOUT_SECS = 5.0 * 60.0; const F64 PENDING_TIMEOUT_SECS = 5.0 * 60.0;
F64 now = LLFrameTimer::getTotalSeconds();
F64 expire_time = now - PENDING_TIMEOUT_SECS;
pending_queue_t::const_iterator it = sPendingQueue.find(agent_id); pending_queue_t::const_iterator it = sPendingQueue.find(agent_id);
if (it != sPendingQueue.end()) if (it != sPendingQueue.end())
{ {
bool request_expired = (it->second < expire_time); // in the list of requests in flight, retry if too old
return !request_expired; F64 expire_time = LLFrameTimer::getTotalSeconds() - PENDING_TIMEOUT_SECS;
return it->second > expire_time;
} }
return false; return false;
} }
@@ -578,14 +577,12 @@ void LLAvatarNameCache::eraseExpired()
{ {
F64 now = LLFrameTimer::getTotalSeconds(); F64 now = LLFrameTimer::getTotalSeconds();
cache_t::iterator it = sCache.begin(); cache_t::iterator it = sCache.begin();
while (it != sCache.end()) for (cache_t::iterator it = sCache.begin(); it != sCache.end(); ++it)
{ {
cache_t::iterator cur = it; const LLAvatarName& av_name = it->second;
++it;
const LLAvatarName& av_name = cur->second;
if (av_name.mExpires < now) if (av_name.mExpires < now)
{ {
sCache.erase(cur); sCache.erase(it);
} }
} }
} }