void LLPathfindingNavMeshZone::NavMeshLocation::handleNavMesh(LLPathfindingNavMesh::ENavMeshRequestStatus pNavMeshRequestStatus, const LLPathfindingNavMeshStatus &pNavMeshStatus, const LLSD::Binary &pNavMeshData)
{
	llassert(mRegionUUID == pNavMeshStatus.getRegionUUID());

	if ((pNavMeshRequestStatus == LLPathfindingNavMesh::kNavMeshRequestCompleted) &&
		(!mHasNavMesh || (mNavMeshVersion != pNavMeshStatus.getVersion())))
	{
		llassert(!pNavMeshData.empty());
		mHasNavMesh = true;
		mNavMeshVersion = pNavMeshStatus.getVersion();
		llassert(LLPathingLib::getInstance() != NULL);
		if (LLPathingLib::getInstance() != NULL)
		{
			LLPathingLib::getInstance()->extractNavMeshSrcFromLLSD(pNavMeshData, mDirection);
		}
	}

	mRequestStatus = pNavMeshRequestStatus;
	mNavMeshStatus = pNavMeshStatus.getStatus();
	mLocationCallback();
}
void LLPathfindingNavMesh::handleNavMeshNewVersion(const LLPathfindingNavMeshStatus &pNavMeshStatus)
{
	llassert(mNavMeshStatus.getRegionUUID() == pNavMeshStatus.getRegionUUID());
	if (mNavMeshStatus.getVersion() == pNavMeshStatus.getVersion())
	{
		mNavMeshStatus = pNavMeshStatus;
		sendStatus();
	}
	else
	{
		mNavMeshData.clear();
		mNavMeshStatus = pNavMeshStatus;
		setRequestStatus(kNavMeshRequestNeedsUpdate);
	}
}
void LLPathfindingNavMesh::handleRefresh(const LLPathfindingNavMeshStatus &pNavMeshStatus)
{
	llassert(mNavMeshStatus.getRegionUUID() == pNavMeshStatus.getRegionUUID());
	llassert(mNavMeshStatus.getVersion() == pNavMeshStatus.getVersion());
	mNavMeshStatus = pNavMeshStatus;
	if (mNavMeshRequestStatus == kNavMeshRequestChecking)
	{
		llassert(!mNavMeshData.empty());
		setRequestStatus(kNavMeshRequestCompleted);
	}
	else
	{
		sendStatus();
	}
}
void LLPathfindingManager::sendRequestGetNavMeshForRegion(LLPathfindingNavMeshPtr navMeshPtr, LLViewerRegion *pRegion, const LLPathfindingNavMeshStatus &pNavMeshStatus)
{
	if ((pRegion == NULL) || !pRegion->isAlive())
	{
		navMeshPtr->handleNavMeshNotEnabled();
	}
	else
	{
		std::string navMeshURL = getRetrieveNavMeshURLForRegion(pRegion);

		if (navMeshURL.empty())
		{
			navMeshPtr->handleNavMeshNotEnabled();
		}
		else
		{
			navMeshPtr->handleNavMeshStart(pNavMeshStatus);
			LLHTTPClient::ResponderPtr responder = new NavMeshResponder(navMeshURL, pNavMeshStatus.getVersion(), navMeshPtr);

			LLSD postData;
			LLHTTPClient::post(navMeshURL, postData, responder);
		}
	}
}
bool LLPathfindingNavMesh::hasNavMeshVersion(const LLPathfindingNavMeshStatus &pNavMeshStatus) const
{
	return ((mNavMeshStatus.getVersion() == pNavMeshStatus.getVersion()) &&
		((mNavMeshRequestStatus == kNavMeshRequestStarted) || (mNavMeshRequestStatus == kNavMeshRequestCompleted) ||
		((mNavMeshRequestStatus == kNavMeshRequestChecking) && !mNavMeshData.empty())));
}