diff options
-rw-r--r-- | indra/newview/llappviewer.cpp | 42 | ||||
-rw-r--r-- | indra/newview/llappviewer.h | 2 | ||||
-rw-r--r-- | indra/newview/llviewerregion.cpp | 18 |
3 files changed, 39 insertions, 23 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 02902bc8a5..409146c4a3 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -3541,9 +3541,10 @@ void LLAppViewer::idle() // NOTE: Starting at this point, we may still have pointers to "dead" objects // floating throughout the various object lists. // + idleNameCache(); idleNetwork(); - + // Check for away from keyboard, kick idle agents. idle_afk_check(); @@ -3878,6 +3879,41 @@ void LLAppViewer::sendLogoutRequest() } } +void LLAppViewer::idleNameCache() +{ + // Neither old nor new name cache can function before agent has a region + LLViewerRegion* region = gAgent.getRegion(); + if (!region) return; + + // deal with any queued name requests and replies. + gCacheName->processPending(); + + // Agent may have moved to a different region, so need to update cap URL + // for name lookups. Can't do this in the cap grant code, as caps are + // granted to neighbor regions before the main agent gets there. Can't + // do it in the move-into-region code because cap not guaranteed to be + // granted yet, for example on teleport. + std::string name_lookup_url; + name_lookup_url.reserve(128); // avoid a memory allocation below + name_lookup_url = region->getCapability("GetDisplayNames"); + + // Ensure capability has been granted + U32 url_size = name_lookup_url.size(); + if (url_size > 0) + { + // capabilities require URLs with slashes before query params: + // https://<host>:<port>/cap/<uuid>/?ids=<blah> + // but the caps are granted like: + // https://<host>:<port>/cap/<uuid> + if (name_lookup_url[url_size-1] != '/') + { + name_lookup_url += '/'; + } + LLAvatarNameCache::setNameLookupURL(name_lookup_url); + } + LLAvatarNameCache::idle(); +} + // // Handle messages, and all message related stuff // @@ -3905,10 +3941,6 @@ void LLAppViewer::idleNetwork() { LLFastTimer t(FTM_IDLE_NETWORK); // decode - // deal with any queued name requests and replies. - gCacheName->processPending(); - LLAvatarNameCache::idle(); - llpushcallstacks ; LLTimer check_message_timer; // Read all available packets from network diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h index a915b7fa50..ff3816922e 100644 --- a/indra/newview/llappviewer.h +++ b/indra/newview/llappviewer.h @@ -210,6 +210,8 @@ private: void idle(); void idleShutdown(); + // update avatar SLID and display name caches + void idleNameCache(); void idleNetwork(); void sendLogoutRequest(); diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index feade68edc..83c5760b58 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -175,24 +175,6 @@ public: mRegion->showReleaseNotes(); } } - - // JAMESDEBUG *TODO* THIS IS WRONG!!!!!!!!!!!!!!!!!!!!! - // this isn't necessarily the region the viewer is in - - // Avatar name lookup library needs to know who to ask - std::string name_lookup_url = mRegion->getCapability("GetDisplayNames"); - // capabilities require URLs with slashes before query params, like: - // https://<host>:<port>/cap/<uuid>/?ids=<blah> - // but the caps are granted like: - // https://<host>:<port>/cap/<uuid> - U32 url_size = name_lookup_url.size(); - if (url_size > 0 && name_lookup_url[url_size-1] != '/') - { - name_lookup_url += '/'; - } - LLAvatarNameCache::setNameLookupURL(name_lookup_url); - - llinfos << "JAMESDEBUG cap " << name_lookup_url << llendl; if (STATE_SEED_GRANTED_WAIT == LLStartUp::getStartupState()) { |