From 84d8b320a2dff7a7d34e04d1f5c7fd38d148e5c7 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Tue, 1 May 2012 14:55:53 -0700 Subject: PATH-580: Ensuring that the characters and linksets capability services are properly deferred requested in the case that a regions capabilities have not been fully received at initial request time. --- indra/newview/llpathfindingmanager.cpp | 81 +++++++++++++++++++++++++++------- indra/newview/llpathfindingmanager.h | 2 + 2 files changed, 66 insertions(+), 17 deletions(-) diff --git a/indra/newview/llpathfindingmanager.cpp b/indra/newview/llpathfindingmanager.cpp index 8ce2e71c63..e01466569e 100644 --- a/indra/newview/llpathfindingmanager.cpp +++ b/indra/newview/llpathfindingmanager.cpp @@ -400,27 +400,40 @@ void LLPathfindingManager::requestSetAgentState(EAgentState pRequestedAgentState void LLPathfindingManager::requestGetLinksets(request_id_t pRequestId, linksets_callback_t pLinksetsCallback) const { LLPathfindingLinksetListPtr emptyLinksetListPtr; + LLViewerRegion *currentRegion = getCurrentRegion(); - std::string objectLinksetsURL = getObjectLinksetsURLForCurrentRegion(); - std::string terrainLinksetsURL = getTerrainLinksetsURLForCurrentRegion(); - if (objectLinksetsURL.empty() || terrainLinksetsURL.empty()) + if (currentRegion == NULL) { pLinksetsCallback(pRequestId, kRequestNotEnabled, emptyLinksetListPtr); } - else + else if (!currentRegion->capabilitiesReceived()) { pLinksetsCallback(pRequestId, kRequestStarted, emptyLinksetListPtr); + currentRegion->setCapabilitiesReceivedCallback(boost::bind(&LLPathfindingManager::handleDeferredGetLinksetsForRegion, this, _1, pRequestId, pLinksetsCallback)); + } + else + { + std::string objectLinksetsURL = getObjectLinksetsURLForCurrentRegion(); + std::string terrainLinksetsURL = getTerrainLinksetsURLForCurrentRegion(); + if (objectLinksetsURL.empty() || terrainLinksetsURL.empty()) + { + pLinksetsCallback(pRequestId, kRequestNotEnabled, emptyLinksetListPtr); + } + else + { + pLinksetsCallback(pRequestId, kRequestStarted, emptyLinksetListPtr); - bool doRequestTerrain = isAllowViewTerrainProperties(); - LinksetsResponderPtr linksetsResponderPtr(new LinksetsResponder(pRequestId, pLinksetsCallback, true, doRequestTerrain)); + bool doRequestTerrain = isAllowViewTerrainProperties(); + LinksetsResponderPtr linksetsResponderPtr(new LinksetsResponder(pRequestId, pLinksetsCallback, true, doRequestTerrain)); - LLHTTPClient::ResponderPtr objectLinksetsResponder = new ObjectLinksetsResponder(objectLinksetsURL, linksetsResponderPtr); - LLHTTPClient::get(objectLinksetsURL, objectLinksetsResponder); + LLHTTPClient::ResponderPtr objectLinksetsResponder = new ObjectLinksetsResponder(objectLinksetsURL, linksetsResponderPtr); + LLHTTPClient::get(objectLinksetsURL, objectLinksetsResponder); - if (doRequestTerrain) - { - LLHTTPClient::ResponderPtr terrainLinksetsResponder = new TerrainLinksetsResponder(terrainLinksetsURL, linksetsResponderPtr); - LLHTTPClient::get(terrainLinksetsURL, terrainLinksetsResponder); + if (doRequestTerrain) + { + LLHTTPClient::ResponderPtr terrainLinksetsResponder = new TerrainLinksetsResponder(terrainLinksetsURL, linksetsResponderPtr); + LLHTTPClient::get(terrainLinksetsURL, terrainLinksetsResponder); + } } } } @@ -473,17 +486,31 @@ void LLPathfindingManager::requestGetCharacters(request_id_t pRequestId, charact { LLPathfindingCharacterListPtr emptyCharacterListPtr; - std::string charactersURL = getCharactersURLForCurrentRegion(); - if (charactersURL.empty()) + LLViewerRegion *currentRegion = getCurrentRegion(); + + if (currentRegion == NULL) { pCharactersCallback(pRequestId, kRequestNotEnabled, emptyCharacterListPtr); } - else + else if (!currentRegion->capabilitiesReceived()) { pCharactersCallback(pRequestId, kRequestStarted, emptyCharacterListPtr); + currentRegion->setCapabilitiesReceivedCallback(boost::bind(&LLPathfindingManager::handleDeferredGetCharactersForRegion, this, _1, pRequestId, pCharactersCallback)); + } + else + { + std::string charactersURL = getCharactersURLForCurrentRegion(); + if (charactersURL.empty()) + { + pCharactersCallback(pRequestId, kRequestNotEnabled, emptyCharacterListPtr); + } + else + { + pCharactersCallback(pRequestId, kRequestStarted, emptyCharacterListPtr); - LLHTTPClient::ResponderPtr charactersResponder = new CharactersResponder(charactersURL, pRequestId, pCharactersCallback); - LLHTTPClient::get(charactersURL, charactersResponder); + LLHTTPClient::ResponderPtr charactersResponder = new CharactersResponder(charactersURL, pRequestId, pCharactersCallback); + LLHTTPClient::get(charactersURL, charactersResponder); + } } } @@ -522,6 +549,26 @@ void LLPathfindingManager::handleDeferredGetNavMeshForRegion(const LLUUID &pRegi } } +void LLPathfindingManager::handleDeferredGetLinksetsForRegion(const LLUUID &pRegionUUID, request_id_t pRequestId, linksets_callback_t pLinksetsCallback) const +{ + LLViewerRegion *currentRegion = getCurrentRegion(); + + if ((currentRegion != NULL) && (currentRegion->getRegionID() == pRegionUUID)) + { + requestGetLinksets(pRequestId, pLinksetsCallback); + } +} + +void LLPathfindingManager::handleDeferredGetCharactersForRegion(const LLUUID &pRegionUUID, request_id_t pRequestId, characters_callback_t pCharactersCallback) const +{ + LLViewerRegion *currentRegion = getCurrentRegion(); + + if ((currentRegion != NULL) && (currentRegion->getRegionID() == pRegionUUID)) + { + requestGetCharacters(pRequestId, pCharactersCallback); + } +} + void LLPathfindingManager::handleNavMeshStatusRequest(const LLPathfindingNavMeshStatus &pNavMeshStatus, LLViewerRegion *pRegion) { LLPathfindingNavMeshPtr navMeshPtr = getNavMeshForRegion(pNavMeshStatus.getRegionUUID()); diff --git a/indra/newview/llpathfindingmanager.h b/indra/newview/llpathfindingmanager.h index 067a2c2515..ad4dbe9adc 100644 --- a/indra/newview/llpathfindingmanager.h +++ b/indra/newview/llpathfindingmanager.h @@ -109,6 +109,8 @@ private: void sendRequestGetNavMeshForRegion(LLPathfindingNavMeshPtr navMeshPtr, LLViewerRegion *pRegion, const LLPathfindingNavMeshStatus &pNavMeshStatus); void handleDeferredGetNavMeshForRegion(const LLUUID &pRegionUUID); + void handleDeferredGetLinksetsForRegion(const LLUUID &pRegionUUID, request_id_t pRequestId, linksets_callback_t pLinksetsCallback) const; + void handleDeferredGetCharactersForRegion(const LLUUID &pRegionUUID, request_id_t pRequestId, characters_callback_t pCharactersCallback) const; void handleNavMeshStatusRequest(const LLPathfindingNavMeshStatus &pNavMeshStatus, LLViewerRegion *pRegion); void handleNavMeshStatusUpdate(const LLPathfindingNavMeshStatus &pNavMeshStatus); -- cgit v1.2.3