summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2010-11-11 11:23:10 -0600
committerDave Parks <davep@lindenlab.com>2010-11-11 11:23:10 -0600
commitd682394d027e93b1b98e213f588126194ec517d1 (patch)
tree8844ad2eb02dcb0e2278935d6d9b098e52dc1de4 /indra/newview
parent2551bfb1b523c1ce2459e0139829a211c36e1bcc (diff)
parentce667514032510ff1ae47daf0f2727933be849bc (diff)
merge
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llmeshrepository.cpp67
-rw-r--r--indra/newview/lltexturefetch.cpp4
-rw-r--r--indra/newview/llviewerwindow.cpp13
3 files changed, 57 insertions, 27 deletions
diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp
index 1885b48812..94ed2697c5 100644
--- a/indra/newview/llmeshrepository.cpp
+++ b/indra/newview/llmeshrepository.cpp
@@ -103,16 +103,36 @@ U32 get_volume_memory_size(const LLVolume* volume)
return indices*2+vertices*11+sizeof(LLVolume)+sizeof(LLVolumeFace)*volume->getNumVolumeFaces();
}
-std::string scrub_host_name(std::string http_url, const LLHost& host)
+std::string scrub_host_name(std::string http_url)
{ //curl loves to abuse the DNS cache, so scrub host names out of urls where trivial to prevent DNS timeouts
- std::string ip_string = host.getIPString();
- std::string host_string = host.getHostName();
+
+ if (!http_url.empty())
+ {
+ std::string::size_type begin_host = http_url.find("://")+3;
+ std::string host_string = http_url.substr(begin_host);
- std::string::size_type idx = http_url.find(host_string);
+ std::string::size_type end_host = host_string.find(":");
+ if (end_host == std::string::npos)
+ {
+ end_host = host_string.find("/");
+ }
- if (!ip_string.empty() && !host_string.empty() && idx != std::string::npos)
- {
- http_url.replace(idx, host_string.length(), ip_string);
+ host_string = host_string.substr(0, end_host);
+
+ std::string::size_type idx = http_url.find(host_string);
+
+ hostent* ent = gethostbyname(host_string.c_str());
+
+ if (ent && ent->h_length > 0)
+ {
+ U8* addr = (U8*) ent->h_addr_list[0];
+
+ std::string ip_string = llformat("%d.%d.%d.%d", addr[0], addr[1], addr[2], addr[3]);
+ if (!ip_string.empty() && !host_string.empty() && idx != std::string::npos)
+ {
+ http_url.replace(idx, host_string.length(), ip_string);
+ }
+ }
}
return http_url;
@@ -571,10 +591,8 @@ void LLMeshRepoThread::run()
mPhysicsShapeRequests = incomplete;
}
-
+ mCurlRequest->process();
}
-
- mCurlRequest->process();
}
res = LLConvexDecomposition::quitThread();
@@ -646,7 +664,6 @@ std::string LLMeshRepoThread::constructUrl(LLUUID mesh_id)
if (gAgent.getRegion())
{
http_url = gMeshRepo.mGetMeshCapability;
- scrub_host_name(http_url, gAgent.getRegionHost());
}
if (!http_url.empty())
@@ -1385,13 +1402,14 @@ LLMeshUploadThread::LLMeshUploadThread(LLMeshUploadThread::instance_list& data,
mFinished = false;
mOrigin = gAgent.getPositionAgent();
mHost = gAgent.getRegionHost();
+
mUploadObjectAssetCapability = gAgent.getRegion()->getCapability("UploadObjectAsset");
mNewInventoryCapability = gAgent.getRegion()->getCapability("NewFileAgentInventoryVariablePrice");
+ mUploadObjectAssetCapability = scrub_host_name(mUploadObjectAssetCapability);
+ mNewInventoryCapability = scrub_host_name(mNewInventoryCapability);
+
mOrigin += gAgent.getAtAxis() * scale.magVec();
-
- scrub_host_name(mUploadObjectAssetCapability, mHost);
- scrub_host_name(mNewInventoryCapability, mHost);
}
LLMeshUploadThread::~LLMeshUploadThread()
@@ -1986,9 +2004,9 @@ void LLMeshHeaderResponder::completedRaw(U32 status, const std::string& reason,
LLMeshRepoThread::sActiveHeaderRequests--;
if (status < 200 || status > 400)
{
- llwarns
- << "Header responder failed with status: "
- << status << ": " << reason << llendl;
+ //llwarns
+ // << "Header responder failed with status: "
+ // << status << ": " << reason << llendl;
// 503 (service unavailable) or 499 (timeout)
// can be due to server load and can be retried
@@ -2275,10 +2293,17 @@ void LLMeshRepository::notifyLoadedMeshes()
return;
}
+ static std::string region_name("never name a region this");
+
if (gAgent.getRegion())
{ //update capability url
- //TODO: only do this when region changes
- mGetMeshCapability = gAgent.getRegion()->getCapability("GetMesh");
+ if (gAgent.getRegion()->getName() != region_name)
+ {
+ region_name = gAgent.getRegion()->getName();
+
+ mGetMeshCapability = gAgent.getRegion()->getCapability("GetMesh");
+ mGetMeshCapability = scrub_host_name(mGetMeshCapability);
+ }
}
LLFastTimer t(FTM_MESH_UPDATE);
@@ -2977,7 +3002,7 @@ void LLMeshUploadThread::priceResult(LLMeshUploadData& data, const LLSD& content
{
mPendingCost += content["upload_price"].asInteger();
data.mRSVP = content["rsvp"].asString();
- data.mRSVP = scrub_host_name(data.mRSVP, mHost);
+ data.mRSVP = scrub_host_name(data.mRSVP);
mConfirmedQ.push(data);
}
@@ -2986,7 +3011,7 @@ void LLMeshUploadThread::priceResult(LLTextureUploadData& data, const LLSD& cont
{
mPendingCost += content["upload_price"].asInteger();
data.mRSVP = content["rsvp"].asString();
- data.mRSVP = scrub_host_name(data.mRSVP, mHost);
+ data.mRSVP = scrub_host_name(data.mRSVP);
mConfirmedTextureQ.push(data);
}
diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp
index d6d38de225..ca7b51a3cc 100644
--- a/indra/newview/lltexturefetch.cpp
+++ b/indra/newview/lltexturefetch.cpp
@@ -51,6 +51,8 @@
#include "llviewerstats.h"
#include "llworld.h"
+std::string scrub_host_name(std::string http_url);
+
//////////////////////////////////////////////////////////////////////////////
class LLTextureFetchWorker : public LLWorkerClass
{
@@ -912,7 +914,7 @@ bool LLTextureFetchWorker::doWork(S32 param)
// Will call callbackHttpGet when curl request completes
std::vector<std::string> headers;
headers.push_back("Accept: image/x-j2c");
- res = mFetcher->mCurlGetRequest->getByteRange(mUrl, headers, offset, mRequestedSize,
+ res = mFetcher->mCurlGetRequest->getByteRange(scrub_host_name(mUrl), headers, offset, mRequestedSize,
new HTTPGetResponder(mFetcher, mID, LLTimer::getTotalTime(), mRequestedSize, offset, true));
}
if (!res)
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 573fb1a8b5..972c9c255e 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -655,12 +655,15 @@ public:
}
}
- S32 pending = (S32) gMeshRepo.mPendingRequests.size();
- S32 header = (S32) gMeshRepo.mThread->mHeaderReqQ.size();
- S32 lod = (S32) gMeshRepo.mThread->mLODReqQ.size();
-
- if (pending + header + lod + LLMeshRepoThread::sActiveHeaderRequests + LLMeshRepoThread::sActiveLODRequests != 0)
+ if (!gMeshRepo.mPendingRequests.empty() ||
+ !gMeshRepo.mThread->mHeaderReqQ.empty() ||
+ !gMeshRepo.mThread->mLODReqQ.empty())
{
+ LLMutexLock lock(gMeshRepo.mThread->mMutex);
+ S32 pending = (S32) gMeshRepo.mPendingRequests.size();
+ S32 header = (S32) gMeshRepo.mThread->mHeaderReqQ.size();
+ S32 lod = (S32) gMeshRepo.mThread->mLODReqQ.size();
+
addText(xpos, ypos, llformat ("Mesh Queue - %d pending (%d:%d header | %d:%d LOD)",
pending,
LLMeshRepoThread::sActiveHeaderRequests, header,