From 66bc5107863e8226e91818cd9d3c075d0514dbe5 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Thu, 2 Apr 2015 21:43:34 -0400 Subject: detect xml errors in parsing xml files and remove those files --- indra/llmessage/llavatarnamecache.cpp | 39 ++++++++++++++++++----------------- indra/llmessage/llavatarnamecache.h | 2 +- 2 files changed, 21 insertions(+), 20 deletions(-) (limited to 'indra/llmessage') 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. -- cgit v1.2.3 From 3a57b18896eacb6fea6680d0eccaaeddb0b700b0 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Tue, 7 Apr 2015 17:28:05 -0400 Subject: convert llifstream and llofstream to std::ifstream and std::ofstream respectively --- indra/llmessage/llhttpclient.cpp | 2 +- indra/llmessage/llmessageconfig.cpp | 2 +- indra/llmessage/llservicebuilder.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/llmessage') diff --git a/indra/llmessage/llhttpclient.cpp b/indra/llmessage/llhttpclient.cpp index 200116337d..f8db3dded2 100755 --- a/indra/llmessage/llhttpclient.cpp +++ b/indra/llmessage/llhttpclient.cpp @@ -157,7 +157,7 @@ namespace { LLBufferStream ostream(channels, buffer.get()); - llifstream fstream(mFilename, std::iostream::binary | std::iostream::out); + llifstream fstream(mFilename.c_str(), std::iostream::binary | std::iostream::out); if(fstream.is_open()) { fstream.seekg(0, std::ios::end); diff --git a/indra/llmessage/llmessageconfig.cpp b/indra/llmessage/llmessageconfig.cpp index f8b2c8f5a6..64e79d6767 100755 --- a/indra/llmessage/llmessageconfig.cpp +++ b/indra/llmessage/llmessageconfig.cpp @@ -96,7 +96,7 @@ bool LLMessageConfigFile::loadFile() { LLSD data; { - llifstream file(filename()); + llifstream file(filename().c_str()); if (file.is_open()) { diff --git a/indra/llmessage/llservicebuilder.cpp b/indra/llmessage/llservicebuilder.cpp index 392e7f1091..cf2e42f95c 100755 --- a/indra/llmessage/llservicebuilder.cpp +++ b/indra/llmessage/llservicebuilder.cpp @@ -34,7 +34,7 @@ void LLServiceBuilder::loadServiceDefinitionsFromFile( const std::string& service_filename) { - llifstream service_file(service_filename, std::ios::binary); + llifstream service_file(service_filename.c_str(), std::ios::binary); if(service_file.is_open()) { LLSD service_data; -- cgit v1.2.3 From 8b42c7898ef756a4a81daa08b2a5acce2894f4b8 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Tue, 7 Apr 2015 17:59:28 -0400 Subject: replace llifstream and llofstream with std::ifstream and std::ofstream respectively --- indra/llmessage/llhttpclient.cpp | 2 +- indra/llmessage/llmessageconfig.cpp | 2 +- indra/llmessage/llservicebuilder.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/llmessage') diff --git a/indra/llmessage/llhttpclient.cpp b/indra/llmessage/llhttpclient.cpp index f8db3dded2..a36b3ff3c8 100755 --- a/indra/llmessage/llhttpclient.cpp +++ b/indra/llmessage/llhttpclient.cpp @@ -157,7 +157,7 @@ namespace { LLBufferStream ostream(channels, buffer.get()); - llifstream fstream(mFilename.c_str(), std::iostream::binary | std::iostream::out); + std::ifstream fstream(mFilename.c_str(), std::iostream::binary | std::iostream::out); if(fstream.is_open()) { fstream.seekg(0, std::ios::end); diff --git a/indra/llmessage/llmessageconfig.cpp b/indra/llmessage/llmessageconfig.cpp index 64e79d6767..e91051b73e 100755 --- a/indra/llmessage/llmessageconfig.cpp +++ b/indra/llmessage/llmessageconfig.cpp @@ -96,7 +96,7 @@ bool LLMessageConfigFile::loadFile() { LLSD data; { - llifstream file(filename().c_str()); + std::ifstream file(filename().c_str()); if (file.is_open()) { diff --git a/indra/llmessage/llservicebuilder.cpp b/indra/llmessage/llservicebuilder.cpp index cf2e42f95c..34ab891830 100755 --- a/indra/llmessage/llservicebuilder.cpp +++ b/indra/llmessage/llservicebuilder.cpp @@ -34,7 +34,7 @@ void LLServiceBuilder::loadServiceDefinitionsFromFile( const std::string& service_filename) { - llifstream service_file(service_filename.c_str(), std::ios::binary); + std::ifstream service_file(service_filename.c_str(), std::ios::binary); if(service_file.is_open()) { LLSD service_data; -- cgit v1.2.3 From 5c6cf3e7fb9f592e3a293921175b64b515bac23f Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Fri, 10 Apr 2015 11:02:37 -0400 Subject: restore the ll[io]fstream because we need them as wrappers on Windows for wide char paths; on other platforms they are now just typedefs to the std classes --- indra/llmessage/llhttpclient.cpp | 2 +- indra/llmessage/llmessageconfig.cpp | 2 +- indra/llmessage/llservicebuilder.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/llmessage') diff --git a/indra/llmessage/llhttpclient.cpp b/indra/llmessage/llhttpclient.cpp index a36b3ff3c8..f8db3dded2 100755 --- a/indra/llmessage/llhttpclient.cpp +++ b/indra/llmessage/llhttpclient.cpp @@ -157,7 +157,7 @@ namespace { LLBufferStream ostream(channels, buffer.get()); - std::ifstream fstream(mFilename.c_str(), std::iostream::binary | std::iostream::out); + llifstream fstream(mFilename.c_str(), std::iostream::binary | std::iostream::out); if(fstream.is_open()) { fstream.seekg(0, std::ios::end); diff --git a/indra/llmessage/llmessageconfig.cpp b/indra/llmessage/llmessageconfig.cpp index e91051b73e..64e79d6767 100755 --- a/indra/llmessage/llmessageconfig.cpp +++ b/indra/llmessage/llmessageconfig.cpp @@ -96,7 +96,7 @@ bool LLMessageConfigFile::loadFile() { LLSD data; { - std::ifstream file(filename().c_str()); + llifstream file(filename().c_str()); if (file.is_open()) { diff --git a/indra/llmessage/llservicebuilder.cpp b/indra/llmessage/llservicebuilder.cpp index 34ab891830..cf2e42f95c 100755 --- a/indra/llmessage/llservicebuilder.cpp +++ b/indra/llmessage/llservicebuilder.cpp @@ -34,7 +34,7 @@ void LLServiceBuilder::loadServiceDefinitionsFromFile( const std::string& service_filename) { - std::ifstream service_file(service_filename.c_str(), std::ios::binary); + llifstream service_file(service_filename.c_str(), std::ios::binary); if(service_file.is_open()) { LLSD service_data; -- cgit v1.2.3