From b679975d8fdc22d33d0f62288934be8f0209157e Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 2 May 2012 15:52:40 -0700 Subject: SH-3126 : Use correct unspecified ending byte range for all curl request when fetching files to the end. --- indra/newview/lltexturefetch.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index 6afecd7e13..bcebac712c 100755 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -1215,10 +1215,11 @@ bool LLTextureFetchWorker::doWork(S32 param) // Will call callbackHttpGet when curl request completes std::vector headers; headers.push_back("Accept: image/x-j2c"); - if (mRequestedSize == MAX_IMAGE_DATA_SIZE) + // If we try to fetch the whole file, we set the size to 0 so that we generate the correct curl range request + // Note: it looks a bit hacky but we need to limit this (size==0) to mean "whole file" to HTTP only as it messes up UDP fetching + if ((offset+mRequestedSize) == MAX_IMAGE_DATA_SIZE) { mRequestedSize = 0; - llinfos << "Merov debug : getByteRange, offset = " << offset << ", id = " << mID << llendl; } res = mFetcher->mCurlGetRequest->getByteRange(mUrl, headers, offset, mRequestedSize, new HTTPGetResponder(mFetcher, mID, LLTimer::getTotalTime(), mRequestedSize, offset, true)); @@ -1701,7 +1702,7 @@ S32 LLTextureFetchWorker::callbackHttpGet(const LLChannelDescriptors& channels, mBuffer = (U8*)ALLOCATE_MEM(LLImageBase::getPrivatePool(), data_size); buffer->readAfter(channels.in(), NULL, mBuffer, data_size); mBufferSize += data_size; - if (data_size < mRequestedSize && mRequestedDiscard == 0) + if ((data_size < mRequestedSize) || (mRequestedSize == 0)) { mHaveAllData = TRUE; } @@ -1920,6 +1921,8 @@ bool LLTextureFetch::createRequest(const std::string& url, const LLUUID& id, con } else { + // If the requester knows nothing about the file, we fetch the smallest + // amount of data at the lowest resolution (highest discard level) possible. desired_size = TEXTURE_CACHE_ENTRY_SIZE; desired_discard = MAX_DISCARD_LEVEL; } -- cgit v1.2.3