MAINT-5506: Fix ugly timing bug in llurlentry static initialization.

The problem was that class-static LLUrlEntryParcel::sRegionHost was being
initialized by copying class-static LLHost::invalid. Naturally, these two
statics are initialized in different source files. Since C++ makes no promises
about the relative order in which objects in different object files are
initialized, it seems we hit a case in which we were trying to initialize
sRegionHost by copying a completely uninitialized LLHost::invalid.
In general we might attempt to address such cross-translation-unit issues by
introducing an LLSingleton. But in this particular case, the punch line is
that LLHost::invalid is explicitly constructed identically to a
default-constructed LLHost! In other words, LLHost::invalid provides nothing
we couldn't get from LLHost(). All it gives us is an opportunity for glitches
such as the above.
Remove LLHost::invalid and all references, replacing with LLHost().
master
Nat Goodspeed 2015-08-18 17:05:29 -04:00
parent 02b7e7ce07
commit 62527e6f18
16 changed files with 23 additions and 29 deletions

View File

@ -290,7 +290,7 @@ LLAssetStorage::LLAssetStorage(LLMessageSystem *msg, LLXferManager *xfer, LLVFS
LLAssetStorage::LLAssetStorage(LLMessageSystem *msg, LLXferManager *xfer,
LLVFS *vfs, LLVFS *static_vfs)
{
_init(msg, xfer, vfs, static_vfs, LLHost::invalid);
_init(msg, xfer, vfs, static_vfs, LLHost());
}

View File

@ -259,7 +259,7 @@ LLCacheName::~LLCacheName()
}
LLCacheName::Impl::Impl(LLMessageSystem* msg)
: mMsg(msg), mUpstreamHost(LLHost::invalid)
: mMsg(msg), mUpstreamHost(LLHost())
{
mMsg->setHandlerFuncFast(
_PREHASH_UUIDNameRequest, handleUUIDNameRequest, (void**)this);

View File

@ -41,8 +41,6 @@
#include <arpa/inet.h>
#endif
LLHost LLHost::invalid(INVALID_PORT,INVALID_HOST_IP_ADDRESS);
LLHost::LLHost(const std::string& ip_and_port)
{
std::string::size_type colon_index = ip_and_port.find(":");

View File

@ -42,8 +42,6 @@ protected:
U32 mIP;
std::string mUntrustedSimCap;
public:
static LLHost invalid;
// CREATORS
LLHost()

View File

@ -1675,7 +1675,7 @@ LLHost LLMessageSystem::findHost(const U32 circuit_code)
}
else
{
return LLHost::invalid;
return LLHost();
}
}

View File

@ -957,7 +957,7 @@ std::string LLUrlEntryObjectIM::getLocation(const std::string &url) const
// LLUrlEntryParcel statics.
LLUUID LLUrlEntryParcel::sAgentID(LLUUID::null);
LLUUID LLUrlEntryParcel::sSessionID(LLUUID::null);
LLHost LLUrlEntryParcel::sRegionHost(LLHost::invalid);
LLHost LLUrlEntryParcel::sRegionHost;
bool LLUrlEntryParcel::sDisconnected(false);
std::set<LLUrlEntryParcel*> LLUrlEntryParcel::sParcelInfoObservers;
@ -1006,7 +1006,7 @@ std::string LLUrlEntryParcel::getLabel(const std::string &url, const LLUrlLabelC
void LLUrlEntryParcel::sendParcelInfoRequest(const LLUUID& parcel_id)
{
if (sRegionHost == LLHost::invalid || sDisconnected) return;
if (sRegionHost == LLHost() || sDisconnected) return;
LLMessageSystem *msg = gMessageSystem;
msg->newMessage("ParcelInfoRequest");

View File

@ -165,8 +165,6 @@ LLFontGL* LLFontGL::getFontDefault()
char const* const _PREHASH_AgentData = (char *)"AgentData";
char const* const _PREHASH_AgentID = (char *)"AgentID";
LLHost LLHost::invalid(INVALID_PORT,INVALID_HOST_IP_ADDRESS);
LLMessageSystem* gMessageSystem = NULL;
//

View File

@ -930,7 +930,7 @@ LLHost LLAgent::getRegionHost() const
}
else
{
return LLHost::invalid;
return LLHost();
}
}

View File

