summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorLeyla Farazha <leyla@lindenlab.com>2010-08-19 14:23:14 -0700
committerLeyla Farazha <leyla@lindenlab.com>2010-08-19 14:23:14 -0700
commitc39d74ac985e789eef8ee988cf8ba80fb2402683 (patch)
tree6d62904c00c84390f84036cb3b0984fe416a6b2c /indra
parent650171af1788435e200c62965c3ffe314d2082db (diff)
synchronous llavatarcachename::get calls now return true even if entry is expired
Diffstat (limited to 'indra')
-rw-r--r--indra/llmessage/llavatarnamecache.cpp17
-rw-r--r--indra/newview/lltoolpie.cpp21
-rw-r--r--indra/newview/llviewermessage.cpp21
3 files changed, 29 insertions, 30 deletions
diff --git a/indra/llmessage/llavatarnamecache.cpp b/indra/llmessage/llavatarnamecache.cpp
index 803d1e268d..0571973c23 100644
--- a/indra/llmessage/llavatarnamecache.cpp
+++ b/indra/llmessage/llavatarnamecache.cpp
@@ -574,6 +574,8 @@ void LLAvatarNameCache::buildLegacyName(const std::string& full_name,
av_name->mExpires = F64_MAX;
}
+// fills in av_name if it has it in the cache, even if expired (can check expiry time)
+// returns bool specifying if av_name was filled, false otherwise
bool LLAvatarNameCache::get(const LLUUID& agent_id, LLAvatarName *av_name)
{
if (sRunning)
@@ -587,11 +589,16 @@ bool LLAvatarNameCache::get(const LLUUID& agent_id, LLAvatarName *av_name)
{
*av_name = it->second;
- // re-request name if entry is expired, otherwise return
- if (av_name->mExpires > LLFrameTimer::getTotalSeconds())
+ // re-request name if entry is expired
+ if (av_name->mExpires < LLFrameTimer::getTotalSeconds())
{
- return true;
+ if (!isRequestPending(agent_id))
+ {
+ sAskQueue.insert(agent_id);
+ }
}
+
+ return true;
}
}
else
@@ -725,8 +732,8 @@ F64 LLAvatarNameCache::nameExpirationFromHeaders(LLSD headers)
}
else
{
- // With no expiration info, default to a day
- const F64 DEFAULT_EXPIRES = 24.0 * 60.0 * 60.0;
+ // With no expiration info, default to an hour
+ const F64 DEFAULT_EXPIRES = 60.0 * 60.0;
F64 now = LLFrameTimer::getTotalSeconds();
return now + DEFAULT_EXPIRES;
}
diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp
index 809d39885d..479993c4dd 100644
--- a/indra/newview/lltoolpie.cpp
+++ b/indra/newview/lltoolpie.cpp
@@ -879,18 +879,15 @@ BOOL LLToolPie::handleTooltipObject( LLViewerObject* hover_object, std::string l
full_name = LLTrans::getString("TooltipPerson");
}
}
- if (LLAvatarNameCache::useDisplayNames())
- {
- LLAvatarName av_name;
- LLAvatarNameCache::get(hover_object->getID(), &av_name);
- if (!av_name.mDisplayName.empty())
- {
- final_name = av_name.mDisplayName + " (" + av_name.mUsername + ")";
- }
- else
- {
- final_name = full_name;
- }
+
+ LLAvatarName av_name;
+ if (LLAvatarNameCache::get(hover_object->getID(), &av_name))
+ {
+ final_name = av_name.mDisplayName + " (" + av_name.mUsername + ")";
+ }
+ else
+ {
+ final_name = full_name;
}
// *HACK: We may select this object, so pretend it was clicked
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 0ed7ab835b..5c36792a0d 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -3078,19 +3078,14 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data)
// I don't know if it's OK to change this here, if
// anything downstream does lookups by name, for instance
- if (LLAvatarNameCache::useDisplayNames())
- {
- LLAvatarName av_name;
- LLAvatarNameCache::get(from_id, &av_name);
-
- if (!av_name.mDisplayName.empty())
- {
- chat.mFromName = av_name.mDisplayName;
- }
- else
- {
- chat.mFromName = LLCacheName::cleanFullName(from_name);
- }
+ LLAvatarName av_name;
+ if (LLAvatarNameCache::get(from_id, &av_name))
+ {
+ chat.mFromName = av_name.mDisplayName;
+ }
+ else
+ {
+ chat.mFromName = LLCacheName::cleanFullName(from_name);
}
}
else