summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xindra/llmessage/llavatarnamecache.cpp39
-rwxr-xr-xindra/llmessage/llavatarnamecache.h2
-rwxr-xr-xindra/newview/llappviewer.cpp31
-rwxr-xr-xindra/newview/llnotificationstorage.cpp10
-rwxr-xr-xindra/newview/llviewertexturelist.cpp22
-rwxr-xr-xindra/newview/llviewertexturelist.h3
6 files changed, 65 insertions, 42 deletions
diff --git a/indra/llmessage/llavatarnamecache.cpp b/indra/llmessage/llavatarnamecache.cpp
index d02a60b7b2..549708097a 100755
--- a/indra/llmessage/llavatarnamecache.cpp
+++ b/indra/llmessage/llavatarnamecache.cpp
@@ -355,9 +355,7 @@ void LLAvatarNameCache::requestNamesViaCapability()
if (!url.empty())
{
- LL_DEBUGS("AvNameCache") << "LLAvatarNameCache::requestNamesViaCapability requested "
- << ids << " ids"
- << LL_ENDL;
+ LL_INFOS("AvNameCache") << "LLAvatarNameCache::requestNamesViaCapability getting " << ids << " ids" << LL_ENDL;
LLHTTPClient::get(url, new LLAvatarNameResponder(agent_ids));
}
}
@@ -381,8 +379,7 @@ void LLAvatarNameCache::legacyNameFetch(const LLUUID& agent_id,
const std::string& full_name,
bool is_group)
{
- LL_DEBUGS("AvNameCache") << "LLAvatarNameCache::legacyNameFetch "
- << "agent " << agent_id << " "
+ LL_DEBUGS("AvNameCache") << "LLAvatarNameCache agent " << agent_id << " "
<< "full name '" << full_name << "'"
<< ( is_group ? " [group]" : "" )
<< LL_ENDL;
@@ -411,7 +408,7 @@ void LLAvatarNameCache::requestNamesViaLegacy()
// invoked below. This should never happen in practice.
sPendingQueue[agent_id] = now;
- LL_DEBUGS("AvNameCache") << "LLAvatarNameCache::requestNamesViaLegacy agent " << agent_id << LL_ENDL;
+ LL_DEBUGS("AvNameCache") << "agent " << agent_id << LL_ENDL;
gCacheName->get(agent_id, false, // legacy compatibility
boost::bind(&LLAvatarNameCache::legacyNameCallback, _1, _2, _3));
@@ -429,12 +426,13 @@ void LLAvatarNameCache::cleanupClass()
sCache.clear();
}
-void LLAvatarNameCache::importFile(std::istream& istr)
+bool LLAvatarNameCache::importFile(std::istream& istr)
{
LLSD data;
if (LLSDParser::PARSE_FAILURE == LLSDSerialize::fromXMLDocument(data, istr))
{
- return;
+ LL_WARNS("AvNameCache") << "avatar name cache data xml parse failed" << LL_ENDL;
+ return false;
}
// by convention LLSD storage is a map
@@ -450,17 +448,19 @@ void LLAvatarNameCache::importFile(std::istream& istr)
av_name.fromLLSD( it->second );
sCache[agent_id] = av_name;
}
- LL_INFOS("AvNameCache") << "loaded " << sCache.size() << LL_ENDL;
-
+ LL_INFOS("AvNameCache") << "LLAvatarNameCache loaded " << sCache.size() << LL_ENDL;
// Some entries may have expired since the cache was stored,
// but they will be flushed in the first call to eraseUnrefreshed
// from LLAvatarNameResponder::idle
+
+ return true;
}
void LLAvatarNameCache::exportFile(std::ostream& ostr)
{
LLSD agents;
F64 max_unrefreshed = LLFrameTimer::getTotalSeconds() - MAX_UNREFRESHED_TIME;
+ LL_INFOS("AvNameCache") << "LLAvatarNameCache at exit cache has " << sCache.size() << LL_ENDL;
cache_t::const_iterator it = sCache.begin();
for ( ; it != sCache.end(); ++it)
{
@@ -473,6 +473,7 @@ void LLAvatarNameCache::exportFile(std::ostream& ostr)
agents[agent_id.asString()] = av_name.asLLSD();
}
}
+ LL_INFOS("AvNameCache") << "LLAvatarNameCache returning " << agents.size() << LL_ENDL;
LLSD data;
data["agents"] = agents;
LLSDSerialize::toPrettyXML(data, ostr);
@@ -515,6 +516,7 @@ void LLAvatarNameCache::idle()
}
else
{
+ LL_WARNS_ONCE("AvNameCache") << "LLAvatarNameCache still using legacy api" << LL_ENDL;
requestNamesViaLegacy();
}
}
@@ -552,24 +554,26 @@ void LLAvatarNameCache::eraseUnrefreshed()
if (!sLastExpireCheck || sLastExpireCheck < max_unrefreshed)
{
sLastExpireCheck = now;
-
+ S32 expired = 0;
for (cache_t::iterator it = sCache.begin(); it != sCache.end();)
{
const LLAvatarName& av_name = it->second;
if (av_name.mExpires < max_unrefreshed)
{
- LL_DEBUGS("AvNameCache") << it->first
+ LL_DEBUGS("AvNameCacheExpired") << "LLAvatarNameCache " << it->first
<< " user '" << av_name.getAccountName() << "' "
<< "expired " << now - av_name.mExpires << " secs ago"
<< LL_ENDL;
sCache.erase(it++);
+ expired++;
}
else
{
++it;
}
}
- LL_INFOS("AvNameCache") << sCache.size() << " cached avatar names" << LL_ENDL;
+ LL_INFOS("AvNameCache") << "LLAvatarNameCache expired " << expired << " cached avatar names, "
+ << sCache.size() << " remaining" << LL_ENDL;
}
}
@@ -590,8 +594,7 @@ bool LLAvatarNameCache::get(const LLUUID& agent_id, LLAvatarName *av_name)
{
if (!isRequestPending(agent_id))
{
- LL_DEBUGS("AvNameCache") << "LLAvatarNameCache::get "
- << "refresh agent " << agent_id
+ LL_DEBUGS("AvNameCache") << "LLAvatarNameCache refresh agent " << agent_id
<< LL_ENDL;
sAskQueue.insert(agent_id);
}
@@ -603,9 +606,7 @@ bool LLAvatarNameCache::get(const LLUUID& agent_id, LLAvatarName *av_name)
if (!isRequestPending(agent_id))
{
- LL_DEBUGS("AvNameCache") << "LLAvatarNameCache::get "
- << "queue request for agent " << agent_id
- << LL_ENDL;
+ LL_DEBUGS("AvNameCache") << "LLAvatarNameCache queue request for agent " << agent_id << LL_ENDL;
sAskQueue.insert(agent_id);
}
@@ -734,7 +735,7 @@ bool LLAvatarNameCache::expirationFromCacheControl(const LLSD& headers, F64 *exp
fromCacheControl = true;
}
}
- LL_DEBUGS("AvNameCache")
+ LL_DEBUGS("AvNameCache") << "LLAvatarNameCache "
<< ( fromCacheControl ? "expires based on cache control " : "default expiration " )
<< "in " << *expires - now << " seconds"
<< LL_ENDL;
diff --git a/indra/llmessage/llavatarnamecache.h b/indra/llmessage/llavatarnamecache.h
index ea016b3125..5a10053a69 100755
--- a/indra/llmessage/llavatarnamecache.h
+++ b/indra/llmessage/llavatarnamecache.h
@@ -46,7 +46,7 @@ namespace LLAvatarNameCache
void cleanupClass();
// Import/export the name cache to file.
- void importFile(std::istream& istr);
+ bool importFile(std::istream& istr);
void exportFile(std::ostream& ostr);
// On the viewer, usually a simulator capabilitity.
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 4bf719ec31..dd6b2802cd 100755
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -4653,7 +4653,12 @@ void LLAppViewer::loadNameCache()
llifstream name_cache_stream(filename);
if(name_cache_stream.is_open())
{
- LLAvatarNameCache::importFile(name_cache_stream);
+ if ( ! LLAvatarNameCache::importFile(name_cache_stream))
+ {
+ LL_WARNS("AppInit") << "removing invalid '" << filename << "'" << LL_ENDL;
+ name_cache_stream.close();
+ LLFile::remove(filename);
+ }
}
if (!gCacheName) return;
@@ -4668,7 +4673,7 @@ void LLAppViewer::loadNameCache()
}
void LLAppViewer::saveNameCache()
- {
+{
// display names cache
std::string filename =
gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "avatar_name_cache.xml");
@@ -4676,16 +4681,18 @@ void LLAppViewer::saveNameCache()
if(name_cache_stream.is_open())
{
LLAvatarNameCache::exportFile(name_cache_stream);
-}
-
- if (!gCacheName) return;
-
- std::string name_cache;
- name_cache = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "name.cache");
- llofstream cache_file(name_cache);
- if(cache_file.is_open())
- {
- gCacheName->exportFile(cache_file);
+ }
+
+ // real names cache
+ if (gCacheName)
+ {
+ std::string name_cache;
+ name_cache = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "name.cache");
+ llofstream cache_file(name_cache);
+ if(cache_file.is_open())
+ {
+ gCacheName->exportFile(cache_file);
+ }
}
}
diff --git a/indra/newview/llnotificationstorage.cpp b/indra/newview/llnotificationstorage.cpp
index e9970de58c..3418b33d37 100755
--- a/indra/newview/llnotificationstorage.cpp
+++ b/indra/newview/llnotificationstorage.cpp
@@ -123,14 +123,18 @@ bool LLNotificationStorage::readNotifications(LLSD& pNotificationData, bool is_n
{
LLPointer<LLSDParser> parser = new LLSDXMLParser();
didFileRead = (parser->parse(notifyFile, pNotificationData, LLSDSerialize::SIZE_UNLIMITED) >= 0);
+ notifyFile.close();
+
if (!didFileRead)
{
LL_WARNS("LLNotificationStorage") << "Failed to parse open notifications from file '" << mFileName
- << "'" << LL_ENDL;
+ << "'" << LL_ENDL;
+ LLFile::remove(filename);
+ LL_WARNS("LLNotificationStorage") << "Removed invalid open notifications file '" << mFileName
+ << "'" << LL_ENDL;
}
}
-
- LL_INFOS("LLNotificationStorage") << "ending read '" << filename << "'" << LL_ENDL;
+
if (!didFileRead)
{
if(is_new_filename)
diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp
index 8c27ddc63c..0865d90005 100755
--- a/indra/newview/llviewertexturelist.cpp
+++ b/indra/newview/llviewertexturelist.cpp
@@ -165,7 +165,7 @@ void LLViewerTextureList::doPreloadImages()
static std::string get_texture_list_name()
{
- return std::string("texture_list_") + gSavedSettings.getString("LoginLocation") + ".xml";
+ return gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "texture_list_" + gSavedSettings.getString("LoginLocation") + ".xml");
}
void LLViewerTextureList::doPrefetchImages()
@@ -178,13 +178,22 @@ void LLViewerTextureList::doPrefetchImages()
// Pre-fetch textures from last logout
LLSD imagelist;
- std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, get_texture_list_name());
+ std::string filename = get_texture_list_name();
llifstream file;
file.open(filename);
if (file.is_open())
{
- LLSDSerialize::fromXML(imagelist, file);
- }
+ if ( ! LLSDSerialize::fromXML(imagelist, file) )
+ {
+ file.close();
+ LL_WARNS() << "XML parse error reading texture list '" << filename << "'" << LL_ENDL;
+ LL_WARNS() << "Removing invalid texture list '" << filename << "'" << LL_ENDL;
+ LLFile::remove(filename);
+ return;
+ }
+ file.close();
+ }
+ S32 texture_count = 0;
for (LLSD::array_iterator iter = imagelist.beginArray();
iter != imagelist.endArray(); ++iter)
{
@@ -198,10 +207,12 @@ void LLViewerTextureList::doPrefetchImages()
LLViewerFetchedTexture* image = LLViewerTextureManager::getFetchedTexture(uuid, FTT_DEFAULT, MIPMAP_TRUE, LLGLTexture::BOOST_NONE, texture_type);
if (image)
{
+ texture_count += 1;
image->addTextureStats((F32)pixel_area);
}
}
}
+ LL_DEBUGS() << "fetched " << texture_count << " images from " << filename << LL_ENDL;
}
///////////////////////////////////////////////////////////////////////////////
@@ -261,9 +272,10 @@ void LLViewerTextureList::shutdown()
if (count > 0 && !gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "").empty())
{
- std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, get_texture_list_name());
+ std::string filename = get_texture_list_name();
llofstream file;
file.open(filename);
+ LL_DEBUGS() << "saving " << imagelist.size() << " image list entries" << LL_ENDL;
LLSDSerialize::toPrettyXML(imagelist, file);
}
diff --git a/indra/newview/llviewertexturelist.h b/indra/newview/llviewertexturelist.h
index 2f84d0947a..fbbfe9a7d4 100755
--- a/indra/newview/llviewertexturelist.h
+++ b/indra/newview/llviewertexturelist.h
@@ -61,8 +61,6 @@ typedef void (*LLImageCallback)(BOOL success,
class LLViewerTextureList
{
- LOG_CLASS(LLViewerTextureList);
-
friend class LLTextureView;
friend class LLViewerTextureManager;
friend class LLLocalBitmap;
@@ -206,6 +204,7 @@ private:
private:
static S32 sNumImages;
static void (*sUUIDCallback)(void**, const LLUUID &);
+ LOG_CLASS(LLViewerTextureList);
};
class LLUIImageList : public LLImageProviderInterface, public LLSingleton<LLUIImageList>