From 4983fd6ab6ddf0d03f415e84c185ad8f1350ef37 Mon Sep 17 00:00:00 2001 From: Aleric Inglewood Date: Fri, 3 May 2013 17:59:27 +0200 Subject: [PATCH] Allow switching between HTTP and UDP inventory without relogging. This also makes the viewer immune for grids that send the FetchInventory2 et al capabilities regardsless of whether we requested them (in fact, we always request them now: we need them when someone switches in the middle of a session). Note that (I tested that) textures could already be switched between HTTP and UDP without relogging. --- .../llinventorymodelbackgroundfetch.cpp | 41 ++++++++----------- indra/newview/lltexturefetch.cpp | 2 +- indra/newview/llviewerinventory.cpp | 33 ++++++++------- indra/newview/llviewerregion.cpp | 13 ++---- 4 files changed, 40 insertions(+), 49 deletions(-) diff --git a/indra/newview/llinventorymodelbackgroundfetch.cpp b/indra/newview/llinventorymodelbackgroundfetch.cpp index a481a6720..272a0aad8 100644 --- a/indra/newview/llinventorymodelbackgroundfetch.cpp +++ b/indra/newview/llinventorymodelbackgroundfetch.cpp @@ -198,23 +198,26 @@ void LLInventoryModelBackgroundFetch::backgroundFetch() LLViewerRegion* region = gAgent.getRegion(); if (mBackgroundFetchActive && region && region->capabilitiesReceived()) { - // If we'll be using the capability, we'll be sending batches and the background thing isn't as important. - std::string url = region->getCapability("FetchInventory2"); - if (gSavedSettings.getBOOL("UseHTTPInventory") && !url.empty()) + if (gSavedSettings.getBOOL("UseHTTPInventory")) { - if (!mPerServicePtr) + // If we'll be using the capability, we'll be sending batches and the background thing isn't as important. + std::string url = region->getCapability("FetchInventory2"); + if (!url.empty()) { - // One time initialization needed for bulkFetch(). - std::string servicename = AIPerService::extract_canonical_servicename(url); - if (!servicename.empty()) + if (!mPerServicePtr) { - llinfos << "Initialized service name for bulk inventory fetching with \"" << servicename << "\"." << llendl; - mPerServicePtr = AIPerService::instance(servicename); + // One time initialization needed for bulkFetch(). + std::string servicename = AIPerService::extract_canonical_servicename(url); + if (!servicename.empty()) + { + llinfos << "Initialized service name for bulk inventory fetching with \"" << servicename << "\"." << llendl; + mPerServicePtr = AIPerService::instance(servicename); + } } + bulkFetch(); + return; } - bulkFetch(); - return; - } + } #if 1 //-------------------------------------------------------------------------------- @@ -714,6 +717,7 @@ void LLInventoryModelBackgroundFetch::bulkFetch() { mFetchCount++; url = region->getCapability("FetchInventory2"); + llassert(!url.empty()); if (!url.empty()) { LLSD body; @@ -722,18 +726,6 @@ void LLInventoryModelBackgroundFetch::bulkFetch() LLHTTPClient::post(url, body, new LLInventoryModelFetchItemResponder(body)); } - //else - //{ - // LLMessageSystem* msg = gMessageSystem; - // msg->newMessage("FetchInventory"); - // msg->nextBlock("AgentData"); - // msg->addUUID("AgentID", gAgent.getID()); - // msg->addUUID("SessionID", gAgent.getSessionID()); - // msg->nextBlock("InventoryData"); - // msg->addUUID("OwnerID", mPermissions.getOwner()); - // msg->addUUID("ItemID", mUUID); - // gAgent.sendReliableMessage(); - //} } if (item_request_body_lib.size()) @@ -741,6 +733,7 @@ void LLInventoryModelBackgroundFetch::bulkFetch() mFetchCount++; url = region->getCapability("FetchLib2"); + llassert(!url.empty()); if (!url.empty()) { LLSD body; diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index a129675fb..f80bd9539 100644 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -1172,7 +1172,7 @@ bool LLTextureFetchWorker::doWork(S32 param) } else { - // This will happen if not logged in or if a region deoes not have HTTP Texture enabled + // This will happen if not logged in or if a region does not have HTTP Texture enabled //llwarns << "Region not found for host: " << mHost << llendl; mCanUseHTTP = false; } diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index eb3e35997..97ea6d71a 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -353,22 +353,25 @@ void LLViewerInventoryItem::fetchFromServer(void) const { std::string url; - LLViewerRegion* region = gAgent.getRegion(); - // we have to check region. It can be null after region was destroyed. See EXT-245 - if (region) + if (gSavedSettings.getBOOL("UseHTTPInventory")) { - if(gAgent.getID() != mPermissions.getOwner()) - { - url = region->getCapability("FetchLib2"); - } - else - { - url = region->getCapability("FetchInventory2"); - } - } - else - { - llwarns << "Agent Region is absent" << llendl; + LLViewerRegion* region = gAgent.getRegion(); + // we have to check region. It can be null after region was destroyed. See EXT-245 + if (region) + { + if(gAgent.getID() != mPermissions.getOwner()) + { + url = region->getCapability("FetchLib2"); + } + else + { + url = region->getCapability("FetchInventory2"); + } + } + else + { + llwarns << "Agent Region is absent" << llendl; + } } if (!url.empty()) diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 70f432f02..6c09d31e4 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1638,15 +1638,10 @@ void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames) capabilityNames.append("EnvironmentSettings"); capabilityNames.append("EstateChangeInfo"); capabilityNames.append("EventQueueGet"); - - if (gSavedSettings.getBOOL("UseHTTPInventory")) //Caps suffixed with 2 by LL. Don't update until rest of fetch system is updated first. - { - capabilityNames.append("FetchLib2"); - capabilityNames.append("FetchLibDescendents2"); - capabilityNames.append("FetchInventory2"); - capabilityNames.append("FetchInventoryDescendents2"); - } - + capabilityNames.append("FetchLib2"); + capabilityNames.append("FetchLibDescendents2"); + capabilityNames.append("FetchInventory2"); + capabilityNames.append("FetchInventoryDescendents2"); capabilityNames.append("GamingData"); //Used by certain grids. capabilityNames.append("GetDisplayNames"); capabilityNames.append("GetMesh");