From d99c60164dca32fb3b21d343e9066cae45a852d2 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 26 Aug 2010 16:06:34 +0100
Subject: Reinstate kill record check that prevents an entity update being sent
 to a client after it has been told that the entity has been deleted.

On Linden Lab clients and some derivatives, receiving an entity update after an entity deletion notice results in an undeleteable prim that disappears upon client relog.
This check was dropped in 0.7 for unknown reasons but renewed testing demonstrates that queued updates can still be present after a scene object has been deleted.
---
 OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 320a2fa..677bd14 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -327,7 +327,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
         /// thread servicing the m_primFullUpdates queue after a kill.  If this happens the object persists as an
         /// ownerless phantom.
         ///
-        /// All manipulation of this set has to occur under a m_primFullUpdate.SyncRoot lock
+        /// All manipulation of this set has to occur under an m_entityUpdates.SyncRoot lock
         ///       
         /// </value>
         protected HashSet<uint> m_killRecord;
@@ -382,18 +382,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP
         public string ActiveGroupName { get { return m_activeGroupName; } }
         public ulong ActiveGroupPowers { get { return m_activeGroupPowers; } }
         public bool IsGroupMember(UUID groupID) { return m_groupPowers.ContainsKey(groupID); }
+        
         /// <summary>
         /// First name of the agent/avatar represented by the client
         /// </summary>
         public string FirstName { get { return m_firstName; } }
+        
         /// <summary>
         /// Last name of the agent/avatar represented by the client
         /// </summary>
         public string LastName { get { return m_lastName; } }
+        
         /// <summary>
         /// Full name of the client (first name and last name)
         /// </summary>
         public string Name { get { return FirstName + " " + LastName; } }
+        
         public uint CircuitCode { get { return m_circuitCode; } }
         public int MoneyBalance { get { return m_moneyBalance; } }
         public int NextAnimationSequenceNumber { get { return m_animationSequenceNumber++; } }
@@ -3528,6 +3532,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP
                 EntityUpdate update;
                 while (updatesThisCall < maxUpdates && m_entityUpdates.TryDequeue(out update))
                 {
+                    // Please do not remove this unless you can demonstrate on the OpenSim mailing list that a client 
+                    // will never receive an update after a prim kill.  Even then, keeping the kill record may be a good
+                    // safety measure.
+                    //
+                    // Receiving updates after kills results in undeleteable prims that persist until relog and 
+                    // currently occurs because prims can be deleted before all queued updates are sent.
+                    if (m_killRecord.Contains(update.Entity.LocalId))
+                    {
+//                        m_log.WarnFormat(
+//                            "[CLIENT]: Preventing full update for prim with local id {0} after client for user {1} told it was deleted", 
+//                            update.Entity.LocalId, Name);                        
+                        continue;
+                    }
+                    
                     if (update.Entity is SceneObjectPart)
                     {
                         SceneObjectPart part = (SceneObjectPart)update.Entity;
-- 
cgit v1.1