aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorUbitUmarov2012-02-10 23:03:30 +0000
committerUbitUmarov2012-02-10 23:03:30 +0000
commite3f5fd81f1bdcccb5fb0cad75d85bf1f733667d7 (patch)
tree0fff77027caf8e6ba723489c45e0cf1cb77bb0ec
parent Changes to vehicles code etc. Includes some debug aids to remove later. (diff)
parentMerge branch 'master' into careminster (diff)
downloadopensim-SC_OLD-e3f5fd81f1bdcccb5fb0cad75d85bf1f733667d7.zip
opensim-SC_OLD-e3f5fd81f1bdcccb5fb0cad75d85bf1f733667d7.tar.gz
opensim-SC_OLD-e3f5fd81f1bdcccb5fb0cad75d85bf1f733667d7.tar.bz2
opensim-SC_OLD-e3f5fd81f1bdcccb5fb0cad75d85bf1f733667d7.tar.xz
Merge branch 'master' of ssh://3dhosting.de/var/git/careminster into ubitwork
Conflicts: prebuild.xml
-rw-r--r--OpenSim/Data/SQLite/SQLiteFriendsData.cs2
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs9
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs10
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs2
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs14
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs17
-rw-r--r--OpenSim/Region/Framework/Interfaces/INPCModule.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs30
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs13
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs23
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs3
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs8
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs8
-rw-r--r--OpenSim/Region/UserStatistics/WebStatsModule.cs11
-rw-r--r--OpenSim/Tests/Torture/NPCTortureTests.cs185
17 files changed, 309 insertions, 34 deletions
diff --git a/OpenSim/Data/SQLite/SQLiteFriendsData.cs b/OpenSim/Data/SQLite/SQLiteFriendsData.cs
index b14c348..5f68977 100644
--- a/OpenSim/Data/SQLite/SQLiteFriendsData.cs
+++ b/OpenSim/Data/SQLite/SQLiteFriendsData.cs
@@ -75,7 +75,7 @@ namespace OpenSim.Data.SQLite
75 cmd.Parameters.AddWithValue(":PrincipalID", principalID.ToString()); 75 cmd.Parameters.AddWithValue(":PrincipalID", principalID.ToString());
76 cmd.Parameters.AddWithValue(":Friend", friend); 76 cmd.Parameters.AddWithValue(":Friend", friend);
77 77
78 ExecuteNonQuery(cmd, cmd.Connection); 78 ExecuteNonQuery(cmd, m_Connection);
79 79
80 return true; 80 return true;
81 } 81 }
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
index cf0c28b..be699db 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
@@ -422,7 +422,7 @@ namespace OpenSim.Region.ClientStack.Linden
422 string assetType) 422 string assetType)
423 { 423 {
424 m_log.DebugFormat( 424 m_log.DebugFormat(
425 "Uploaded asset {0} for inventory item {1}, inv type {2}, asset type {3}", 425 "[BUNCH OF CAPS]: Uploaded asset {0} for inventory item {1}, inv type {2}, asset type {3}",
426 assetID, inventoryItem, inventoryType, assetType); 426 assetID, inventoryItem, inventoryType, assetType);
427 427
428 sbyte assType = 0; 428 sbyte assType = 0;
@@ -625,7 +625,12 @@ namespace OpenSim.Region.ClientStack.Linden
625 item.AssetType = assType; 625 item.AssetType = assType;
626 item.InvType = inType; 626 item.InvType = inType;
627 item.Folder = parentFolder; 627 item.Folder = parentFolder;
628 item.CurrentPermissions = (uint)PermissionMask.All; 628
629 // If we set PermissionMask.All then when we rez the item the next permissions will replace the current
630 // (owner) permissions. This becomes a problem if next permissions are changed.
631 item.CurrentPermissions
632 = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer);
633
629 item.BasePermissions = (uint)PermissionMask.All; 634 item.BasePermissions = (uint)PermissionMask.All;
630 item.EveryOnePermissions = 0; 635 item.EveryOnePermissions = 0;
631 item.NextPermissions = (uint)PermissionMask.All; 636 item.NextPermissions = (uint)PermissionMask.All;
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs
index aed03b3..1117f2a 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs
@@ -50,8 +50,7 @@ namespace OpenSim.Region.ClientStack.Linden
50 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 50 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
51 public class NewFileAgentInventoryVariablePriceModule : INonSharedRegionModule 51 public class NewFileAgentInventoryVariablePriceModule : INonSharedRegionModule
52 { 52 {
53// private static readonly ILog m_log = 53// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
54// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
55 54
56 private Scene m_scene; 55 private Scene m_scene;
57// private IAssetService m_assetService; 56// private IAssetService m_assetService;
@@ -210,6 +209,9 @@ namespace OpenSim.Region.ClientStack.Linden
210 UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType, 209 UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType,
211 string assetType,UUID AgentID) 210 string assetType,UUID AgentID)
212 { 211 {
212// m_log.DebugFormat(
213// "[NEW FILE AGENT INVENTORY VARIABLE PRICE MODULE]: Upload complete for {0}", inventoryItem);
214
213 sbyte assType = 0; 215 sbyte assType = 0;
214 sbyte inType = 0; 216 sbyte inType = 0;
215 217
@@ -259,13 +261,13 @@ namespace OpenSim.Region.ClientStack.Linden
259 item.AssetType = assType; 261 item.AssetType = assType;
260 item.InvType = inType; 262 item.InvType = inType;
261 item.Folder = parentFolder; 263 item.Folder = parentFolder;
262 item.CurrentPermissions = (uint)PermissionMask.All; 264 item.CurrentPermissions
265 = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer);
263 item.BasePermissions = (uint)PermissionMask.All; 266 item.BasePermissions = (uint)PermissionMask.All;
264 item.EveryOnePermissions = 0; 267 item.EveryOnePermissions = 0;
265 item.NextPermissions = (uint)PermissionMask.All; 268 item.NextPermissions = (uint)PermissionMask.All;
266 item.CreationDate = Util.UnixTimeSinceEpoch(); 269 item.CreationDate = Util.UnixTimeSinceEpoch();
267 m_scene.AddInventoryItem(item); 270 m_scene.AddInventoryItem(item);
268
269 } 271 }
270 } 272 }
271} 273}
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs
index e4bacd4..7a3d97e 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs
@@ -339,7 +339,7 @@ namespace OpenSim.Region.ClientStack.Linden
339 m_scene.AddSceneObject(grp); 339 m_scene.AddSceneObject(grp);
340 grp.AbsolutePosition = obj.Position; 340 grp.AbsolutePosition = obj.Position;
341 } 341 }
342 342
343 allparts[i] = grp; 343 allparts[i] = grp;
344 } 344 }
345 345
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index f019a83..c20f7b2 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -5168,7 +5168,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5168 AddLocalPacketHandler(PacketType.ImprovedInstantMessage, HandlerImprovedInstantMessage, false); 5168 AddLocalPacketHandler(PacketType.ImprovedInstantMessage, HandlerImprovedInstantMessage, false);
5169 AddLocalPacketHandler(PacketType.AcceptFriendship, HandlerAcceptFriendship); 5169 AddLocalPacketHandler(PacketType.AcceptFriendship, HandlerAcceptFriendship);
5170 AddLocalPacketHandler(PacketType.DeclineFriendship, HandlerDeclineFriendship); 5170 AddLocalPacketHandler(PacketType.DeclineFriendship, HandlerDeclineFriendship);
5171 AddLocalPacketHandler(PacketType.TerminateFriendship, HandlerTerminateFrendship); 5171 AddLocalPacketHandler(PacketType.TerminateFriendship, HandlerTerminateFriendship);
5172 AddLocalPacketHandler(PacketType.RezObject, HandlerRezObject); 5172 AddLocalPacketHandler(PacketType.RezObject, HandlerRezObject);
5173 AddLocalPacketHandler(PacketType.DeRezObject, HandlerDeRezObject); 5173 AddLocalPacketHandler(PacketType.DeRezObject, HandlerDeRezObject);
5174 AddLocalPacketHandler(PacketType.ModifyLand, HandlerModifyLand); 5174 AddLocalPacketHandler(PacketType.ModifyLand, HandlerModifyLand);
@@ -5891,7 +5891,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5891 return true; 5891 return true;
5892 } 5892 }
5893 5893
5894 private bool HandlerTerminateFrendship(IClientAPI sender, Packet Pack) 5894 private bool HandlerTerminateFriendship(IClientAPI sender, Packet Pack)
5895 { 5895 {
5896 TerminateFriendshipPacket tfriendpack = (TerminateFriendshipPacket)Pack; 5896 TerminateFriendshipPacket tfriendpack = (TerminateFriendshipPacket)Pack;
5897 5897
@@ -5906,13 +5906,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5906 5906
5907 UUID listOwnerAgentID = tfriendpack.AgentData.AgentID; 5907 UUID listOwnerAgentID = tfriendpack.AgentData.AgentID;
5908 UUID exFriendID = tfriendpack.ExBlock.OtherID; 5908 UUID exFriendID = tfriendpack.ExBlock.OtherID;
5909 5909 FriendshipTermination TerminateFriendshipHandler = OnTerminateFriendship;
5910 FriendshipTermination handlerTerminateFriendship = OnTerminateFriendship; 5910 if (TerminateFriendshipHandler != null)
5911 if (handlerTerminateFriendship != null)
5912 { 5911 {
5913 handlerTerminateFriendship(this, listOwnerAgentID, exFriendID); 5912 TerminateFriendshipHandler(this, listOwnerAgentID, exFriendID);
5913 return true;
5914 } 5914 }
5915 return true; 5915 return false;
5916 } 5916 }
5917 5917
5918 private bool HandleFindAgent(IClientAPI client, Packet Packet) 5918 private bool HandleFindAgent(IClientAPI client, Packet Packet)
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index fe75271..a47bc9a 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -830,6 +830,12 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
830 group = objlist[i]; 830 group = objlist[i];
831 SceneObjectPart rootPart = group.RootPart; 831 SceneObjectPart rootPart = group.RootPart;
832 832
833// m_log.DebugFormat(
834// "[InventoryAccessModule]: Preparing to rez {0} {1} {2} ownermask={3:X} nextownermask={4:X} groupmask={5:X} everyonemask={6:X} for {7}",
835// group.Name, group.LocalId, group.UUID,
836// group.RootPart.OwnerMask, group.RootPart.NextOwnerMask, group.RootPart.GroupMask, group.RootPart.EveryoneMask,
837// remoteClient.Name);
838
833// Vector3 storedPosition = group.AbsolutePosition; 839// Vector3 storedPosition = group.AbsolutePosition;
834 if (group.UUID == UUID.Zero) 840 if (group.UUID == UUID.Zero)
835 { 841 {
@@ -892,6 +898,12 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
892 898
893 rootPart.ScheduleFullUpdate(); 899 rootPart.ScheduleFullUpdate();
894 } 900 }
901
902// m_log.DebugFormat(
903// "[InventoryAccessModule]: Rezzed {0} {1} {2} ownermask={3:X} nextownermask={4:X} groupmask={5:X} everyonemask={6:X} for {7}",
904// group.Name, group.LocalId, group.UUID,
905// group.RootPart.OwnerMask, group.RootPart.NextOwnerMask, group.RootPart.GroupMask, group.RootPart.EveryoneMask,
906// remoteClient.Name);
895 } 907 }
896 908
897 group.SetGroup(remoteClient.ActiveGroupId, remoteClient); 909 group.SetGroup(remoteClient.ActiveGroupId, remoteClient);
@@ -958,7 +970,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
958 } 970 }
959 971
960 rootPart.FromFolderID = item.Folder; 972 rootPart.FromFolderID = item.Folder;
961 973
974// Console.WriteLine("rootPart.OwnedID {0}, item.Owner {1}, item.CurrentPermissions {2:X}",
975// rootPart.OwnerID, item.Owner, item.CurrentPermissions);
976
962 if ((rootPart.OwnerID != item.Owner) || 977 if ((rootPart.OwnerID != item.Owner) ||
963 (item.CurrentPermissions & 16) != 0 || 978 (item.CurrentPermissions & 16) != 0 ||
964 (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) 979 (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0)
diff --git a/OpenSim/Region/Framework/Interfaces/INPCModule.cs b/OpenSim/Region/Framework/Interfaces/INPCModule.cs
index 2731291..dc3ff89 100644
--- a/OpenSim/Region/Framework/Interfaces/INPCModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/INPCModule.cs
@@ -58,7 +58,7 @@ namespace OpenSim.Region.Framework.Interfaces
58 /// </param> 58 /// </param>
59 /// <param name="scene"></param> 59 /// <param name="scene"></param>
60 /// <param name="appearance">The avatar appearance to use for the new NPC.</param> 60 /// <param name="appearance">The avatar appearance to use for the new NPC.</param>
61 /// <returns>The UUID of the ScenePresence created.</returns> 61 /// <returns>The UUID of the ScenePresence created. UUID.Zero if there was a failure.</returns>
62 UUID CreateNPC( 62 UUID CreateNPC(
63 string firstname, 63 string firstname,
64 string lastname, 64 string lastname,
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 58de44e..fff39fb 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -330,6 +330,12 @@ namespace OpenSim.Region.Framework.Scenes
330 item.Flags = (item.Flags & ~(uint)255) | (itemUpd.Flags & (uint)255); 330 item.Flags = (item.Flags & ~(uint)255) | (itemUpd.Flags & (uint)255);
331 item.Name = itemUpd.Name; 331 item.Name = itemUpd.Name;
332 item.Description = itemUpd.Description; 332 item.Description = itemUpd.Description;
333
334// m_log.DebugFormat(
335// "[USER INVENTORY]: itemUpd {0} {1} {2} {3}, item {4} {5} {6} {7}",
336// itemUpd.NextPermissions, itemUpd.GroupPermissions, itemUpd.EveryOnePermissions, item.Flags,
337// item.NextPermissions, item.GroupPermissions, item.EveryOnePermissions, item.CurrentPermissions);
338
333 if (item.NextPermissions != (itemUpd.NextPermissions & item.BasePermissions)) 339 if (item.NextPermissions != (itemUpd.NextPermissions & item.BasePermissions))
334 item.Flags |= (uint)InventoryItemFlags.ObjectOverwriteNextOwner; 340 item.Flags |= (uint)InventoryItemFlags.ObjectOverwriteNextOwner;
335 item.NextPermissions = itemUpd.NextPermissions & item.BasePermissions; 341 item.NextPermissions = itemUpd.NextPermissions & item.BasePermissions;
@@ -338,6 +344,9 @@ namespace OpenSim.Region.Framework.Scenes
338 item.EveryOnePermissions = itemUpd.EveryOnePermissions & item.BasePermissions; 344 item.EveryOnePermissions = itemUpd.EveryOnePermissions & item.BasePermissions;
339 if (item.GroupPermissions != (itemUpd.GroupPermissions & item.BasePermissions)) 345 if (item.GroupPermissions != (itemUpd.GroupPermissions & item.BasePermissions))
340 item.Flags |= (uint)InventoryItemFlags.ObjectOverwriteGroup; 346 item.Flags |= (uint)InventoryItemFlags.ObjectOverwriteGroup;
347
348// m_log.DebugFormat("[USER INVENTORY]: item.Flags {0}", item.Flags);
349
341 item.GroupPermissions = itemUpd.GroupPermissions & item.BasePermissions; 350 item.GroupPermissions = itemUpd.GroupPermissions & item.BasePermissions;
342 item.GroupID = itemUpd.GroupID; 351 item.GroupID = itemUpd.GroupID;
343 item.GroupOwned = itemUpd.GroupOwned; 352 item.GroupOwned = itemUpd.GroupOwned;
@@ -2310,8 +2319,25 @@ namespace OpenSim.Region.Framework.Scenes
2310 m_sceneGraph.DelinkObjects(parts); 2319 m_sceneGraph.DelinkObjects(parts);
2311 } 2320 }
2312 2321
2322 /// <summary>
2323 /// Link the scene objects containing the indicated parts to a root object.
2324 /// </summary>
2325 /// <param name="client"></param>
2326 /// <param name="parentPrimId">A root prim id of the object which will be the root prim of the resulting linkset.</param>
2327 /// <param name="childPrimIds">A list of child prims for the objects that should be linked in.</param>
2313 public void LinkObjects(IClientAPI client, uint parentPrimId, List<uint> childPrimIds) 2328 public void LinkObjects(IClientAPI client, uint parentPrimId, List<uint> childPrimIds)
2314 { 2329 {
2330 LinkObjects(client.AgentId, parentPrimId, childPrimIds);
2331 }
2332
2333 /// <summary>
2334 /// Link the scene objects containing the indicated parts to a root object.
2335 /// </summary>
2336 /// <param name="agentId">The ID of the user linking.</param>
2337 /// <param name="parentPrimId">A root prim id of the object which will be the root prim of the resulting linkset.</param>
2338 /// <param name="childPrimIds">A list of child prims for the objects that should be linked in.</param>
2339 public void LinkObjects(UUID agentId, uint parentPrimId, List<uint> childPrimIds)
2340 {
2315 List<UUID> owners = new List<UUID>(); 2341 List<UUID> owners = new List<UUID>();
2316 2342
2317 List<SceneObjectPart> children = new List<SceneObjectPart>(); 2343 List<SceneObjectPart> children = new List<SceneObjectPart>();
@@ -2323,7 +2349,7 @@ namespace OpenSim.Region.Framework.Scenes
2323 return; 2349 return;
2324 } 2350 }
2325 2351
2326 if (!Permissions.CanLinkObject(client.AgentId, root.ParentGroup.RootPart.UUID)) 2352 if (!Permissions.CanLinkObject(agentId, root.ParentGroup.RootPart.UUID))
2327 { 2353 {
2328 m_log.DebugFormat("[LINK]: Refusing link. No permissions on root prim"); 2354 m_log.DebugFormat("[LINK]: Refusing link. No permissions on root prim");
2329 return; 2355 return;
@@ -2339,7 +2365,7 @@ namespace OpenSim.Region.Framework.Scenes
2339 if (!owners.Contains(part.OwnerID)) 2365 if (!owners.Contains(part.OwnerID))
2340 owners.Add(part.OwnerID); 2366 owners.Add(part.OwnerID);
2341 2367
2342 if (Permissions.CanLinkObject(client.AgentId, part.ParentGroup.RootPart.UUID)) 2368 if (Permissions.CanLinkObject(agentId, part.ParentGroup.RootPart.UUID))
2343 children.Add(part); 2369 children.Add(part);
2344 } 2370 }
2345 2371
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 17563bd..6dd42dd 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -1751,6 +1751,10 @@ namespace OpenSim.Region.Framework.Scenes
1751 { 1751 {
1752 SceneObjectGroup child = children[i].ParentGroup; 1752 SceneObjectGroup child = children[i].ParentGroup;
1753 1753
1754 // Don't try and add a group to itself - this will only cause severe problems later on.
1755 if (child == parentGroup)
1756 continue;
1757
1754 // Make sure no child prim is set for sale 1758 // Make sure no child prim is set for sale
1755 // So that, on delink, no prims are unwittingly 1759 // So that, on delink, no prims are unwittingly
1756 // left for sale and sold off 1760 // left for sale and sold off
@@ -1777,8 +1781,13 @@ namespace OpenSim.Region.Framework.Scenes
1777 1781
1778 // We need to explicitly resend the newly link prim's object properties since no other actions 1782 // We need to explicitly resend the newly link prim's object properties since no other actions
1779 // occur on link to invoke this elsewhere (such as object selection) 1783 // occur on link to invoke this elsewhere (such as object selection)
1780 parentGroup.RootPart.CreateSelected = true; 1784 if (childGroups.Count > 0)
1781 parentGroup.TriggerScriptChangedEvent(Changed.LINK); 1785 {
1786 parentGroup.RootPart.CreateSelected = true;
1787 parentGroup.TriggerScriptChangedEvent(Changed.LINK);
1788 parentGroup.HasGroupChanged = true;
1789 parentGroup.ScheduleGroupForFullUpdate();
1790 }
1782 } 1791 }
1783 finally 1792 finally
1784 { 1793 {
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
index b56d3fc..f3660a5 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
@@ -269,6 +269,8 @@ namespace OpenSim.Region.Framework.Scenes
269 269
270 public void ApplyNextOwnerPermissions() 270 public void ApplyNextOwnerPermissions()
271 { 271 {
272// m_log.DebugFormat("[PRIM INVENTORY]: Applying next owner permissions to {0} {1}", Name, UUID);
273
272 SceneObjectPart[] parts = m_parts.GetArray(); 274 SceneObjectPart[] parts = m_parts.GetArray();
273 for (int i = 0; i < parts.Length; i++) 275 for (int i = 0; i < parts.Length; i++)
274 parts[i].ApplyNextOwnerPermissions(); 276 parts[i].ApplyNextOwnerPermissions();
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 2a3d735..9961438 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -2377,6 +2377,10 @@ namespace OpenSim.Region.Framework.Scenes
2377// "[SCENE OBJECT GROUP]: Linking group with root part {0}, {1} to group with root part {2}, {3}", 2377// "[SCENE OBJECT GROUP]: Linking group with root part {0}, {1} to group with root part {2}, {3}",
2378// objectGroup.RootPart.Name, objectGroup.RootPart.UUID, RootPart.Name, RootPart.UUID); 2378// objectGroup.RootPart.Name, objectGroup.RootPart.UUID, RootPart.Name, RootPart.UUID);
2379 2379
2380 // Linking to ourselves is not a valid operation.
2381 if (objectGroup == this)
2382 return;
2383
2380 SceneObjectPart linkPart = objectGroup.m_rootPart; 2384 SceneObjectPart linkPart = objectGroup.m_rootPart;
2381 2385
2382 Vector3 oldGroupPosition = linkPart.GroupPosition; 2386 Vector3 oldGroupPosition = linkPart.GroupPosition;
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
index a2332bb..be5b4a8 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
@@ -39,14 +39,31 @@ using log4net;
39 39
40namespace OpenSim.Region.Framework.Scenes.Tests 40namespace OpenSim.Region.Framework.Scenes.Tests
41{ 41{
42 /// <summary>
43 /// Linking tests
44 /// </summary>
45 [TestFixture] 42 [TestFixture]
46 public class SceneObjectLinkingTests 43 public class SceneObjectLinkingTests
47 { 44 {
48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
49 46
47 /// <summary>
48 /// Links to self should be ignored.
49 /// </summary>
50 [Test]
51 public void TestLinkToSelf()
52 {
53 TestHelpers.InMethod();
54
55 UUID ownerId = TestHelpers.ParseTail(0x1);
56 int nParts = 3;
57
58 TestScene scene = SceneHelpers.SetupScene();
59 SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(nParts, ownerId, "TestLinkToSelf_", 0x10);
60 scene.AddSceneObject(sog1);
61 scene.LinkObjects(ownerId, sog1.LocalId, new List<uint>() { sog1.Parts[1].LocalId });
62// sog1.LinkToGroup(sog1);
63
64 Assert.That(sog1.Parts.Length, Is.EqualTo(nParts));
65 }
66
50 [Test] 67 [Test]
51 public void TestLinkDelink2SceneObjects() 68 public void TestLinkDelink2SceneObjects()
52 { 69 {
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
index 03b52c0..d0b822c 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
@@ -44,7 +44,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
44 private readonly string m_firstname; 44 private readonly string m_firstname;
45 private readonly string m_lastname; 45 private readonly string m_lastname;
46 private readonly Vector3 m_startPos; 46 private readonly Vector3 m_startPos;
47 private readonly UUID m_uuid = UUID.Random(); 47 private UUID m_uuid = UUID.Random();
48 private readonly Scene m_scene; 48 private readonly Scene m_scene;
49 private readonly UUID m_ownerID; 49 private readonly UUID m_ownerID;
50 50
@@ -444,6 +444,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
444 public virtual UUID AgentId 444 public virtual UUID AgentId
445 { 445 {
446 get { return m_uuid; } 446 get { return m_uuid; }
447 set { m_uuid = value; }
447 } 448 }
448 449
449 public UUID SessionId 450 public UUID SessionId
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
index 3ea7352..6803644 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
@@ -155,20 +155,21 @@ namespace OpenSim.Region.OptionalModules.World.NPC
155 "[NPC MODULE]: Successfully retrieved scene presence for NPC {0} {1}", sp.Name, sp.UUID); 155 "[NPC MODULE]: Successfully retrieved scene presence for NPC {0} {1}", sp.Name, sp.UUID);
156 156
157 sp.CompleteMovement(npcAvatar, false); 157 sp.CompleteMovement(npcAvatar, false);
158 m_avatars.Add(npcAvatar.AgentId, npcAvatar);
158 } 159 }
159 else 160 else
160 { 161 {
161 m_log.WarnFormat("[NPC MODULE]: Could not find scene presence for NPC {0} {1}", sp.Name, sp.UUID); 162 m_log.WarnFormat("[NPC MODULE]: Could not find scene presence for NPC {0} {1}", sp.Name, sp.UUID);
163 npcAvatar.AgentId = UUID.Zero;
162 } 164 }
163 165
164 m_avatars.Add(npcAvatar.AgentId, npcAvatar);
165 } 166 }
166 ev.Set(); 167 ev.Set();
167 }); 168 });
168 169
169 ev.WaitOne(); 170 ev.WaitOne();
170 171
171 m_log.DebugFormat("[NPC MODULE]: Created NPC with id {0}", npcAvatar.AgentId); 172// m_log.DebugFormat("[NPC MODULE]: Created NPC with id {0}", npcAvatar.AgentId);
172 173
173 return npcAvatar.AgentId; 174 return npcAvatar.AgentId;
174 } 175 }
@@ -299,13 +300,16 @@ namespace OpenSim.Region.OptionalModules.World.NPC
299 NPCAvatar av; 300 NPCAvatar av;
300 if (m_avatars.TryGetValue(agentID, out av)) 301 if (m_avatars.TryGetValue(agentID, out av))
301 { 302 {
303// m_log.DebugFormat("[NPC MODULE]: Found {0} {1} to remove", agentID, av.Name);
302 scene.RemoveClient(agentID, false); 304 scene.RemoveClient(agentID, false);
303 m_avatars.Remove(agentID); 305 m_avatars.Remove(agentID);
304 306
307// m_log.DebugFormat("[NPC MODULE]: Removed {0} {1}", agentID, av.Name);
305 return true; 308 return true;
306 } 309 }
307 } 310 }
308 311
312// m_log.DebugFormat("[NPC MODULE]: Could not find {0} to remove", agentID);
309 return false; 313 return false;
310 } 314 }
311 315
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index 34f2cc7..da2ef7b 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -538,6 +538,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
538 538
539 public bool Stop(int timeout) 539 public bool Stop(int timeout)
540 { 540 {
541// m_log.DebugFormat(
542// "[SCRIPT INSTANCE]: Stopping script {0} {1} with timeout {2}", ScriptName, ItemID, timeout);
543
541 IScriptWorkItem result; 544 IScriptWorkItem result;
542 545
543 lock (m_EventQueue) 546 lock (m_EventQueue)
@@ -772,7 +775,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
772 } 775 }
773 catch (Exception e) 776 catch (Exception e)
774 { 777 {
775 // m_log.DebugFormat("[SCRIPT] Exception: {0}", e.Message); 778// m_log.DebugFormat(
779// "[SCRIPT] Exception in script {0} {1}: {2}{3}",
780// ScriptName, ItemID, e.Message, e.StackTrace);
781
776 m_InEvent = false; 782 m_InEvent = false;
777 m_CurrentEvent = String.Empty; 783 m_CurrentEvent = String.Empty;
778 784
diff --git a/OpenSim/Region/UserStatistics/WebStatsModule.cs b/OpenSim/Region/UserStatistics/WebStatsModule.cs
index 24a9418..f627e37 100644
--- a/OpenSim/Region/UserStatistics/WebStatsModule.cs
+++ b/OpenSim/Region/UserStatistics/WebStatsModule.cs
@@ -301,7 +301,7 @@ namespace OpenSim.Region.UserStatistics
301 301
302 public void OnRegisterCaps(UUID agentID, Caps caps) 302 public void OnRegisterCaps(UUID agentID, Caps caps)
303 { 303 {
304 m_log.DebugFormat("[VC]: OnRegisterCaps: agentID {0} caps {1}", agentID, caps); 304 m_log.DebugFormat("[WEB STATS MODULE]: OnRegisterCaps: agentID {0} caps {1}", agentID, caps);
305 string capsPath = "/CAPS/VS/" + UUID.Random(); 305 string capsPath = "/CAPS/VS/" + UUID.Random();
306 caps.RegisterHandler("ViewerStats", 306 caps.RegisterHandler("ViewerStats",
307 new RestStreamHandler("POST", capsPath, 307 new RestStreamHandler("POST", capsPath,
@@ -462,7 +462,7 @@ namespace OpenSim.Region.UserStatistics
462 462
463 if (!m_sessions.ContainsKey(agentID)) 463 if (!m_sessions.ContainsKey(agentID))
464 { 464 {
465 m_log.Warn("[VS]: no session for stat disclosure"); 465 m_log.Warn("[WEB STATS MODULE]: no session for stat disclosure");
466 return new UserSessionID(); 466 return new UserSessionID();
467 } 467 }
468 uid = m_sessions[agentID]; 468 uid = m_sessions[agentID];
@@ -667,14 +667,13 @@ namespace OpenSim.Region.UserStatistics
667 { 667 {
668 updatecmd.ExecuteNonQuery(); 668 updatecmd.ExecuteNonQuery();
669 } 669 }
670 catch 670 catch (SqliteExecutionException)
671 (SqliteExecutionException)
672 { 671 {
673 m_log.Warn("[WEBSTATS]: failed to write stats to storage Execution Exception"); 672 m_log.Warn("[WEB STATS MODULE]: failed to write stats to storage Execution Exception");
674 } 673 }
675 catch (SqliteSyntaxException) 674 catch (SqliteSyntaxException)
676 { 675 {
677 m_log.Warn("[WEBSTATS]: failed to write stats to storage SQL Syntax Exception"); 676 m_log.Warn("[WEB STATS MODULE]: failed to write stats to storage SQL Syntax Exception");
678 } 677 }
679 678
680 } 679 }
diff --git a/OpenSim/Tests/Torture/NPCTortureTests.cs b/OpenSim/Tests/Torture/NPCTortureTests.cs
new file mode 100644
index 0000000..8078d9d
--- /dev/null
+++ b/OpenSim/Tests/Torture/NPCTortureTests.cs
@@ -0,0 +1,185 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Diagnostics;
31using System.Reflection;
32using log4net;
33using Nini.Config;
34using NUnit.Framework;
35using OpenMetaverse;
36using OpenSim.Framework;
37using OpenSim.Framework.Communications;
38using OpenSim.Region.CoreModules.Avatar.Attachments;
39using OpenSim.Region.CoreModules.Avatar.AvatarFactory;
40using OpenSim.Region.CoreModules.Framework.InventoryAccess;
41using OpenSim.Region.CoreModules.Framework.UserManagement;
42using OpenSim.Region.CoreModules.ServiceConnectorsOut.Avatar;
43using OpenSim.Region.Framework.Interfaces;
44using OpenSim.Region.Framework.Scenes;
45using OpenSim.Region.OptionalModules.World.NPC;
46using OpenSim.Services.AvatarService;
47using OpenSim.Tests.Common;
48using OpenSim.Tests.Common.Mock;
49
50namespace OpenSim.Tests.Torture
51{
52 /// <summary>
53 /// NPC torture tests
54 /// </summary>
55 /// <remarks>
56 /// Don't rely on the numbers given by these tests - they will vary a lot depending on what is already cached,
57 /// how much memory is free, etc. In some cases, later larger tests will apparently take less time than smaller
58 /// earlier tests.
59 /// </remarks>
60 [TestFixture]
61 public class NPCTortureTests
62 {
63 private TestScene scene;
64 private AvatarFactoryModule afm;
65 private UserManagementModule umm;
66 private AttachmentsModule am;
67
68 [TestFixtureSetUp]
69 public void FixtureInit()
70 {
71 // Don't allow tests to be bamboozled by asynchronous events. Execute everything on the same thread.
72 Util.FireAndForgetMethod = FireAndForgetMethod.None;
73 }
74
75 [TestFixtureTearDown]
76 public void TearDown()
77 {
78 // We must set this back afterwards, otherwise later tests will fail since they're expecting multiple
79 // threads. Possibly, later tests should be rewritten not to worry about such things.
80 Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod;
81 }
82
83 [SetUp]
84 public void Init()
85 {
86 IConfigSource config = new IniConfigSource();
87 config.AddConfig("NPC");
88 config.Configs["NPC"].Set("Enabled", "true");
89 config.AddConfig("Modules");
90 config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule");
91
92 afm = new AvatarFactoryModule();
93 umm = new UserManagementModule();
94 am = new AttachmentsModule();
95
96 scene = SceneHelpers.SetupScene();
97 SceneHelpers.SetupSceneModules(scene, config, afm, umm, am, new BasicInventoryAccessModule(), new NPCModule());
98 }
99
100 [Test]
101 public void TestAddRemove100NPCs()
102 {
103 TestHelpers.InMethod();
104// log4net.Config.XmlConfigurator.Configure();
105
106 TestAddRemoveNPCs(100);
107 }
108
109 [Test]
110 public void TestAddRemove1000NPCs()
111 {
112 TestHelpers.InMethod();
113// log4net.Config.XmlConfigurator.Configure();
114
115 TestAddRemoveNPCs(1000);
116 }
117
118 [Test]
119 public void TestAddRemove2000NPCs()
120 {
121 TestHelpers.InMethod();
122// log4net.Config.XmlConfigurator.Configure();
123
124 TestAddRemoveNPCs(2000);
125 }
126
127 private void TestAddRemoveNPCs(int numberOfNpcs)
128 {
129 ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1));
130// ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId);
131
132 // 8 is the index of the first baked texture in AvatarAppearance
133 UUID originalFace8TextureId = TestHelpers.ParseTail(0x10);
134 Primitive.TextureEntry originalTe = new Primitive.TextureEntry(UUID.Zero);
135 Primitive.TextureEntryFace originalTef = originalTe.CreateFace(8);
136 originalTef.TextureID = originalFace8TextureId;
137
138 // We also need to add the texture to the asset service, otherwise the AvatarFactoryModule will tell
139 // ScenePresence.SendInitialData() to reset our entire appearance.
140 scene.AssetService.Store(AssetHelpers.CreateNotecardAsset(originalFace8TextureId));
141
142 afm.SetAppearance(sp, originalTe, null);
143
144 INPCModule npcModule = scene.RequestModuleInterface<INPCModule>();
145
146 List<UUID> npcs = new List<UUID>();
147
148 long startGcMemory = GC.GetTotalMemory(true);
149 Stopwatch sw = new Stopwatch();
150 sw.Start();
151
152 for (int i = 0; i < numberOfNpcs; i++)
153 {
154 npcs.Add(
155 npcModule.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, scene, sp.Appearance));
156 }
157
158 for (int i = 0; i < numberOfNpcs; i++)
159 {
160 Assert.That(npcs[i], Is.Not.Null);
161
162 ScenePresence npc = scene.GetScenePresence(npcs[i]);
163 Assert.That(npc, Is.Not.Null);
164 }
165
166 for (int i = 0; i < numberOfNpcs; i++)
167 {
168 Assert.That(npcModule.DeleteNPC(npcs[i], scene), Is.True);
169 ScenePresence npc = scene.GetScenePresence(npcs[i]);
170 Assert.That(npc, Is.Null);
171 }
172
173 sw.Stop();
174
175 long endGcMemory = GC.GetTotalMemory(true);
176
177 Console.WriteLine("Took {0} ms", sw.ElapsedMilliseconds);
178 Console.WriteLine(
179 "End {0} MB, Start {1} MB, Diff {2} MB",
180 endGcMemory / 1024 / 1024,
181 startGcMemory / 1024 / 1024,
182 (endGcMemory - startGcMemory) / 1024 / 1024);
183 }
184 }
185} \ No newline at end of file