Unbroke HTTP get for some corner cases, thanks to Thickbrick again.
This commit is contained in:
@@ -17,7 +17,7 @@ cmake_minimum_required(VERSION 2.6.2 FATAL_ERROR)
|
|||||||
# can be removed when we use full paths for all libraries.
|
# can be removed when we use full paths for all libraries.
|
||||||
cmake_policy(SET CMP0003 OLD)
|
cmake_policy(SET CMP0003 OLD)
|
||||||
|
|
||||||
set(ROOT_PROJECT_NAME "SecondLife" CACHE STRING
|
set(ROOT_PROJECT_NAME "Singularity" CACHE STRING
|
||||||
"The root project/makefile/solution name. Defaults to SecondLife.")
|
"The root project/makefile/solution name. Defaults to SecondLife.")
|
||||||
project(${ROOT_PROJECT_NAME})
|
project(${ROOT_PROJECT_NAME})
|
||||||
|
|
||||||
|
|||||||
@@ -1427,31 +1427,61 @@ S32 LLTextureFetchWorker::callbackHttpGet(const LLChannelDescriptors& channels,
|
|||||||
{
|
{
|
||||||
// get length of stream:
|
// get length of stream:
|
||||||
data_size = buffer->countAfter(channels.in(), NULL);
|
data_size = buffer->countAfter(channels.in(), NULL);
|
||||||
|
|
||||||
LL_DEBUGS("Texture") << "HTTP RECEIVED: " << mID.asString() << " Bytes: " << data_size << LL_ENDL;
|
LL_DEBUGS("Texture") << "HTTP RECEIVED: " << mID.asString() << " Bytes: " << data_size << LL_ENDL;
|
||||||
if (data_size > 0)
|
if (data_size > 0)
|
||||||
{
|
{
|
||||||
// *TODO: set the formatted image data here directly to avoid the copy
|
bool clean_data = false;
|
||||||
mBuffer = new U8[data_size];
|
bool done = false;
|
||||||
buffer->readAfter(channels.in(), NULL, mBuffer, data_size);
|
if (!partial)
|
||||||
if (data_size < mRequestedSize && mRequestedDiscard == 0)
|
|
||||||
{
|
{
|
||||||
mHaveAllData = TRUE;
|
// we got the whole image in one go
|
||||||
|
done = true;
|
||||||
|
clean_data = true;
|
||||||
|
}
|
||||||
|
else if (data_size < mRequestedSize)
|
||||||
|
{
|
||||||
|
// we have the whole image
|
||||||
|
done = true;
|
||||||
|
}
|
||||||
|
else if (data_size == mRequestedSize)
|
||||||
|
{
|
||||||
|
if (mRequestedDiscard <= 0)
|
||||||
|
{
|
||||||
|
done = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// this is the normal case where we get the data we requested,
|
||||||
|
// but still need to request more data.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (data_size > mRequestedSize)
|
else if (data_size > mRequestedSize)
|
||||||
{
|
{
|
||||||
LL_DEBUGS("Texture") << "Extra data received: got " << data_size << " bytes (requested: " << mRequestedSize << " ) for texture: " << mID.asString() << LL_ENDL;
|
// *TODO: This shouldn't be happening any more
|
||||||
data_size = mRequestedSize;
|
llwarns << "data_size = " << data_size << " > requested: " << mRequestedSize << llendl;
|
||||||
|
done = true;
|
||||||
|
clean_data = true;
|
||||||
|
llassert_always(mDecodeHandle == 0);
|
||||||
}
|
}
|
||||||
mBufferSize += data_size;
|
|
||||||
}
|
if (clean_data)
|
||||||
else
|
{
|
||||||
{
|
resetFormattedData(); // discard any previous data we had
|
||||||
// We requested data but received none (and no error),
|
llassert(mBufferSize == 0);
|
||||||
// so presumably we have all of it
|
}
|
||||||
|
if (done)
|
||||||
|
{
|
||||||
mHaveAllData = TRUE;
|
mHaveAllData = TRUE;
|
||||||
|
mRequestedDiscard = 0;
|
||||||
}
|
}
|
||||||
mRequestedSize = data_size;
|
|
||||||
|
// *TODO: set the formatted image data here directly to avoid the copy
|
||||||
|
mBuffer = new U8[data_size];
|
||||||
|
buffer->readAfter(channels.in(), NULL, mBuffer, data_size);
|
||||||
|
mBufferSize += data_size;
|
||||||
|
mRequestedSize = data_size;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user