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.remove-scene-viewer
parent
fa992a020c
commit
c7dd7b13a2
|
@ -1046,7 +1046,7 @@ namespace OpenSim.Framework
|
|||
/// </summary>
|
||||
/// <param name="regionHandle"></param>
|
||||
/// <param name="localID"></param>
|
||||
void SendKillObject(ulong regionHandle, uint localID);
|
||||
void SendKillObject(ulong regionHandle, List<uint> localID);
|
||||
|
||||
void SendAnimations(UUID[] animID, int[] seqs, UUID sourceAgentId, UUID[] objectIDs);
|
||||
void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args);
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -548,7 +548,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
//
|
||||
if (so.IsSelected)
|
||||
{
|
||||
m_scene.SendKillObject(so.RootPart.LocalId);
|
||||
m_scene.SendKillObject(new List<uint> { so.RootPart.LocalId });
|
||||
}
|
||||
|
||||
so.IsSelected = false; // fudge....
|
||||
|
|
|
@ -570,7 +570,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
|
||||
protected void KillEntity(Scene scene, uint localID)
|
||||
{
|
||||
scene.SendKillObject(localID);
|
||||
scene.SendKillObject(new List<uint> { localID });
|
||||
}
|
||||
|
||||
protected virtual GridRegion GetFinalDestination(GridRegion region)
|
||||
|
|
|
@ -3102,7 +3102,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
delegate(IClientAPI client)
|
||||
{
|
||||
//We can safely ignore null reference exceptions. It means the avatar is dead and cleaned up anyway
|
||||
try { client.SendKillObject(avatar.RegionHandle, avatar.LocalId); }
|
||||
try { client.SendKillObject(avatar.RegionHandle, new List<uint> { avatar.LocalId }); }
|
||||
catch (NullReferenceException) { }
|
||||
});
|
||||
|
||||
|
@ -3161,28 +3161,24 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
#region Entities
|
||||
|
||||
public void SendKillObject(uint localID)
|
||||
public void SendKillObject(List<uint> localIDs)
|
||||
{
|
||||
SceneObjectPart part = GetSceneObjectPart(localID);
|
||||
UUID attachedAvatar = UUID.Zero;
|
||||
List<uint> deleteIDs = new List<uint>();
|
||||
|
||||
if (part != null) // It is a prim
|
||||
foreach (uint localID in localIDs)
|
||||
{
|
||||
if (!part.ParentGroup.IsDeleted) // Valid
|
||||
SceneObjectPart part = GetSceneObjectPart(localID);
|
||||
if (part != null) // It is a prim
|
||||
{
|
||||
if (part.ParentGroup.RootPart != part) // Child part
|
||||
return;
|
||||
|
||||
if (part.ParentGroup.IsAttachment && part.ParentGroup.AttachmentPoint >= 31 && part.ParentGroup.AttachmentPoint <= 38)
|
||||
attachedAvatar = part.ParentGroup.AttachedAvatar;
|
||||
if (part.ParentGroup != null && !part.ParentGroup.IsDeleted) // Valid
|
||||
{
|
||||
if (part.ParentGroup.RootPart != part) // Child part
|
||||
continue;
|
||||
}
|
||||
}
|
||||
deleteIDs.Add(localID);
|
||||
}
|
||||
|
||||
ForEachClient(delegate(IClientAPI client)
|
||||
{
|
||||
if (attachedAvatar == UUID.Zero || attachedAvatar == client.AgentId)
|
||||
client.SendKillObject(m_regionHandle, localID);
|
||||
});
|
||||
ForEachClient(delegate(IClientAPI client) { client.SendKillObject(m_regionHandle, deleteIDs); });
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -3200,7 +3196,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
//m_sceneGridService.OnChildAgentUpdate += IncomingChildAgentDataUpdate;
|
||||
//m_sceneGridService.OnRemoveKnownRegionFromAvatar += HandleRemoveKnownRegionsFromAvatar;
|
||||
m_sceneGridService.OnLogOffUser += HandleLogOffUserFromGrid;
|
||||
m_sceneGridService.KiPrimitive += SendKillObject;
|
||||
m_sceneGridService.OnGetLandData += GetLandData;
|
||||
}
|
||||
|
||||
|
@ -3209,7 +3204,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// </summary>
|
||||
public void UnRegisterRegionWithComms()
|
||||
{
|
||||
m_sceneGridService.KiPrimitive -= SendKillObject;
|
||||
m_sceneGridService.OnLogOffUser -= HandleLogOffUserFromGrid;
|
||||
//m_sceneGridService.OnRemoveKnownRegionFromAvatar -= HandleRemoveKnownRegionsFromAvatar;
|
||||
//m_sceneGridService.OnChildAgentUpdate -= IncomingChildAgentDataUpdate;
|
||||
|
|
|
@ -44,8 +44,6 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
|||
|
||||
namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
public delegate void KiPrimitiveDelegate(uint localID);
|
||||
|
||||
public delegate void RemoveKnownRegionsFromAvatarList(UUID avatarID, List<ulong> regionlst);
|
||||
|
||||
/// <summary>
|
||||
|
@ -113,8 +111,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// private LogOffUser handlerLogOffUser = null;
|
||||
// private GetLandData handlerGetLandData = null; // OnGetLandData
|
||||
|
||||
public KiPrimitiveDelegate KiPrimitive;
|
||||
|
||||
public SceneCommunicationService()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -1162,7 +1162,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
if (!IsAttachment || (AttachedAvatar == avatar.ControllingClient.AgentId) ||
|
||||
(AttachmentPoint < 31) || (AttachmentPoint > 38))
|
||||
avatar.ControllingClient.SendKillObject(m_regionHandle, part.LocalId);
|
||||
avatar.ControllingClient.SendKillObject(m_regionHandle, new List<uint> { part.LocalId });
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -934,7 +934,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
|
|||
|
||||
}
|
||||
|
||||
public void SendKillObject(ulong regionHandle, uint localID)
|
||||
public void SendKillObject(ulong regionHandle, List<uint> localID)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -520,7 +520,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
|||
|
||||
}
|
||||
|
||||
public virtual void SendKillObject(ulong regionHandle, uint localID)
|
||||
public virtual void SendKillObject(ulong regionHandle, List<uint> localID)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -487,7 +487,7 @@ namespace OpenSim.Tests.Common.Mock
|
|||
|
||||
}
|
||||
|
||||
public virtual void SendKillObject(ulong regionHandle, uint localID)
|
||||
public virtual void SendKillObject(ulong regionHandle, List<uint> localID)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue