diff options
Diffstat (limited to 'indra/llmessage')
-rw-r--r-- | indra/llmessage/llavatarnamecache.cpp | 53 | ||||
-rw-r--r-- | indra/llmessage/llavatarnamecache.h | 11 |
2 files changed, 33 insertions, 31 deletions
diff --git a/indra/llmessage/llavatarnamecache.cpp b/indra/llmessage/llavatarnamecache.cpp index 6455286770..72498111fd 100644 --- a/indra/llmessage/llavatarnamecache.cpp +++ b/indra/llmessage/llavatarnamecache.cpp @@ -48,9 +48,6 @@ namespace LLAvatarNameCache // in the middle of a session. bool sUseDisplayNames = true; - // While false, buffer requests for later. Used during viewer startup. - bool sRunning = false; - // Base lookup URL for name service. // On simulator, loaded from indra.xml // On viewer, usually a simulator capability (at People API team's request) @@ -85,7 +82,8 @@ namespace LLAvatarNameCache LLFrameTimer sEraseExpiredTimer; void processNameFromService(const LLSD& row); - void requestNames(); + void requestNamesViaCapability(); + void requestNamesViaLegacy(); bool isRequestPending(const LLUUID& agent_id); // Erase expired names from cache @@ -203,7 +201,7 @@ void LLAvatarNameCache::processNameFromService(const LLSD& row) } } -void LLAvatarNameCache::requestNames() +void LLAvatarNameCache::requestNamesViaCapability() { // URL format is like: // http://pdp60.lindenlab.com:8000/agents/?ids=3941037e-78ab-45f0-b421-bd6e77c1804d&ids=0012809d-7d2d-4c24-9609-af1230a37715&ids=0019aaba-24af-4f0a-aa72-6457953cf7f0 @@ -252,9 +250,13 @@ void LLAvatarNameCache::requestNames() } } -void LLAvatarNameCache::initClass(bool running) +void LLAvatarNameCache::requestNamesViaLegacy() +{ + // JAMESDEBUG TODO +} + +void LLAvatarNameCache::initClass() { - sRunning = running; } void LLAvatarNameCache::cleanupClass() @@ -307,18 +309,8 @@ void LLAvatarNameCache::setNameLookupURL(const std::string& name_lookup_url) sNameLookupURL = name_lookup_url; } -void LLAvatarNameCache::setRunning(bool running) -{ - sRunning = running; -} - void LLAvatarNameCache::idle() { - if (!sRunning) - { - return; - } - // 100 ms is the threshold for "user speed" operations, so we can // stall for about that long to batch up requests. const F32 SECS_BETWEEN_REQUESTS = 0.1f; @@ -334,18 +326,21 @@ void LLAvatarNameCache::idle() eraseExpired(); } - if (sNameLookupURL.empty()) + if (sAskQueue.empty()) { - // ...viewer has not yet received capability from region return; } - if (sAskQueue.empty()) + if (!sNameLookupURL.empty()) { - return; + requestNamesViaCapability(); + } + else + { + // ...fall back to legacy name cache system + requestNamesViaLegacy(); + llwarns << "JAMESDEBUG legacy lookup call" << llendl; } - - requestNames(); // Move requests from Ask queue to Pending queue F64 now = LLFrameTimer::getTotalSeconds(); @@ -460,3 +455,15 @@ void LLAvatarNameCache::erase(const LLUUID& agent_id) { sCache.erase(agent_id); } + +void LLAvatarNameCache::fetch(const LLUUID& agent_id) +{ + // re-request, even if request is already pending + sAskQueue.insert(agent_id); +} + +void LLAvatarNameCache::insert(const LLUUID& agent_id, const LLAvatarName& av_name) +{ + // *TODO: update timestamp if zero? + sCache[agent_id] = av_name; +} diff --git a/indra/llmessage/llavatarnamecache.h b/indra/llmessage/llavatarnamecache.h index 4aabacd1f3..68a6c28b7b 100644 --- a/indra/llmessage/llavatarnamecache.h +++ b/indra/llmessage/llavatarnamecache.h @@ -42,21 +42,16 @@ class LLUUID; namespace LLAvatarNameCache { - // On the viewer, name cache starts in a non-running state until we - // know if we have the name lookup capability for the agent's region. - // In that state it buffers requests for later. - void initClass(bool running); + void initClass(); void cleanupClass(); void importFile(std::istream& istr); void exportFile(std::ostream& ostr); // On the viewer, usually a simulator capabilitity + // If empty, name cache will fall back to using legacy name + // lookup system void setNameLookupURL(const std::string& name_lookup_url); - - // Once we know if the lookup service is available we can start - // requesting names. - void setRunning(bool running); // Periodically makes a batch request for display names not already in // cache. Call once per frame. |