Convert SendKillObject to take a list of uint rather than sending one

packet per prim. More to come as we change to make use of this.
This commit is contained in:
Melanie
2011-11-06 20:38:07 +00:00
parent fa992a020c
commit c7dd7b13a2
10 changed files with 52 additions and 51 deletions

View File

@@ -1531,38 +1531,49 @@ namespace OpenSim.Region.ClientStack.LindenUDP
OutPacket(pc, ThrottleOutPacketType.Unknown);
}
public void SendKillObject(ulong regionHandle, uint localID)
public void SendKillObject(ulong regionHandle, List<uint> localIDs)
{
// m_log.DebugFormat("[CLIENT]: Sending KillObjectPacket to {0} for {1} in {2}", Name, localID, regionHandle);
KillObjectPacket kill = (KillObjectPacket)PacketPool.Instance.GetPacket(PacketType.KillObject);
// TODO: don't create new blocks if recycling an old packet
kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1];
kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock();
kill.ObjectData[0].ID = localID;
kill.ObjectData = new KillObjectPacket.ObjectDataBlock[localIDs.Count];
for (int i = 0 ; i < localIDs.Count ; i++ )
{
kill.ObjectData[i] = new KillObjectPacket.ObjectDataBlock();
kill.ObjectData[i].ID = localIDs[i];
}
kill.Header.Reliable = true;
kill.Header.Zerocoded = true;
if (m_scene.GetScenePresence(localID) == null)
lock (m_killRecord)
{
// We must lock for both manipulating the kill record and sending the packet, in order to avoid a race
// condition where a kill can be processed before an out-of-date update for the same object.
lock (m_killRecord)
if (localIDs.Count == 1)
{
m_killRecord.Add(localID);
// The throttle queue used here must match that being used for updates. Otherwise, there is a
// chance that a kill packet put on a separate queue will be sent to the client before an existing
// update packet on another queue. Receiving updates after kills results in unowned and undeletable
// scene objects in a viewer until that viewer is relogged in.
OutPacket(kill, ThrottleOutPacketType.Task);
if (m_scene.GetScenePresence(localIDs[0]) != null)
{
OutPacket(kill, ThrottleOutPacketType.State);
return;
}
m_killRecord.Add(localIDs[0]);
}
else
{
lock (m_entityUpdates.SyncRoot)
{
foreach (uint localID in localIDs)
m_killRecord.Add(localID);
}
}
}
else
{
// OutPacket(kill, ThrottleOutPacketType.State);
OutPacket(kill, ThrottleOutPacketType.Task);
}
// The throttle queue used here must match that being used for
// updates. Otherwise, there is a chance that a kill packet put
// on a separate queue will be sent to the client before an
// existing update packet on another queue. Receiving updates
// after kills results in unowned and undeletable
// scene objects in a viewer until that viewer is relogged in.
OutPacket(kill, ThrottleOutPacketType.Task);
}
/// <summary>
@@ -11265,7 +11276,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
// It's a ghost! tell the client to delete it from view.
simClient.SendKillObject(Scene.RegionInfo.RegionHandle,
localId);
new List<uint> { localId });
}
else
{