aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra
diff options
context:
space:
mode:
authorthickbrick2010-10-14 20:34:04 +0200
committerthickbrick2010-10-14 20:34:04 +0200
commit4d9f3db24601091947611aa20efbb8432e4f2aa7 (patch)
treea9c3799df18c9f9decf611ed882326e62a269979 /linden/indra
parentMore robust handling of http texture responses. (diff)
downloadmeta-impy-4d9f3db24601091947611aa20efbb8432e4f2aa7.zip
meta-impy-4d9f3db24601091947611aa20efbb8432e4f2aa7.tar.gz
meta-impy-4d9f3db24601091947611aa20efbb8432e4f2aa7.tar.bz2
meta-impy-4d9f3db24601091947611aa20efbb8432e4f2aa7.tar.xz
Work around for buggy range responses in OpenSim
Ugly work around for http://opensimulator.org/mantis/view.php?id=5081 by adding 1 to the http request range when on affected versions, and always requesting ranges that start with 0 (viewer2 style).
Diffstat (limited to 'linden/indra')
-rw-r--r--linden/indra/newview/lltexturefetch.cpp53
-rw-r--r--linden/indra/newview/lltexturefetch.h2
2 files changed, 54 insertions, 1 deletions
diff --git a/linden/indra/newview/lltexturefetch.cpp b/linden/indra/newview/lltexturefetch.cpp
index 80e3bfc..bd1812e 100644
--- a/linden/indra/newview/lltexturefetch.cpp
+++ b/linden/indra/newview/lltexturefetch.cpp
@@ -871,6 +871,16 @@ bool LLTextureFetchWorker::doWork(S32 param)
871 return false; 871 return false;
872 } 872 }
873 } 873 }
874
875 // *TODO: remove this hack when not needed anymore
876 S32 buggy_range_fudge = 0;
877 if (LLTextureFetch::hasBuggyHTTPRange())
878 {
879 buggy_range_fudge = 1;
880 resetFormattedData(); // discard any previous data we had
881 cur_size = 0 ;
882 }
883
874 mRequestedSize = mDesiredSize; 884 mRequestedSize = mDesiredSize;
875 mRequestedDiscard = mDesiredDiscard; 885 mRequestedDiscard = mDesiredDiscard;
876 mRequestedSize -= cur_size; 886 mRequestedSize -= cur_size;
@@ -896,7 +906,7 @@ bool LLTextureFetchWorker::doWork(S32 param)
896 // Will call callbackHttpGet when curl request completes 906 // Will call callbackHttpGet when curl request completes
897 std::vector<std::string> headers; 907 std::vector<std::string> headers;
898 headers.push_back("Accept: image/x-j2c"); 908 headers.push_back("Accept: image/x-j2c");
899 res = mFetcher->mCurlGetRequest->getByteRange(mUrl, headers, offset, mRequestedSize, 909 res = mFetcher->mCurlGetRequest->getByteRange(mUrl, headers, offset, mRequestedSize + buggy_range_fudge,
900 new HTTPGetResponder(mFetcher, mID, LLTimer::getTotalTime(), mRequestedSize, offset)); 910 new HTTPGetResponder(mFetcher, mID, LLTimer::getTotalTime(), mRequestedSize, offset));
901 } 911 }
902 if (!res) 912 if (!res)
@@ -2258,3 +2268,44 @@ void LLTextureFetch::dump()
2258 } 2268 }
2259} 2269}
2260 2270
2271// This tries to detect if the sim has this bug:
2272// http://opensimulator.org/mantis/view.php?id=5081
2273//
2274// *TODO: This is a *HACK and may not work if the grid is heterogenous.
2275// Remove it once OpenSim versions in the wild are > 0.7.0.2!
2276#include "hippoGridManager.h"
2277#include <boost/regex.hpp>
2278//static
2279bool LLTextureFetch::hasBuggyHTTPRange()
2280{
2281 static std::string s_version;
2282 static bool buggy = false;
2283 if ((s_version != gLastVersionChannel) && !gLastVersionChannel.empty())
2284 {
2285 s_version = gLastVersionChannel;
2286 buggy = true;
2287 if (gHippoGridManager->getConnectedGrid()->getPlatform() == HippoGridInfo::PLATFORM_OPENSIM)
2288 {
2289 std::string ver_string;
2290 try
2291 {
2292 const boost::regex re(".*OpenSim.*?([0-9.]+).+");
2293 ver_string = regex_replace(s_version, re, "\\1", boost::match_default);
2294 }
2295 catch(std::runtime_error)
2296 {
2297 ver_string = "0.0";
2298 }
2299 LLStringUtil::replaceChar(ver_string, '.', '0');
2300 ver_string = "0." + ver_string;
2301 F64 version = atof(ver_string.c_str());
2302 // we look for "0.6.8" < version < "0.7.0.3"
2303 if ((version > 0.00608) && (version < 0.0070003))
2304 {
2305 buggy = true;
2306 llwarns << "Setting buggy http ranges mode for current sim, because we're on " << s_version << llendl;
2307 }
2308 }
2309 }
2310 return buggy;
2311}
diff --git a/linden/indra/newview/lltexturefetch.h b/linden/indra/newview/lltexturefetch.h
index 5eca0ba..61f76bc 100644
--- a/linden/indra/newview/lltexturefetch.h
+++ b/linden/indra/newview/lltexturefetch.h
@@ -86,6 +86,8 @@ public:
86 86
87 LLTextureInfo* getTextureInfo() { return &mTextureInfo; } 87 LLTextureInfo* getTextureInfo() { return &mTextureInfo; }
88 88
89 static bool hasBuggyHTTPRange(); // *TODO: remove this *HACK once buggy OpenSim versions are gone
90
89protected: 91protected:
90 void addToNetworkQueue(LLTextureFetchWorker* worker); 92 void addToNetworkQueue(LLTextureFetchWorker* worker);
91 void removeFromNetworkQueue(LLTextureFetchWorker* worker, bool cancel); 93 void removeFromNetworkQueue(LLTextureFetchWorker* worker, bool cancel);