@ -115,7 +115,7 @@ void LLFloaterGodTools::refreshAll()
LLFloaterGodTools::LLFloaterGodTools(const LLSD& key)
: LLFloater(key),
mCurrentHost(LLHost::invalid),
mCurrentHost(LLHost()),
mUpdateTimer()
{
mFactoryMap["grid"] = LLCallbackMap(createPanelGrid, this);
@ -180,7 +180,7 @@ void LLFloaterGodTools::updatePopup(LLCoordGL center, MASK mask)
// virtual
void LLFloaterGodTools::draw()
{
if (mCurrentHost == LLHost::invalid)
if (mCurrentHost == LLHost())
{
if (mUpdateTimer.getElapsedTimeF32() > SECONDS_BETWEEN_UPDATE_REQUESTS)
{
@ -325,7 +325,7 @@ void LLFloaterGodTools::sendRegionInfoRequest()
{
if (mPanelRegionTools) mPanelRegionTools->clearAllWidgets();
if (mPanelObjectTools) mPanelObjectTools->clearAllWidgets();
mCurrentHost = LLHost::invalid;
mCurrentHost = LLHost();
mUpdateTimer.reset();
LLMessageSystem* msg = gMessageSystem;

View File

@ -232,7 +232,7 @@ void LLPreviewNotecard::loadAsset()
}
else
{
LLHost source_sim = LLHost::invalid;
LLHost source_sim = LLHost();
if (mObjectUUID.notNull())
{
LLViewerObject *objectp = gObjectList.findObject(mObjectUUID);

View File

@ -1571,7 +1571,7 @@ void LLPreviewLSL::loadAsset()
if (gAgent.isGodlike() || (is_copyable && (is_modifiable || is_library)))
{
LLUUID* new_uuid = new LLUUID(mItemUUID);
gAssetStorage->getInvItemAsset(LLHost::invalid,
gAssetStorage->getInvItemAsset(LLHost(),
gAgent.getID(),
gAgent.getSessionID(),
item->getPermissions().getOwner(),

View File

@ -1328,11 +1328,11 @@ bool LLTextureFetchWorker::doWork(S32 param)
static LLCachedControl<bool> use_http(gSavedSettings, "ImagePipelineUseHTTP", true);
// if (mHost != LLHost::invalid) get_url = false;
// if (mHost != LLHost()) get_url = false;
if ( use_http && mCanUseHTTP && mUrl.empty())//get http url.
{
LLViewerRegion* region = NULL;
if (mHost == LLHost::invalid)
if (mHost == LLHost())
region = gAgent.getRegion();
else
region = LLWorld::getInstance()->getRegion(mHost);
@ -3224,7 +3224,7 @@ void LLTextureFetch::sendRequestListToSimulators()
{
LLHost host = iter1->first;
// invalid host = use agent host
if (host == LLHost::invalid)
if (host == LLHost())
{
host = gAgent.getRegionHost();
}
@ -3304,7 +3304,7 @@ void LLTextureFetch::sendRequestListToSimulators()
iter1 != mCancelQueue.end(); ++iter1)
{
LLHost host = iter1->first;
if (host == LLHost::invalid)
if (host == LLHost())
{
host = gAgent.getRegionHost();
}

View File

@ -4437,21 +4437,21 @@ S32 LLViewerObject::setTETexture(const U8 te, const LLUUID& uuid)
{
// Invalid host == get from the agent's sim
LLViewerFetchedTexture *image = LLViewerTextureManager::getFetchedTexture(
uuid, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, LLHost::invalid);
uuid, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, LLHost());
return setTETextureCore(te,image);
}
S32 LLViewerObject::setTENormalMap(const U8 te, const LLUUID& uuid)
{
LLViewerFetchedTexture *image = (uuid == LLUUID::null) ? NULL : LLViewerTextureManager::getFetchedTexture(
uuid, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, LLHost::invalid);
uuid, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, LLHost());
return setTENormalMapCore(te, image);
}
S32 LLViewerObject::setTESpecularMap(const U8 te, const LLUUID& uuid)
{
LLViewerFetchedTexture *image = (uuid == LLUUID::null) ? NULL : LLViewerTextureManager::getFetchedTexture(
uuid, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, LLHost::invalid);
uuid, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, LLHost());
return setTESpecularMapCore(te, image);
}

View File

@ -266,7 +266,7 @@ class LLViewerFetchedTexture : public LLViewerTexture
protected:
/*virtual*/ ~LLViewerFetchedTexture();
public:
LLViewerFetchedTexture(const LLUUID& id, FTType f_type, const LLHost& host = LLHost::invalid, BOOL usemipmaps = TRUE);
LLViewerFetchedTexture(const LLUUID& id, FTType f_type, const LLHost& host = LLHost(), BOOL usemipmaps = TRUE);
LLViewerFetchedTexture(const LLImageRaw* raw, FTType f_type, BOOL usemipmaps);
LLViewerFetchedTexture(const std::string& url, FTType f_type, const LLUUID& id, BOOL usemipmaps = TRUE);
@ -498,7 +498,7 @@ protected:
S32 mCachedRawDiscardLevel;
BOOL mCachedRawImageReady; //the rez of the mCachedRawImage reaches the upper limit.
LLHost mTargetHost; // if LLHost::invalid, just request from agent's simulator
LLHost mTargetHost; // if invalid, just request from agent's simulator
// Timers
LLFrameTimer mLastPacketTimer; // Time since last packet.
@ -528,7 +528,7 @@ protected:
/*virtual*/ ~LLViewerLODTexture(){}
public:
LLViewerLODTexture(const LLUUID& id, FTType f_type, const LLHost& host = LLHost::invalid, BOOL usemipmaps = TRUE);
LLViewerLODTexture(const LLUUID& id, FTType f_type, const LLHost& host = LLHost(), BOOL usemipmaps = TRUE);
LLViewerLODTexture(const std::string& url, FTType f_type, const LLUUID& id, BOOL usemipmaps = TRUE);
/*virtual*/ S8 getType() const;

View File

@ -236,7 +236,7 @@ void LLViewerTextureList::shutdown()
if (!image->hasGLTexture() ||
!image->getUseDiscard() ||
image->needsAux() ||
image->getTargetHost() != LLHost::invalid ||
image->getTargetHost() != LLHost() ||
!image->getUrl().empty()
)
{

View File

@ -8095,7 +8095,7 @@ LLHost LLVOAvatar::getObjectHost() const
}
else
{
return LLHost::invalid;
return LLHost();
}
}