HTTP GET fix, bisected from Techwolf's patches. Thanks :)

This commit is contained in:
Siana Gearz
2010-11-10 13:56:54 +01:00
parent 17a0d13b0c
commit 29584c7a28

View File

@@ -861,7 +861,7 @@ bool LLTextureFetchWorker::doWork(S32 param)
(mFetcher->getTextureBandwidth() > max_bandwidth)) (mFetcher->getTextureBandwidth() > max_bandwidth))
{ {
// Make normal priority and return (i.e. wait until there is room in the queue) // Make normal priority and return (i.e. wait until there is room in the queue)
setPriority(LLWorkerThread::PRIORITY_NORMAL | mWorkPriority); // setPriority(LLWorkerThread::PRIORITY_NORMAL | mWorkPriority);
return false; return false;
} }
@@ -870,6 +870,10 @@ bool LLTextureFetchWorker::doWork(S32 param)
{ {
cur_size = mFormattedImage->getDataSize(); // amount of data we already have cur_size = mFormattedImage->getDataSize(); // amount of data we already have
} }
resetFormattedData(); // discard any previous data we had
cur_size = 0 ;
mRequestedSize = mDesiredSize; mRequestedSize = mDesiredSize;
mRequestedDiscard = mDesiredDiscard; mRequestedDiscard = mDesiredDiscard;
mRequestedSize -= cur_size; mRequestedSize -= cur_size;
@@ -1152,8 +1156,8 @@ bool LLTextureFetchWorker::doWork(S32 param)
if(mDecodedDiscard<=0) if(mDecodedDiscard<=0)
{ {
return true; return true;
} }
else else
{ {
return false; return false;
@@ -1331,22 +1335,16 @@ void LLTextureFetchWorker::callbackHttpGet(const LLChannelDescriptors& channels,
if (data_size > 0) if (data_size > 0)
{ {
// *TODO: set the formatted image data here directly to avoid the copy // *TODO: set the formatted image data here directly to avoid the copy
llassert_always(mBuffer == NULL);
mBuffer = new U8[data_size]; mBuffer = new U8[data_size];
buffer->readAfter(channels.in(), NULL, mBuffer, data_size); buffer->readAfter(channels.in(), NULL, mBuffer, data_size);
mBufferSize += data_size; mBufferSize += data_size;
if (data_size < mRequestedSize || last_block == true) if (data_size < mRequestedSize &&
(mRequestedDiscard == 0 || last_block == true) )
{ {
mHaveAllData = TRUE; mHaveAllData = TRUE;
} }
else if (data_size > mRequestedSize) llassert_always(data_size <= mRequestedSize);
{
// *TODO: This shouldn't be happening any more
llwarns << "data_size = " << data_size << " > requested: " << mRequestedSize << llendl;
mHaveAllData = TRUE;
llassert_always(mDecodeHandle == 0);
mFormattedImage = NULL; // discard any previous data we had
mBufferSize = data_size;
}
} }
else else
{ {