From e4f2887983dc6f473c6657b8b653437557c638fa Mon Sep 17 00:00:00 2001
From: James Cook <james@lindenlab.com>
Date: Mon, 26 Apr 2010 14:19:58 -0700
Subject: Don't save dummy records (from 503 errors) to disk cache

---
 indra/llcommon/llavatarname.cpp       | 1 +
 indra/llcommon/llavatarname.h         | 5 +++++
 indra/llmessage/llavatarnamecache.cpp | 8 ++++++--
 3 files changed, 12 insertions(+), 2 deletions(-)

(limited to 'indra')

diff --git a/indra/llcommon/llavatarname.cpp b/indra/llcommon/llavatarname.cpp
index c35b8380b8..4272e096ed 100644
--- a/indra/llcommon/llavatarname.cpp
+++ b/indra/llcommon/llavatarname.cpp
@@ -49,6 +49,7 @@ LLAvatarName::LLAvatarName()
 :	mSLID(),
 	mDisplayName(),
 	mIsDisplayNameDefault(false),
+	mIsDummy(false),
 	mExpires(F64_MAX),
 	mBadge()
 { }
diff --git a/indra/llcommon/llavatarname.h b/indra/llcommon/llavatarname.h
index b30dca6e6e..3e26887d7a 100644
--- a/indra/llcommon/llavatarname.h
+++ b/indra/llcommon/llavatarname.h
@@ -61,6 +61,11 @@ public:
 	// a legacy first and last name, like "James Linden (james.linden)"
 	bool mIsDisplayNameDefault;
 
+	// Under error conditions, we may insert "dummy" records with
+	// names like "???" into caches as placeholders.  These can be
+	// shown in UI, but are not serialized.
+	bool mIsDummy;
+
 	// Names can change, so need to keep track of when name was
 	// last checked.
 	// Unix time-from-epoch seconds for efficiency
diff --git a/indra/llmessage/llavatarnamecache.cpp b/indra/llmessage/llavatarnamecache.cpp
index eabd311bb0..5acecd1dcb 100644
--- a/indra/llmessage/llavatarnamecache.cpp
+++ b/indra/llmessage/llavatarnamecache.cpp
@@ -184,6 +184,7 @@ public:
 		av_name.mSLID = DUMMY_NAME;
 		av_name.mDisplayName = DUMMY_NAME;
 		av_name.mIsDisplayNameDefault = false;
+		av_name.mIsDummy = true;
 		av_name.mExpires = retry_timestamp;
 
 		// Add dummy records for all agent IDs in this request
@@ -358,8 +359,11 @@ void LLAvatarNameCache::exportFile(std::ostream& ostr)
 	{
 		const LLUUID& agent_id = it->first;
 		const LLAvatarName& av_name = it->second;
-		// key must be a string
-		agents[agent_id.asString()] = av_name.asLLSD();
+		if (!av_name.mIsDummy)
+		{
+			// key must be a string
+			agents[agent_id.asString()] = av_name.asLLSD();
+		}
 	}
 	LLSD data;
 	data["agents"] = agents;
-- 
cgit v1.2.3