diff options
author | Melanie | 2011-11-06 20:38:07 +0000 |
---|---|---|
committer | Melanie | 2011-11-06 20:38:07 +0000 |
commit | c7dd7b13a2058fa6855e2e78f1dbb83e9a806f95 (patch) | |
tree | 2208d841ddd01013d590845f306d2719ecf96503 | |
parent | Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim (diff) | |
download | opensim-SC-c7dd7b13a2058fa6855e2e78f1dbb83e9a806f95.zip opensim-SC-c7dd7b13a2058fa6855e2e78f1dbb83e9a806f95.tar.gz opensim-SC-c7dd7b13a2058fa6855e2e78f1dbb83e9a806f95.tar.bz2 opensim-SC-c7dd7b13a2058fa6855e2e78f1dbb83e9a806f95.tar.xz |
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.
Diffstat (limited to '')
10 files changed, 52 insertions, 51 deletions
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 1be92ff..475fc01 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs | |||
@@ -1046,7 +1046,7 @@ namespace OpenSim.Framework | |||
1046 | /// </summary> | 1046 | /// </summary> |
1047 | /// <param name="regionHandle"></param> | 1047 | /// <param name="regionHandle"></param> |
1048 | /// <param name="localID"></param> | 1048 | /// <param name="localID"></param> |
1049 | void SendKillObject(ulong regionHandle, uint localID); | 1049 | void SendKillObject(ulong regionHandle, List<uint> localID); |
1050 | 1050 | ||
1051 | void SendAnimations(UUID[] animID, int[] seqs, UUID sourceAgentId, UUID[] objectIDs); | 1051 | void SendAnimations(UUID[] animID, int[] seqs, UUID sourceAgentId, UUID[] objectIDs); |
1052 | void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args); | 1052 | void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args); |
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index a7f83f9..4a0b0c6 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -1531,38 +1531,49 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1531 | OutPacket(pc, ThrottleOutPacketType.Unknown); | 1531 | OutPacket(pc, ThrottleOutPacketType.Unknown); |
1532 | } | 1532 | } |
1533 | 1533 | ||
1534 | public void SendKillObject(ulong regionHandle, uint localID) | 1534 | public void SendKillObject(ulong regionHandle, List<uint> localIDs) |
1535 | { | 1535 | { |
1536 | // m_log.DebugFormat("[CLIENT]: Sending KillObjectPacket to {0} for {1} in {2}", Name, localID, regionHandle); | 1536 | // m_log.DebugFormat("[CLIENT]: Sending KillObjectPacket to {0} for {1} in {2}", Name, localID, regionHandle); |
1537 | 1537 | ||
1538 | KillObjectPacket kill = (KillObjectPacket)PacketPool.Instance.GetPacket(PacketType.KillObject); | 1538 | KillObjectPacket kill = (KillObjectPacket)PacketPool.Instance.GetPacket(PacketType.KillObject); |
1539 | // TODO: don't create new blocks if recycling an old packet | 1539 | // TODO: don't create new blocks if recycling an old packet |
1540 | kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1]; | 1540 | kill.ObjectData = new KillObjectPacket.ObjectDataBlock[localIDs.Count]; |
1541 | kill.ObjectData[0] = new KillObjectPacket.ObjectDataBlock(); | 1541 | for (int i = 0 ; i < localIDs.Count ; i++ ) |
1542 | kill.ObjectData[0].ID = localID; | 1542 | { |
1543 | kill.ObjectData[i] = new KillObjectPacket.ObjectDataBlock(); | ||
1544 | kill.ObjectData[i].ID = localIDs[i]; | ||
1545 | } | ||
1543 | kill.Header.Reliable = true; | 1546 | kill.Header.Reliable = true; |
1544 | kill.Header.Zerocoded = true; | 1547 | kill.Header.Zerocoded = true; |
1545 | 1548 | ||
1546 | if (m_scene.GetScenePresence(localID) == null) | 1549 | lock (m_killRecord) |
1547 | { | 1550 | { |
1548 | // We must lock for both manipulating the kill record and sending the packet, in order to avoid a race | 1551 | if (localIDs.Count == 1) |
1549 | // condition where a kill can be processed before an out-of-date update for the same object. | ||
1550 | lock (m_killRecord) | ||
1551 | { | 1552 | { |
1552 | m_killRecord.Add(localID); | 1553 | if (m_scene.GetScenePresence(localIDs[0]) != null) |
1553 | 1554 | { | |
1554 | // The throttle queue used here must match that being used for updates. Otherwise, there is a | 1555 | OutPacket(kill, ThrottleOutPacketType.State); |
1555 | // chance that a kill packet put on a separate queue will be sent to the client before an existing | 1556 | return; |
1556 | // update packet on another queue. Receiving updates after kills results in unowned and undeletable | 1557 | } |
1557 | // scene objects in a viewer until that viewer is relogged in. | 1558 | m_killRecord.Add(localIDs[0]); |
1558 | OutPacket(kill, ThrottleOutPacketType.Task); | 1559 | } |
1560 | else | ||
1561 | { | ||
1562 | lock (m_entityUpdates.SyncRoot) | ||
1563 | { | ||
1564 | foreach (uint localID in localIDs) | ||
1565 | m_killRecord.Add(localID); | ||
1566 | } | ||
1559 | } | 1567 | } |
1560 | } | 1568 | } |
1561 | else | 1569 | |
1562 | { | 1570 | // The throttle queue used here must match that being used for |
1563 | // OutPacket(kill, ThrottleOutPacketType.State); | 1571 | // updates. Otherwise, there is a chance that a kill packet put |
1564 | OutPacket(kill, ThrottleOutPacketType.Task); | 1572 | // on a separate queue will be sent to the client before an |
1565 | } | 1573 | // existing update packet on another queue. Receiving updates |
1574 | // after kills results in unowned and undeletable | ||
1575 | // scene objects in a viewer until that viewer is relogged in. | ||
1576 | OutPacket(kill, ThrottleOutPacketType.Task); | ||
1566 | } | 1577 | } |
1567 | 1578 | ||
1568 | /// <summary> | 1579 | /// <summary> |
@@ -11265,7 +11276,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
11265 | { | 11276 | { |
11266 | // It's a ghost! tell the client to delete it from view. | 11277 | // It's a ghost! tell the client to delete it from view. |
11267 | simClient.SendKillObject(Scene.RegionInfo.RegionHandle, | 11278 | simClient.SendKillObject(Scene.RegionInfo.RegionHandle, |
11268 | localId); | 11279 | new List<uint> { localId }); |
11269 | } | 11280 | } |
11270 | else | 11281 | else |
11271 | { | 11282 | { |
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index de99b94..2349e40 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -548,7 +548,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
548 | // | 548 | // |
549 | if (so.IsSelected) | 549 | if (so.IsSelected) |
550 | { | 550 | { |
551 | m_scene.SendKillObject(so.RootPart.LocalId); | 551 | m_scene.SendKillObject(new List<uint> { so.RootPart.LocalId }); |
552 | } | 552 | } |
553 | 553 | ||
554 | so.IsSelected = false; // fudge.... | 554 | so.IsSelected = false; // fudge.... |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 7251bd8..d01f89b 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -570,7 +570,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
570 | 570 | ||
571 | protected void KillEntity(Scene scene, uint localID) | 571 | protected void KillEntity(Scene scene, uint localID) |
572 | { | 572 | { |
573 | scene.SendKillObject(localID); | 573 | scene.SendKillObject(new List<uint> { localID }); |
574 | } | 574 | } |
575 | 575 | ||
576 | protected virtual GridRegion GetFinalDestination(GridRegion region) | 576 | protected virtual GridRegion GetFinalDestination(GridRegion region) |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 5465ca4..3b90c16 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -3102,7 +3102,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3102 | delegate(IClientAPI client) | 3102 | delegate(IClientAPI client) |
3103 | { | 3103 | { |
3104 | //We can safely ignore null reference exceptions. It means the avatar is dead and cleaned up anyway | 3104 | //We can safely ignore null reference exceptions. It means the avatar is dead and cleaned up anyway |
3105 | try { client.SendKillObject(avatar.RegionHandle, avatar.LocalId); } | 3105 | try { client.SendKillObject(avatar.RegionHandle, new List<uint> { avatar.LocalId }); } |
3106 | catch (NullReferenceException) { } | 3106 | catch (NullReferenceException) { } |
3107 | }); | 3107 | }); |
3108 | 3108 | ||
@@ -3161,28 +3161,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
3161 | 3161 | ||
3162 | #region Entities | 3162 | #region Entities |
3163 | 3163 | ||
3164 | public void SendKillObject(uint localID) | 3164 | public void SendKillObject(List<uint> localIDs) |
3165 | { | 3165 | { |
3166 | SceneObjectPart part = GetSceneObjectPart(localID); | 3166 | List<uint> deleteIDs = new List<uint>(); |
3167 | UUID attachedAvatar = UUID.Zero; | ||
3168 | 3167 | ||
3169 | if (part != null) // It is a prim | 3168 | foreach (uint localID in localIDs) |
3170 | { | 3169 | { |
3171 | if (!part.ParentGroup.IsDeleted) // Valid | 3170 | SceneObjectPart part = GetSceneObjectPart(localID); |
3171 | if (part != null) // It is a prim | ||
3172 | { | 3172 | { |
3173 | if (part.ParentGroup.RootPart != part) // Child part | 3173 | if (part.ParentGroup != null && !part.ParentGroup.IsDeleted) // Valid |
3174 | return; | 3174 | { |
3175 | 3175 | if (part.ParentGroup.RootPart != part) // Child part | |
3176 | if (part.ParentGroup.IsAttachment && part.ParentGroup.AttachmentPoint >= 31 && part.ParentGroup.AttachmentPoint <= 38) | 3176 | continue; |
3177 | attachedAvatar = part.ParentGroup.AttachedAvatar; | 3177 | } |
3178 | } | 3178 | } |
3179 | deleteIDs.Add(localID); | ||
3179 | } | 3180 | } |
3180 | 3181 | ForEachClient(delegate(IClientAPI client) { client.SendKillObject(m_regionHandle, deleteIDs); }); | |
3181 | ForEachClient(delegate(IClientAPI client) | ||
3182 | { | ||
3183 | if (attachedAvatar == UUID.Zero || attachedAvatar == client.AgentId) | ||
3184 | client.SendKillObject(m_regionHandle, localID); | ||
3185 | }); | ||
3186 | } | 3182 | } |
3187 | 3183 | ||
3188 | #endregion | 3184 | #endregion |
@@ -3200,7 +3196,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3200 | //m_sceneGridService.OnChildAgentUpdate += IncomingChildAgentDataUpdate; | 3196 | //m_sceneGridService.OnChildAgentUpdate += IncomingChildAgentDataUpdate; |
3201 | //m_sceneGridService.OnRemoveKnownRegionFromAvatar += HandleRemoveKnownRegionsFromAvatar; | 3197 | //m_sceneGridService.OnRemoveKnownRegionFromAvatar += HandleRemoveKnownRegionsFromAvatar; |
3202 | m_sceneGridService.OnLogOffUser += HandleLogOffUserFromGrid; | 3198 | m_sceneGridService.OnLogOffUser += HandleLogOffUserFromGrid; |
3203 | m_sceneGridService.KiPrimitive += SendKillObject; | ||
3204 | m_sceneGridService.OnGetLandData += GetLandData; | 3199 | m_sceneGridService.OnGetLandData += GetLandData; |
3205 | } | 3200 | } |
3206 | 3201 | ||
@@ -3209,7 +3204,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3209 | /// </summary> | 3204 | /// </summary> |
3210 | public void UnRegisterRegionWithComms() | 3205 | public void UnRegisterRegionWithComms() |
3211 | { | 3206 | { |
3212 | m_sceneGridService.KiPrimitive -= SendKillObject; | ||
3213 | m_sceneGridService.OnLogOffUser -= HandleLogOffUserFromGrid; | 3207 | m_sceneGridService.OnLogOffUser -= HandleLogOffUserFromGrid; |
3214 | //m_sceneGridService.OnRemoveKnownRegionFromAvatar -= HandleRemoveKnownRegionsFromAvatar; | 3208 | //m_sceneGridService.OnRemoveKnownRegionFromAvatar -= HandleRemoveKnownRegionsFromAvatar; |
3215 | //m_sceneGridService.OnChildAgentUpdate -= IncomingChildAgentDataUpdate; | 3209 | //m_sceneGridService.OnChildAgentUpdate -= IncomingChildAgentDataUpdate; |
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index 7cffa70..eccce89 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs | |||
@@ -44,8 +44,6 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion; | |||
44 | 44 | ||
45 | namespace OpenSim.Region.Framework.Scenes | 45 | namespace OpenSim.Region.Framework.Scenes |
46 | { | 46 | { |
47 | public delegate void KiPrimitiveDelegate(uint localID); | ||
48 | |||
49 | public delegate void RemoveKnownRegionsFromAvatarList(UUID avatarID, List<ulong> regionlst); | 47 | public delegate void RemoveKnownRegionsFromAvatarList(UUID avatarID, List<ulong> regionlst); |
50 | 48 | ||
51 | /// <summary> | 49 | /// <summary> |
@@ -113,8 +111,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
113 | // private LogOffUser handlerLogOffUser = null; | 111 | // private LogOffUser handlerLogOffUser = null; |
114 | // private GetLandData handlerGetLandData = null; // OnGetLandData | 112 | // private GetLandData handlerGetLandData = null; // OnGetLandData |
115 | 113 | ||
116 | public KiPrimitiveDelegate KiPrimitive; | ||
117 | |||
118 | public SceneCommunicationService() | 114 | public SceneCommunicationService() |
119 | { | 115 | { |
120 | } | 116 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 3f4e112..339cf0f 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -1162,7 +1162,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1162 | { | 1162 | { |
1163 | if (!IsAttachment || (AttachedAvatar == avatar.ControllingClient.AgentId) || | 1163 | if (!IsAttachment || (AttachedAvatar == avatar.ControllingClient.AgentId) || |
1164 | (AttachmentPoint < 31) || (AttachmentPoint > 38)) | 1164 | (AttachmentPoint < 31) || (AttachmentPoint > 38)) |
1165 | avatar.ControllingClient.SendKillObject(m_regionHandle, part.LocalId); | 1165 | avatar.ControllingClient.SendKillObject(m_regionHandle, new List<uint> { part.LocalId }); |
1166 | } | 1166 | } |
1167 | } | 1167 | } |
1168 | }); | 1168 | }); |
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index 8e9647e..380570b 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs | |||
@@ -934,7 +934,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server | |||
934 | 934 | ||
935 | } | 935 | } |
936 | 936 | ||
937 | public void SendKillObject(ulong regionHandle, uint localID) | 937 | public void SendKillObject(ulong regionHandle, List<uint> localID) |
938 | { | 938 | { |
939 | 939 | ||
940 | } | 940 | } |
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index ee9a4c1..152377a 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs | |||
@@ -520,7 +520,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
520 | 520 | ||
521 | } | 521 | } |
522 | 522 | ||
523 | public virtual void SendKillObject(ulong regionHandle, uint localID) | 523 | public virtual void SendKillObject(ulong regionHandle, List<uint> localID) |
524 | { | 524 | { |
525 | } | 525 | } |
526 | 526 | ||
diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index 578e3ed..4636961 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs | |||
@@ -487,7 +487,7 @@ namespace OpenSim.Tests.Common.Mock | |||
487 | 487 | ||
488 | } | 488 | } |
489 | 489 | ||
490 | public virtual void SendKillObject(ulong regionHandle, uint localID) | 490 | public virtual void SendKillObject(ulong regionHandle, List<uint> localID) |
491 | { | 491 | { |
492 | } | 492 | } |
493 | 493 | ||