summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorprep <prep@lindenlab.com>2010-11-15 14:22:22 -0500
committerprep <prep@lindenlab.com>2010-11-15 14:22:22 -0500
commit80561014b0c30b6e3ce04f0a23daed612f3c4075 (patch)
tree78d7a01e98a8faefb03c8d85096e69bb933050d8
parentf9a35fc4c622cf5b151900dd4590818d965a506b (diff)
parent1ec846a94e5969e642c63074b78250fb8a2a7df4 (diff)
merge
-rw-r--r--indra/llcommon/llthread.cpp4
-rw-r--r--indra/llui/lltextbase.cpp34
-rw-r--r--indra/newview/llmeshrepository.cpp70
-rw-r--r--indra/newview/lltexturefetch.cpp4
-rw-r--r--indra/newview/llviewerwindow.cpp13
-rw-r--r--install.xml4
6 files changed, 88 insertions, 41 deletions
diff --git a/indra/llcommon/llthread.cpp b/indra/llcommon/llthread.cpp
index 9a33324129..59e28948f5 100644
--- a/indra/llcommon/llthread.cpp
+++ b/indra/llcommon/llthread.cpp
@@ -406,6 +406,10 @@ LLCondition::~LLCondition()
void LLCondition::wait()
{
+ if (!isLocked())
+ { //mAPRMutexp MUST be locked before calling apr_thread_cond_wait
+ apr_thread_mutex_lock(mAPRMutexp);
+ }
apr_thread_cond_wait(mAPRCondp, mAPRMutexp);
}
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp
index f85cfa902f..55a1d3ef41 100644
--- a/indra/llui/lltextbase.cpp
+++ b/indra/llui/lltextbase.cpp
@@ -2912,11 +2912,18 @@ bool LLImageTextSegment::getDimensions(S32 first_char, S32 num_chars, S32& width
S32 LLImageTextSegment::getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars) const
{
LLUIImagePtr image = mStyle->getImage();
+
+ if (image.isNull())
+ {
+ return 1;
+ }
+
S32 image_width = image->getWidth();
if(line_offset == 0 || num_pixels>image_width + IMAGE_HPAD)
{
return 1;
}
+
return 0;
}
@@ -2926,18 +2933,21 @@ F32 LLImageTextSegment::draw(S32 start, S32 end, S32 selection_start, S32 select
{
LLColor4 color = LLColor4::white % mEditor.getDrawContext().mAlpha;
LLUIImagePtr image = mStyle->getImage();
- S32 style_image_height = image->getHeight();
- S32 style_image_width = image->getWidth();
- // Text is drawn from the top of the draw_rect downward
-
- S32 text_center = draw_rect.mTop - (draw_rect.getHeight() / 2);
- // Align image to center of draw rect
- S32 image_bottom = text_center - (style_image_height / 2);
- image->draw(draw_rect.mLeft, image_bottom,
- style_image_width, style_image_height, color);
-
- const S32 IMAGE_HPAD = 3;
- return draw_rect.mLeft + style_image_width + IMAGE_HPAD;
+ if (image.notNull())
+ {
+ S32 style_image_height = image->getHeight();
+ S32 style_image_width = image->getWidth();
+ // Text is drawn from the top of the draw_rect downward
+
+ S32 text_center = draw_rect.mTop - (draw_rect.getHeight() / 2);
+ // Align image to center of draw rect
+ S32 image_bottom = text_center - (style_image_height / 2);
+ image->draw(draw_rect.mLeft, image_bottom,
+ style_image_width, style_image_height, color);
+
+ const S32 IMAGE_HPAD = 3;
+ return draw_rect.mLeft + style_image_width + IMAGE_HPAD;
+ }
}
return 0.0;
}
diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp
index 1885b48812..f00a8565f7 100644
--- a/indra/newview/llmeshrepository.cpp
+++ b/indra/newview/llmeshrepository.cpp
@@ -59,6 +59,9 @@
#include "material_codes.h"
#include "pipeline.h"
+#ifndef LL_WINDOWS
+#include "netdb.h"
+#endif
#include <queue>
@@ -103,16 +106,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 +594,8 @@ void LLMeshRepoThread::run()
mPhysicsShapeRequests = incomplete;
}
-
+ mCurlRequest->process();
}
-
- mCurlRequest->process();
}
res = LLConvexDecomposition::quitThread();
@@ -646,7 +667,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 +1405,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 +2007,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 +2296,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 +3005,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 +3014,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,
diff --git a/install.xml b/install.xml
index f6aa114d1a..f789c08107 100644
--- a/install.xml
+++ b/install.xml
@@ -266,9 +266,9 @@
<key>darwin</key>
<map>
<key>md5sum</key>
- <string>2e1002b3d3d42dbeedb5634521498ebe</string>
+ <string>c7433c41ab99b9915aa8d4e1d4304048</string>
<key>url</key>
- <uri>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/colladadom-2.1-darwin-20101105.tar.bz2</uri>
+ <uri>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/colladadom-2.1-darwin-20101115.tar.bz2</uri>
</map>
<key>linux</key>
<map>