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.
This commit is contained in:
Aleric Inglewood
2013-05-03 17:59:27 +02:00
parent 673e96e829
commit 4983fd6ab6
4 changed files with 40 additions and 49 deletions

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -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())

View File

@@ -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");