aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
authorTom2011-09-04 07:06:36 -0700
committerTom2011-09-04 07:06:36 -0700
commit66dec3b8742eff04fbbcc6e3249fe4ba87986500 (patch)
tree76cc708a821d35fac5cdbbce2de304b47064e732 /OpenSim/Framework
parentGuard another nullref (diff)
parentFixed BulletSim config files for Linux *.so libraries. (diff)
downloadopensim-SC-66dec3b8742eff04fbbcc6e3249fe4ba87986500.zip
opensim-SC-66dec3b8742eff04fbbcc6e3249fe4ba87986500.tar.gz
opensim-SC-66dec3b8742eff04fbbcc6e3249fe4ba87986500.tar.bz2
opensim-SC-66dec3b8742eff04fbbcc6e3249fe4ba87986500.tar.xz
Resolve merge commits, stage 1
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/AgentCircuitData.cs11
-rw-r--r--OpenSim/Framework/AvatarAppearance.cs76
-rw-r--r--OpenSim/Framework/AvatarAttachment.cs2
-rw-r--r--OpenSim/Framework/ChildAgentDataUpdate.cs4
-rw-r--r--OpenSim/Framework/IClientAPI.cs6
-rw-r--r--OpenSim/Framework/IScene.cs16
-rw-r--r--OpenSim/Framework/ISceneEntity.cs1
-rw-r--r--OpenSim/Framework/InventoryFolderImpl.cs8
-rw-r--r--OpenSim/Framework/PacketPool.cs17
-rw-r--r--OpenSim/Framework/PresenceType.cs (renamed from OpenSim/Framework/UndoStack.cs)77
-rw-r--r--OpenSim/Framework/PrimitiveBaseShape.cs61
-rw-r--r--OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs112
-rw-r--r--OpenSim/Framework/Tests/AgentCircuitDataTest.cs2
-rw-r--r--OpenSim/Framework/Tests/AgentCircuitManagerTests.cs4
-rw-r--r--OpenSim/Framework/Tests/UtilTest.cs8
-rw-r--r--OpenSim/Framework/Util.cs40
-rw-r--r--OpenSim/Framework/WebUtil.cs24
17 files changed, 262 insertions, 207 deletions
diff --git a/OpenSim/Framework/AgentCircuitData.cs b/OpenSim/Framework/AgentCircuitData.cs
index 125910e..12c8ac0 100644
--- a/OpenSim/Framework/AgentCircuitData.cs
+++ b/OpenSim/Framework/AgentCircuitData.cs
@@ -296,11 +296,12 @@ namespace OpenSim.Framework
296 if (args["start_pos"] != null) 296 if (args["start_pos"] != null)
297 Vector3.TryParse(args["start_pos"].AsString(), out startpos); 297 Vector3.TryParse(args["start_pos"].AsString(), out startpos);
298 298
299 m_log.InfoFormat("[AGENTCIRCUITDATA] agentid={0}, child={1}, startpos={2}",AgentID,child,startpos.ToString()); 299 m_log.InfoFormat("[AGENTCIRCUITDATA]: agentid={0}, child={1}, startpos={2}", AgentID, child, startpos);
300 300
301 try { 301 try
302 {
302 // Unpack various appearance elements 303 // Unpack various appearance elements
303 Appearance = new AvatarAppearance(AgentID); 304 Appearance = new AvatarAppearance();
304 305
305 // Eventually this code should be deprecated, use full appearance 306 // Eventually this code should be deprecated, use full appearance
306 // packing in packed_appearance 307 // packing in packed_appearance
@@ -313,7 +314,9 @@ namespace OpenSim.Framework
313 m_log.InfoFormat("[AGENTCIRCUITDATA] unpacked appearance"); 314 m_log.InfoFormat("[AGENTCIRCUITDATA] unpacked appearance");
314 } 315 }
315 else 316 else
316 m_log.Warn("[AGENTCIRCUITDATA] failed to find a valid packed_appearance"); 317 {
318 m_log.Warn("[AGENTCIRCUITDATA]: failed to find a valid packed_appearance");
319 }
317 } 320 }
318 catch (Exception e) 321 catch (Exception e)
319 { 322 {
diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs
index c0bc47e..a68de57 100644
--- a/OpenSim/Framework/AvatarAppearance.cs
+++ b/OpenSim/Framework/AvatarAppearance.cs
@@ -47,7 +47,6 @@ namespace OpenSim.Framework
47 public readonly static int TEXTURE_COUNT = 21; 47 public readonly static int TEXTURE_COUNT = 21;
48 public readonly static byte[] BAKE_INDICES = new byte[] { 8, 9, 10, 11, 19, 20 }; 48 public readonly static byte[] BAKE_INDICES = new byte[] { 8, 9, 10, 11, 19, 20 };
49 49
50 protected UUID m_owner;
51 protected int m_serial = 0; 50 protected int m_serial = 0;
52 protected byte[] m_visualparams; 51 protected byte[] m_visualparams;
53 protected Primitive.TextureEntry m_texture; 52 protected Primitive.TextureEntry m_texture;
@@ -56,12 +55,6 @@ namespace OpenSim.Framework
56 protected float m_avatarHeight = 0; 55 protected float m_avatarHeight = 0;
57 protected float m_hipOffset = 0; 56 protected float m_hipOffset = 0;
58 57
59 public virtual UUID Owner
60 {
61 get { return m_owner; }
62 set { m_owner = value; }
63 }
64
65 public virtual int Serial 58 public virtual int Serial
66 { 59 {
67 get { return m_serial; } 60 get { return m_serial; }
@@ -77,7 +70,11 @@ namespace OpenSim.Framework
77 public virtual Primitive.TextureEntry Texture 70 public virtual Primitive.TextureEntry Texture
78 { 71 {
79 get { return m_texture; } 72 get { return m_texture; }
80 set { m_texture = value; } 73 set
74 {
75// m_log.DebugFormat("[AVATAR APPEARANCE]: Set TextureEntry to {0}", value);
76 m_texture = value;
77 }
81 } 78 }
82 79
83 public virtual AvatarWearable[] Wearables 80 public virtual AvatarWearable[] Wearables
@@ -97,38 +94,31 @@ namespace OpenSim.Framework
97 get { return m_hipOffset; } 94 get { return m_hipOffset; }
98 } 95 }
99 96
100 public AvatarAppearance() : this(UUID.Zero) {} 97 public AvatarAppearance()
101
102 public AvatarAppearance(UUID owner)
103 { 98 {
104// m_log.WarnFormat("[AVATAR APPEARANCE]: create empty appearance for {0}",owner); 99// m_log.WarnFormat("[AVATAR APPEARANCE]: create empty appearance");
105 100
106 m_serial = 0; 101 m_serial = 0;
107 m_owner = owner;
108
109 SetDefaultWearables(); 102 SetDefaultWearables();
110 SetDefaultTexture(); 103 SetDefaultTexture();
111 SetDefaultParams(); 104 SetDefaultParams();
112 SetHeight(); 105 SetHeight();
113
114 m_attachments = new Dictionary<int, List<AvatarAttachment>>(); 106 m_attachments = new Dictionary<int, List<AvatarAttachment>>();
115 } 107 }
116 108
117 public AvatarAppearance(UUID avatarID, OSDMap map) 109 public AvatarAppearance(OSDMap map)
118 { 110 {
119// m_log.WarnFormat("[AVATAR APPEARANCE]: create appearance for {0} from OSDMap",avatarID); 111// m_log.WarnFormat("[AVATAR APPEARANCE]: create appearance from OSDMap");
120 112
121 m_owner = avatarID;
122 Unpack(map); 113 Unpack(map);
123 SetHeight(); 114 SetHeight();
124 } 115 }
125 116
126 public AvatarAppearance(UUID avatarID, AvatarWearable[] wearables, Primitive.TextureEntry textureEntry, byte[] visualParams) 117 public AvatarAppearance(AvatarWearable[] wearables, Primitive.TextureEntry textureEntry, byte[] visualParams)
127 { 118 {
128// m_log.WarnFormat("[AVATAR APPEARANCE] create initialized appearance for {0}",avatarID); 119// m_log.WarnFormat("[AVATAR APPEARANCE] create initialized appearance");
129 120
130 m_serial = 0; 121 m_serial = 0;
131 m_owner = avatarID;
132 122
133 if (wearables != null) 123 if (wearables != null)
134 m_wearables = wearables; 124 m_wearables = wearables;
@@ -161,24 +151,21 @@ namespace OpenSim.Framework
161 if (appearance == null) 151 if (appearance == null)
162 { 152 {
163 m_serial = 0; 153 m_serial = 0;
164 m_owner = UUID.Zero;
165
166 SetDefaultWearables(); 154 SetDefaultWearables();
167 SetDefaultTexture(); 155 SetDefaultTexture();
168 SetDefaultParams(); 156 SetDefaultParams();
169 SetHeight(); 157 SetHeight();
170
171 m_attachments = new Dictionary<int, List<AvatarAttachment>>(); 158 m_attachments = new Dictionary<int, List<AvatarAttachment>>();
172 159
173 return; 160 return;
174 } 161 }
175 162
176 m_serial = appearance.Serial; 163 m_serial = appearance.Serial;
177 m_owner = appearance.Owner;
178 164
179 m_wearables = new AvatarWearable[AvatarWearable.MAX_WEARABLES]; 165 m_wearables = new AvatarWearable[AvatarWearable.MAX_WEARABLES];
180 for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) 166 for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++)
181 m_wearables[i] = new AvatarWearable(); 167 m_wearables[i] = new AvatarWearable();
168
182 if (copyWearables && (appearance.Wearables != null)) 169 if (copyWearables && (appearance.Wearables != null))
183 { 170 {
184 for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) 171 for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++)
@@ -196,6 +183,9 @@ namespace OpenSim.Framework
196 if (appearance.VisualParams != null) 183 if (appearance.VisualParams != null)
197 m_visualparams = (byte[])appearance.VisualParams.Clone(); 184 m_visualparams = (byte[])appearance.VisualParams.Clone();
198 185
186 m_avatarHeight = appearance.m_avatarHeight;
187 m_hipOffset = appearance.m_hipOffset;
188
199 // Copy the attachment, force append mode since that ensures consistency 189 // Copy the attachment, force append mode since that ensures consistency
200 m_attachments = new Dictionary<int, List<AvatarAttachment>>(); 190 m_attachments = new Dictionary<int, List<AvatarAttachment>>();
201 foreach (AvatarAttachment attachment in appearance.GetAttachments()) 191 foreach (AvatarAttachment attachment in appearance.GetAttachments())
@@ -237,7 +227,6 @@ namespace OpenSim.Framework
237 { 227 {
238 m_serial = 0; 228 m_serial = 0;
239 229
240 SetDefaultParams();
241 SetDefaultTexture(); 230 SetDefaultTexture();
242 231
243 //for (int i = 0; i < BAKE_INDICES.Length; i++) 232 //for (int i = 0; i < BAKE_INDICES.Length; i++)
@@ -409,9 +398,11 @@ namespace OpenSim.Framework
409// DEBUG OFF 398// DEBUG OFF
410 399
411 /// <summary> 400 /// <summary>
412 /// Get a list of the attachments, note that there may be 401 /// Get a list of the attachments.
413 /// duplicate attachpoints
414 /// </summary> 402 /// </summary>
403 /// <remarks>
404 /// There may be duplicate attachpoints
405 /// </remarks>
415 public List<AvatarAttachment> GetAttachments() 406 public List<AvatarAttachment> GetAttachments()
416 { 407 {
417 lock (m_attachments) 408 lock (m_attachments)
@@ -447,17 +438,29 @@ namespace OpenSim.Framework
447 } 438 }
448 439
449 /// <summary> 440 /// <summary>
450 /// Add an attachment, if the attachpoint has the 441 /// Add an attachment
442 /// </summary>
443 /// <remarks>
444 /// If the attachpoint has the
451 /// 0x80 bit set then we assume this is an append 445 /// 0x80 bit set then we assume this is an append
452 /// operation otherwise we replace whatever is 446 /// operation otherwise we replace whatever is
453 /// currently attached at the attachpoint 447 /// currently attached at the attachpoint
448 /// </remarks>
449 /// <param name="attachpoint"></param>
450 /// <param name="item">If UUID.Zero, then an any attachment at the attachpoint is removed.</param>
451 /// <param name="asset"></param>
452 /// <returns>
454 /// return true if something actually changed 453 /// return true if something actually changed
455 /// </summary> 454 /// </returns>
456 public bool SetAttachment(int attachpoint, UUID item, UUID asset) 455 public bool SetAttachment(int attachpoint, UUID item, UUID asset)
457 { 456 {
458 if (attachpoint == 0) 457 if (attachpoint == 0)
459 return false; 458 return false;
460 459
460// m_log.DebugFormat(
461// "[AVATAR APPEARANCE]: Setting attachment at {0} with item ID {1}, asset ID {2}",
462// attachpoint, item, asset);
463
461 if (item == UUID.Zero) 464 if (item == UUID.Zero)
462 { 465 {
463 lock (m_attachments) 466 lock (m_attachments)
@@ -487,7 +490,7 @@ namespace OpenSim.Framework
487 } 490 }
488 else 491 else
489 { 492 {
490 ReplaceAttachment(new AvatarAttachment(attachpoint,item,asset)); 493 ReplaceAttachment(new AvatarAttachment(attachpoint,item, asset));
491 } 494 }
492 return true; 495 return true;
493 } 496 }
@@ -589,7 +592,7 @@ namespace OpenSim.Framework
589 /// </summary> 592 /// </summary>
590 public void Unpack(OSDMap data) 593 public void Unpack(OSDMap data)
591 { 594 {
592 if ((data != null) && (data["serial"] != null)) 595 if ((data != null) && (data["serial"] != null))
593 m_serial = data["serial"].AsInteger(); 596 m_serial = data["serial"].AsInteger();
594 if ((data != null) && (data["height"] != null)) 597 if ((data != null) && (data["height"] != null))
595 m_avatarHeight = (float)data["height"].AsReal(); 598 m_avatarHeight = (float)data["height"].AsReal();
@@ -647,7 +650,14 @@ namespace OpenSim.Framework
647 { 650 {
648 OSDArray attachs = (OSDArray)(data["attachments"]); 651 OSDArray attachs = (OSDArray)(data["attachments"]);
649 for (int i = 0; i < attachs.Count; i++) 652 for (int i = 0; i < attachs.Count; i++)
650 AppendAttachment(new AvatarAttachment((OSDMap)attachs[i])); 653 {
654 AvatarAttachment att = new AvatarAttachment((OSDMap)attachs[i]);
655 AppendAttachment(att);
656
657// m_log.DebugFormat(
658// "[AVATAR APPEARANCE]: Unpacked attachment itemID {0}, assetID {1}, point {2}",
659// att.ItemID, att.AssetID, att.AttachPoint);
660 }
651 } 661 }
652 } 662 }
653 catch (Exception e) 663 catch (Exception e)
diff --git a/OpenSim/Framework/AvatarAttachment.cs b/OpenSim/Framework/AvatarAttachment.cs
index c68d78d..07dd385 100644
--- a/OpenSim/Framework/AvatarAttachment.cs
+++ b/OpenSim/Framework/AvatarAttachment.cs
@@ -66,11 +66,11 @@ namespace OpenSim.Framework
66 return attachdata; 66 return attachdata;
67 } 67 }
68 68
69
70 public void Unpack(OSDMap args) 69 public void Unpack(OSDMap args)
71 { 70 {
72 if (args["point"] != null) 71 if (args["point"] != null)
73 AttachPoint = args["point"].AsInteger(); 72 AttachPoint = args["point"].AsInteger();
73
74 ItemID = (args["item"] != null) ? args["item"].AsUUID() : UUID.Zero; 74 ItemID = (args["item"] != null) ? args["item"].AsUUID() : UUID.Zero;
75 AssetID = (args["asset"] != null) ? args["asset"].AsUUID() : UUID.Zero; 75 AssetID = (args["asset"] != null) ? args["asset"].AsUUID() : UUID.Zero;
76 } 76 }
diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs
index 710a57d..613db1c 100644
--- a/OpenSim/Framework/ChildAgentDataUpdate.cs
+++ b/OpenSim/Framework/ChildAgentDataUpdate.cs
@@ -593,7 +593,7 @@ namespace OpenSim.Framework
593 // AgentTextures[i++] = o.AsUUID(); 593 // AgentTextures[i++] = o.AsUUID();
594 //} 594 //}
595 595
596 Appearance = new AvatarAppearance(AgentID); 596 Appearance = new AvatarAppearance();
597 597
598 // The code to unpack textures, visuals, wearables and attachments 598 // The code to unpack textures, visuals, wearables and attachments
599 // should be removed; packed appearance contains the full appearance 599 // should be removed; packed appearance contains the full appearance
@@ -635,7 +635,7 @@ namespace OpenSim.Framework
635 // end of code to remove 635 // end of code to remove
636 636
637 if (args.ContainsKey("packed_appearance") && (args["packed_appearance"]).Type == OSDType.Map) 637 if (args.ContainsKey("packed_appearance") && (args["packed_appearance"]).Type == OSDType.Map)
638 Appearance = new AvatarAppearance(AgentID,(OSDMap)args["packed_appearance"]); 638 Appearance = new AvatarAppearance((OSDMap)args["packed_appearance"]);
639 else 639 else
640 m_log.WarnFormat("[CHILDAGENTDATAUPDATE] No packed appearance"); 640 m_log.WarnFormat("[CHILDAGENTDATAUPDATE] No packed appearance");
641 641
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index 80171b4..ee3d6b6 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -51,7 +51,7 @@ namespace OpenSim.Framework
51 UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, 51 UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection,
52 bool RezSelected, bool RemoveItem, UUID fromTaskID); 52 bool RezSelected, bool RemoveItem, UUID fromTaskID);
53 53
54 public delegate UUID RezSingleAttachmentFromInv(IClientAPI remoteClient, UUID itemID, uint AttachmentPt); 54 public delegate ISceneEntity RezSingleAttachmentFromInv(IClientAPI remoteClient, UUID itemID, uint AttachmentPt);
55 55
56 public delegate void RezMultipleAttachmentsFromInv(IClientAPI remoteClient, RezMultipleAttachmentsFromInvPacket.HeaderDataBlock header, 56 public delegate void RezMultipleAttachmentsFromInv(IClientAPI remoteClient, RezMultipleAttachmentsFromInvPacket.HeaderDataBlock header,
57 RezMultipleAttachmentsFromInvPacket.ObjectDataBlock[] objects); 57 RezMultipleAttachmentsFromInvPacket.ObjectDataBlock[] objects);
@@ -790,7 +790,7 @@ namespace OpenSim.Framework
790 event DeRezObject OnDeRezObject; 790 event DeRezObject OnDeRezObject;
791 event Action<IClientAPI> OnRegionHandShakeReply; 791 event Action<IClientAPI> OnRegionHandShakeReply;
792 event GenericCall1 OnRequestWearables; 792 event GenericCall1 OnRequestWearables;
793 event GenericCall1 OnCompleteMovementToRegion; 793 event Action<IClientAPI, bool> OnCompleteMovementToRegion;
794 event UpdateAgent OnPreAgentUpdate; 794 event UpdateAgent OnPreAgentUpdate;
795 event UpdateAgent OnAgentUpdate; 795 event UpdateAgent OnAgentUpdate;
796 event AgentRequestSit OnAgentRequestSit; 796 event AgentRequestSit OnAgentRequestSit;
@@ -940,7 +940,7 @@ namespace OpenSim.Framework
940 event ScriptReset OnScriptReset; 940 event ScriptReset OnScriptReset;
941 event GetScriptRunning OnGetScriptRunning; 941 event GetScriptRunning OnGetScriptRunning;
942 event SetScriptRunning OnSetScriptRunning; 942 event SetScriptRunning OnSetScriptRunning;
943 event UpdateVector OnAutoPilotGo; 943 event Action<Vector3, bool> OnAutoPilotGo;
944 944
945 event TerrainUnacked OnUnackedTerrain; 945 event TerrainUnacked OnUnackedTerrain;
946 event ActivateGesture OnActivateGesture; 946 event ActivateGesture OnActivateGesture;
diff --git a/OpenSim/Framework/IScene.cs b/OpenSim/Framework/IScene.cs
index 1298f26..8f7a2e5 100644
--- a/OpenSim/Framework/IScene.cs
+++ b/OpenSim/Framework/IScene.cs
@@ -70,8 +70,20 @@ namespace OpenSim.Framework
70 70
71 event restart OnRestart; 71 event restart OnRestart;
72 72
73 void AddNewClient(IClientAPI client); 73 /// <summary>
74 void RemoveClient(UUID agentID); 74 /// Register the new client with the scene. The client starts off as a child agent - the later agent crossing
75 /// will promote it to a root agent.
76 /// </summary>
77 /// <param name="client"></param>
78 /// <param name="type">The type of agent to add.</param>
79 void AddNewClient(IClientAPI client, PresenceType type);
80
81 /// <summary>
82 /// Remove the given client from the scene.
83 /// </summary>
84 /// <param name="agentID"></param>
85 /// <param name="closeChildAgents">Close the neighbour child agents associated with this client.</param>
86 void RemoveClient(UUID agentID, bool closeChildAgents);
75 87
76 void Restart(); 88 void Restart();
77 //RegionInfo OtherRegionUp(RegionInfo thisRegion); 89 //RegionInfo OtherRegionUp(RegionInfo thisRegion);
diff --git a/OpenSim/Framework/ISceneEntity.cs b/OpenSim/Framework/ISceneEntity.cs
index 5ac364f..c0ea302 100644
--- a/OpenSim/Framework/ISceneEntity.cs
+++ b/OpenSim/Framework/ISceneEntity.cs
@@ -31,6 +31,7 @@ namespace OpenSim.Framework
31{ 31{
32 public interface ISceneEntity 32 public interface ISceneEntity
33 { 33 {
34 string Name { get; set; }
34 UUID UUID { get; } 35 UUID UUID { get; }
35 uint LocalId { get; } 36 uint LocalId { get; }
36 Vector3 AbsolutePosition { get; } 37 Vector3 AbsolutePosition { get; }
diff --git a/OpenSim/Framework/InventoryFolderImpl.cs b/OpenSim/Framework/InventoryFolderImpl.cs
index 29c7682..139776b 100644
--- a/OpenSim/Framework/InventoryFolderImpl.cs
+++ b/OpenSim/Framework/InventoryFolderImpl.cs
@@ -27,13 +27,15 @@
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Reflection;
31using log4net;
30using OpenMetaverse; 32using OpenMetaverse;
31 33
32namespace OpenSim.Framework 34namespace OpenSim.Framework
33{ 35{
34 public class InventoryFolderImpl : InventoryFolderBase 36 public class InventoryFolderImpl : InventoryFolderBase
35 { 37 {
36 //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 38// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
37 39
38 public static readonly string PATH_DELIMITER = "/"; 40 public static readonly string PATH_DELIMITER = "/";
39 41
@@ -402,6 +404,10 @@ namespace OpenSim.Framework
402 { 404 {
403 foreach (InventoryItemBase item in Items.Values) 405 foreach (InventoryItemBase item in Items.Values)
404 { 406 {
407// m_log.DebugFormat(
408// "[INVENTORY FOLDER IMPL]: Returning item {0} {1}, OwnerPermissions {2:X}",
409// item.Name, item.ID, item.CurrentPermissions);
410
405 itemList.Add(item); 411 itemList.Add(item);
406 } 412 }
407 } 413 }
diff --git a/OpenSim/Framework/PacketPool.cs b/OpenSim/Framework/PacketPool.cs
index 7e2860e..41d17c5 100644
--- a/OpenSim/Framework/PacketPool.cs
+++ b/OpenSim/Framework/PacketPool.cs
@@ -144,6 +144,7 @@ namespace OpenSim.Framework
144 m_log.WarnFormat("[PACKETPOOL]: Failed to get packet of type {0}", type); 144 m_log.WarnFormat("[PACKETPOOL]: Failed to get packet of type {0}", type);
145 else 145 else
146 packet.FromBytes(bytes, ref i, ref packetEnd, zeroBuffer); 146 packet.FromBytes(bytes, ref i, ref packetEnd, zeroBuffer);
147
147 return packet; 148 return packet;
148 } 149 }
149 150
@@ -160,19 +161,18 @@ namespace OpenSim.Framework
160 case PacketType.ObjectUpdate: 161 case PacketType.ObjectUpdate:
161 ObjectUpdatePacket oup = (ObjectUpdatePacket)packet; 162 ObjectUpdatePacket oup = (ObjectUpdatePacket)packet;
162 163
163 foreach (ObjectUpdatePacket.ObjectDataBlock oupod in 164 foreach (ObjectUpdatePacket.ObjectDataBlock oupod in oup.ObjectData)
164 oup.ObjectData)
165 ReturnDataBlock<ObjectUpdatePacket.ObjectDataBlock>(oupod); 165 ReturnDataBlock<ObjectUpdatePacket.ObjectDataBlock>(oupod);
166
166 oup.ObjectData = null; 167 oup.ObjectData = null;
167 break; 168 break;
168 169
169 case PacketType.ImprovedTerseObjectUpdate: 170 case PacketType.ImprovedTerseObjectUpdate:
170 ImprovedTerseObjectUpdatePacket itoup = 171 ImprovedTerseObjectUpdatePacket itoup = (ImprovedTerseObjectUpdatePacket)packet;
171 (ImprovedTerseObjectUpdatePacket)packet;
172 172
173 foreach (ImprovedTerseObjectUpdatePacket.ObjectDataBlock 173 foreach (ImprovedTerseObjectUpdatePacket.ObjectDataBlock itoupod in itoup.ObjectData)
174 itoupod in itoup.ObjectData)
175 ReturnDataBlock<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>(itoupod); 174 ReturnDataBlock<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>(itoupod);
175
176 itoup.ObjectData = null; 176 itoup.ObjectData = null;
177 break; 177 break;
178 } 178 }
@@ -194,6 +194,7 @@ namespace OpenSim.Framework
194 { 194 {
195 pool[type] = new Stack<Packet>(); 195 pool[type] = new Stack<Packet>();
196 } 196 }
197
197 if ((pool[type]).Count < 50) 198 if ((pool[type]).Count < 50)
198 { 199 {
199 (pool[type]).Push(packet); 200 (pool[type]).Push(packet);
@@ -223,6 +224,7 @@ namespace OpenSim.Framework
223 { 224 {
224 DataBlocks[typeof(T)] = new Stack<Object>(); 225 DataBlocks[typeof(T)] = new Stack<Object>();
225 } 226 }
227
226 return new T(); 228 return new T();
227 } 229 }
228 } 230 }
@@ -234,6 +236,9 @@ namespace OpenSim.Framework
234 236
235 lock (DataBlocks) 237 lock (DataBlocks)
236 { 238 {
239 if (!DataBlocks.ContainsKey(typeof(T)))
240 DataBlocks[typeof(T)] = new Stack<Object>();
241
237 if (DataBlocks[typeof(T)].Count < 50) 242 if (DataBlocks[typeof(T)].Count < 50)
238 DataBlocks[typeof(T)].Push(block); 243 DataBlocks[typeof(T)].Push(block);
239 } 244 }
diff --git a/OpenSim/Framework/UndoStack.cs b/OpenSim/Framework/PresenceType.cs
index 4cd779a..8c4c6e6 100644
--- a/OpenSim/Framework/UndoStack.cs
+++ b/OpenSim/Framework/PresenceType.cs
@@ -24,83 +24,16 @@
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 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. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27
28using System; 27using System;
29using System.Collections.Generic;
30 28
31namespace OpenSim.Framework 29namespace OpenSim.Framework
32{ 30{
33 /// <summary> 31 /// <summary>
34 /// Undo stack. Deletes entries beyond a certain capacity 32 /// Indicate the type of ScenePresence.
35 /// </summary> 33 /// </summary>
36 /// <typeparam name="T"></typeparam> 34 public enum PresenceType
37 [Serializable]
38 public class UndoStack<T>
39 { 35 {
40 private List<T> m_undolist; 36 User,
41 private int m_max; 37 Npc
42
43 public UndoStack(int capacity)
44 {
45 m_undolist = new List<T>();
46 m_max = capacity;
47 }
48
49 public bool IsFull
50 {
51 get { return m_undolist.Count >= m_max; }
52 }
53
54 public int Capacity
55 {
56 get { return m_max; }
57 }
58
59 public int Count
60 {
61 get
62 {
63 return m_undolist.Count;
64 }
65 }
66
67 public void Push(T item)
68 {
69 if (IsFull)
70 {
71 m_undolist.RemoveAt(0);
72 }
73 m_undolist.Add(item);
74 }
75
76 public T Pop()
77 {
78 if (m_undolist.Count > 0)
79 {
80 int ind = m_undolist.Count - 1;
81 T item = m_undolist[ind];
82 m_undolist.RemoveAt(ind);
83 return item;
84 }
85 else
86 throw new InvalidOperationException("Cannot pop from empty stack");
87 }
88
89 public T Peek()
90 {
91 if (m_undolist.Count > 0)
92 {
93 return m_undolist[m_undolist.Count - 1];
94 }
95 else
96 {
97 return default(T);
98 }
99 }
100
101 public void Clear()
102 {
103 m_undolist.Clear();
104 }
105 } 38 }
106} 39} \ No newline at end of file
diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs
index 83ddf95..9cfc7ed 100644
--- a/OpenSim/Framework/PrimitiveBaseShape.cs
+++ b/OpenSim/Framework/PrimitiveBaseShape.cs
@@ -879,6 +879,67 @@ namespace OpenSim.Framework
879 } 879 }
880 } 880 }
881 881
882 public ulong GetMeshKey(Vector3 size, float lod)
883 {
884 ulong hash = 5381;
885
886 hash = djb2(hash, this.PathCurve);
887 hash = djb2(hash, (byte)((byte)this.HollowShape | (byte)this.ProfileShape));
888 hash = djb2(hash, this.PathBegin);
889 hash = djb2(hash, this.PathEnd);
890 hash = djb2(hash, this.PathScaleX);
891 hash = djb2(hash, this.PathScaleY);
892 hash = djb2(hash, this.PathShearX);
893 hash = djb2(hash, this.PathShearY);
894 hash = djb2(hash, (byte)this.PathTwist);
895 hash = djb2(hash, (byte)this.PathTwistBegin);
896 hash = djb2(hash, (byte)this.PathRadiusOffset);
897 hash = djb2(hash, (byte)this.PathTaperX);
898 hash = djb2(hash, (byte)this.PathTaperY);
899 hash = djb2(hash, this.PathRevolutions);
900 hash = djb2(hash, (byte)this.PathSkew);
901 hash = djb2(hash, this.ProfileBegin);
902 hash = djb2(hash, this.ProfileEnd);
903 hash = djb2(hash, this.ProfileHollow);
904
905 // TODO: Separate scale out from the primitive shape data (after
906 // scaling is supported at the physics engine level)
907 byte[] scaleBytes = size.GetBytes();
908 for (int i = 0; i < scaleBytes.Length; i++)
909 hash = djb2(hash, scaleBytes[i]);
910
911 // Include LOD in hash, accounting for endianness
912 byte[] lodBytes = new byte[4];
913 Buffer.BlockCopy(BitConverter.GetBytes(lod), 0, lodBytes, 0, 4);
914 if (!BitConverter.IsLittleEndian)
915 {
916 Array.Reverse(lodBytes, 0, 4);
917 }
918 for (int i = 0; i < lodBytes.Length; i++)
919 hash = djb2(hash, lodBytes[i]);
920
921 // include sculpt UUID
922 if (this.SculptEntry)
923 {
924 scaleBytes = this.SculptTexture.GetBytes();
925 for (int i = 0; i < scaleBytes.Length; i++)
926 hash = djb2(hash, scaleBytes[i]);
927 }
928
929 return hash;
930 }
931
932 private ulong djb2(ulong hash, byte c)
933 {
934 return ((hash << 5) + hash) + (ulong)c;
935 }
936
937 private ulong djb2(ulong hash, ushort c)
938 {
939 hash = ((hash << 5) + hash) + (ulong)((byte)c);
940 return ((hash << 5) + hash) + (ulong)(c >> 8);
941 }
942
882 public byte[] ExtraParamsToBytes() 943 public byte[] ExtraParamsToBytes()
883 { 944 {
884// m_log.DebugFormat("[EXTRAPARAMS]: Called ExtraParamsToBytes()"); 945// m_log.DebugFormat("[EXTRAPARAMS]: Called ExtraParamsToBytes()");
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
index 460f759..c0d65ac 100644
--- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
@@ -56,7 +56,6 @@ namespace OpenSim.Framework.Servers.HttpServer
56 private volatile int NotSocketErrors = 0; 56 private volatile int NotSocketErrors = 0;
57 public volatile bool HTTPDRunning = false; 57 public volatile bool HTTPDRunning = false;
58 58
59 protected Thread m_workerThread;
60 // protected HttpListener m_httpListener; 59 // protected HttpListener m_httpListener;
61 protected CoolHTTPListener m_httpListener2; 60 protected CoolHTTPListener m_httpListener2;
62 protected Dictionary<string, XmlRpcMethod> m_rpcHandlers = new Dictionary<string, XmlRpcMethod>(); 61 protected Dictionary<string, XmlRpcMethod> m_rpcHandlers = new Dictionary<string, XmlRpcMethod>();
@@ -66,7 +65,6 @@ namespace OpenSim.Framework.Servers.HttpServer
66 protected Dictionary<string, IRequestHandler> m_streamHandlers = new Dictionary<string, IRequestHandler>(); 65 protected Dictionary<string, IRequestHandler> m_streamHandlers = new Dictionary<string, IRequestHandler>();
67 protected Dictionary<string, GenericHTTPMethod> m_HTTPHandlers = new Dictionary<string, GenericHTTPMethod>(); 66 protected Dictionary<string, GenericHTTPMethod> m_HTTPHandlers = new Dictionary<string, GenericHTTPMethod>();
68 protected Dictionary<string, IHttpAgentHandler> m_agentHandlers = new Dictionary<string, IHttpAgentHandler>(); 67 protected Dictionary<string, IHttpAgentHandler> m_agentHandlers = new Dictionary<string, IHttpAgentHandler>();
69
70 protected Dictionary<string, PollServiceEventArgs> m_pollHandlers = 68 protected Dictionary<string, PollServiceEventArgs> m_pollHandlers =
71 new Dictionary<string, PollServiceEventArgs>(); 69 new Dictionary<string, PollServiceEventArgs>();
72 70
@@ -155,7 +153,8 @@ namespace OpenSim.Framework.Servers.HttpServer
155 153
156 public List<string> GetStreamHandlerKeys() 154 public List<string> GetStreamHandlerKeys()
157 { 155 {
158 return new List<string>(m_streamHandlers.Keys); 156 lock (m_streamHandlers)
157 return new List<string>(m_streamHandlers.Keys);
159 } 158 }
160 159
161 private static string GetHandlerKey(string httpMethod, string path) 160 private static string GetHandlerKey(string httpMethod, string path)
@@ -196,7 +195,8 @@ namespace OpenSim.Framework.Servers.HttpServer
196 195
197 public List<string> GetXmlRpcHandlerKeys() 196 public List<string> GetXmlRpcHandlerKeys()
198 { 197 {
199 return new List<string>(m_rpcHandlers.Keys); 198 lock (m_rpcHandlers)
199 return new List<string>(m_rpcHandlers.Keys);
200 } 200 }
201 201
202 public bool AddHTTPHandler(string methodName, GenericHTTPMethod handler) 202 public bool AddHTTPHandler(string methodName, GenericHTTPMethod handler)
@@ -218,10 +218,10 @@ namespace OpenSim.Framework.Servers.HttpServer
218 218
219 public List<string> GetHTTPHandlerKeys() 219 public List<string> GetHTTPHandlerKeys()
220 { 220 {
221 return new List<string>(m_HTTPHandlers.Keys); 221 lock (m_HTTPHandlers)
222 return new List<string>(m_HTTPHandlers.Keys);
222 } 223 }
223 224
224
225 public bool AddPollServiceHTTPHandler(string methodName, GenericHTTPMethod handler, PollServiceEventArgs args) 225 public bool AddPollServiceHTTPHandler(string methodName, GenericHTTPMethod handler, PollServiceEventArgs args)
226 { 226 {
227 bool pollHandlerResult = false; 227 bool pollHandlerResult = false;
@@ -242,10 +242,10 @@ namespace OpenSim.Framework.Servers.HttpServer
242 242
243 public List<string> GetPollServiceHandlerKeys() 243 public List<string> GetPollServiceHandlerKeys()
244 { 244 {
245 return new List<string>(m_pollHandlers.Keys); 245 lock (m_pollHandlers)
246 return new List<string>(m_pollHandlers.Keys);
246 } 247 }
247 248
248
249 // Note that the agent string is provided simply to differentiate 249 // Note that the agent string is provided simply to differentiate
250 // the handlers - it is NOT required to be an actual agent header 250 // the handlers - it is NOT required to be an actual agent header
251 // value. 251 // value.
@@ -266,7 +266,8 @@ namespace OpenSim.Framework.Servers.HttpServer
266 266
267 public List<string> GetAgentHandlerKeys() 267 public List<string> GetAgentHandlerKeys()
268 { 268 {
269 return new List<string>(m_agentHandlers.Keys); 269 lock (m_agentHandlers)
270 return new List<string>(m_agentHandlers.Keys);
270 } 271 }
271 272
272 public bool AddLLSDHandler(string path, LLSDMethod handler) 273 public bool AddLLSDHandler(string path, LLSDMethod handler)
@@ -284,7 +285,8 @@ namespace OpenSim.Framework.Servers.HttpServer
284 285
285 public List<string> GetLLSDHandlerKeys() 286 public List<string> GetLLSDHandlerKeys()
286 { 287 {
287 return new List<string>(m_llsdHandlers.Keys); 288 lock (m_llsdHandlers)
289 return new List<string>(m_llsdHandlers.Keys);
288 } 290 }
289 291
290 public bool SetDefaultLLSDHandler(DefaultLLSDMethod handler) 292 public bool SetDefaultLLSDHandler(DefaultLLSDMethod handler)
@@ -404,14 +406,14 @@ namespace OpenSim.Framework.Servers.HttpServer
404 string requestMethod = request.HttpMethod; 406 string requestMethod = request.HttpMethod;
405 string uriString = request.RawUrl; 407 string uriString = request.RawUrl;
406 408
407 string reqnum = "unknown"; 409// string reqnum = "unknown";
408 int tickstart = Environment.TickCount; 410 int tickstart = Environment.TickCount;
409 411
410 try 412 try
411 { 413 {
412 // OpenSim.Framework.WebUtil.OSHeaderRequestID 414 // OpenSim.Framework.WebUtil.OSHeaderRequestID
413 if (request.Headers["opensim-request-id"] != null) 415// if (request.Headers["opensim-request-id"] != null)
414 reqnum = String.Format("{0}:{1}",request.RemoteIPEndPoint,request.Headers["opensim-request-id"]); 416// reqnum = String.Format("{0}:{1}",request.RemoteIPEndPoint,request.Headers["opensim-request-id"]);
415 //m_log.DebugFormat("[BASE HTTP SERVER]: <{0}> handle request for {1}",reqnum,request.RawUrl); 417 //m_log.DebugFormat("[BASE HTTP SERVER]: <{0}> handle request for {1}",reqnum,request.RawUrl);
416 418
417 Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", true); 419 Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", true);
@@ -746,7 +748,8 @@ namespace OpenSim.Framework.Servers.HttpServer
746 private bool TryGetAgentHandler(OSHttpRequest request, OSHttpResponse response, out IHttpAgentHandler agentHandler) 748 private bool TryGetAgentHandler(OSHttpRequest request, OSHttpResponse response, out IHttpAgentHandler agentHandler)
747 { 749 {
748 agentHandler = null; 750 agentHandler = null;
749 try 751
752 lock (m_agentHandlers)
750 { 753 {
751 foreach (IHttpAgentHandler handler in m_agentHandlers.Values) 754 foreach (IHttpAgentHandler handler in m_agentHandlers.Values)
752 { 755 {
@@ -757,9 +760,6 @@ namespace OpenSim.Framework.Servers.HttpServer
757 } 760 }
758 } 761 }
759 } 762 }
760 catch(KeyNotFoundException)
761 {
762 }
763 763
764 return false; 764 return false;
765 } 765 }
@@ -803,9 +803,12 @@ namespace OpenSim.Framework.Servers.HttpServer
803 803
804 XmlRpcMethod method; 804 XmlRpcMethod method;
805 bool methodWasFound; 805 bool methodWasFound;
806 bool keepAlive = false;
806 lock (m_rpcHandlers) 807 lock (m_rpcHandlers)
807 { 808 {
808 methodWasFound = m_rpcHandlers.TryGetValue(methodName, out method); 809 methodWasFound = m_rpcHandlers.TryGetValue(methodName, out method);
810 if (methodWasFound)
811 keepAlive = m_rpcHandlersKeepAlive[methodName];
809 } 812 }
810 813
811 if (methodWasFound) 814 if (methodWasFound)
@@ -824,7 +827,6 @@ namespace OpenSim.Framework.Servers.HttpServer
824 } 827 }
825 xmlRprcRequest.Params.Add(request.Headers.Get(xff)); // Param[3] 828 xmlRprcRequest.Params.Add(request.Headers.Get(xff)); // Param[3]
826 829
827
828 try 830 try
829 { 831 {
830 xmlRpcResponse = method(xmlRprcRequest, request.RemoteIPEndPoint); 832 xmlRpcResponse = method(xmlRprcRequest, request.RemoteIPEndPoint);
@@ -846,7 +848,7 @@ namespace OpenSim.Framework.Servers.HttpServer
846 } 848 }
847 849
848 // if the method wasn't found, we can't determine KeepAlive state anyway, so lets do it only here 850 // if the method wasn't found, we can't determine KeepAlive state anyway, so lets do it only here
849 response.KeepAlive = m_rpcHandlersKeepAlive[methodName]; 851 response.KeepAlive = keepAlive;
850 } 852 }
851 else 853 else
852 { 854 {
@@ -1106,7 +1108,6 @@ namespace OpenSim.Framework.Servers.HttpServer
1106 /// <returns>true if we have one, false if not</returns> 1108 /// <returns>true if we have one, false if not</returns>
1107 private bool DoWeHaveALLSDHandler(string path) 1109 private bool DoWeHaveALLSDHandler(string path)
1108 { 1110 {
1109
1110 string[] pathbase = path.Split('/'); 1111 string[] pathbase = path.Split('/');
1111 string searchquery = "/"; 1112 string searchquery = "/";
1112 1113
@@ -1122,14 +1123,12 @@ namespace OpenSim.Framework.Servers.HttpServer
1122 1123
1123 string bestMatch = null; 1124 string bestMatch = null;
1124 1125
1125 foreach (string pattern in m_llsdHandlers.Keys) 1126 lock (m_llsdHandlers)
1126 { 1127 {
1127 1128 foreach (string pattern in m_llsdHandlers.Keys)
1128 if (searchquery.StartsWith(pattern) && searchquery.Length >= pattern.Length)
1129 { 1129 {
1130 1130 if (searchquery.StartsWith(pattern) && searchquery.Length >= pattern.Length)
1131 bestMatch = pattern; 1131 bestMatch = pattern;
1132
1133 } 1132 }
1134 } 1133 }
1135 1134
@@ -1142,12 +1141,10 @@ namespace OpenSim.Framework.Servers.HttpServer
1142 1141
1143 if (String.IsNullOrEmpty(bestMatch)) 1142 if (String.IsNullOrEmpty(bestMatch))
1144 { 1143 {
1145
1146 return false; 1144 return false;
1147 } 1145 }
1148 else 1146 else
1149 { 1147 {
1150
1151 return true; 1148 return true;
1152 } 1149 }
1153 } 1150 }
@@ -1232,29 +1229,32 @@ namespace OpenSim.Framework.Servers.HttpServer
1232 1229
1233 string bestMatch = null; 1230 string bestMatch = null;
1234 1231
1235 foreach (string pattern in m_llsdHandlers.Keys) 1232 lock (m_llsdHandlers)
1236 { 1233 {
1237 if (searchquery.ToLower().StartsWith(pattern.ToLower())) 1234 foreach (string pattern in m_llsdHandlers.Keys)
1238 { 1235 {
1239 if (String.IsNullOrEmpty(bestMatch) || searchquery.Length > bestMatch.Length) 1236 if (searchquery.ToLower().StartsWith(pattern.ToLower()))
1240 { 1237 {
1241 // You have to specifically register for '/' and to get it, you must specificaly request it 1238 if (String.IsNullOrEmpty(bestMatch) || searchquery.Length > bestMatch.Length)
1242 // 1239 {
1243 if (pattern == "/" && searchquery == "/" || pattern != "/") 1240 // You have to specifically register for '/' and to get it, you must specificaly request it
1244 bestMatch = pattern; 1241 //
1242 if (pattern == "/" && searchquery == "/" || pattern != "/")
1243 bestMatch = pattern;
1244 }
1245 } 1245 }
1246 } 1246 }
1247 } 1247
1248 1248 if (String.IsNullOrEmpty(bestMatch))
1249 if (String.IsNullOrEmpty(bestMatch)) 1249 {
1250 { 1250 llsdHandler = null;
1251 llsdHandler = null; 1251 return false;
1252 return false; 1252 }
1253 } 1253 else
1254 else 1254 {
1255 { 1255 llsdHandler = m_llsdHandlers[bestMatch];
1256 llsdHandler = m_llsdHandlers[bestMatch]; 1256 return true;
1257 return true; 1257 }
1258 } 1258 }
1259 } 1259 }
1260 1260
@@ -1816,7 +1816,8 @@ namespace OpenSim.Framework.Servers.HttpServer
1816 1816
1817 //m_log.DebugFormat("[BASE HTTP SERVER]: Removing handler key {0}", handlerKey); 1817 //m_log.DebugFormat("[BASE HTTP SERVER]: Removing handler key {0}", handlerKey);
1818 1818
1819 lock (m_streamHandlers) m_streamHandlers.Remove(handlerKey); 1819 lock (m_streamHandlers)
1820 m_streamHandlers.Remove(handlerKey);
1820 } 1821 }
1821 1822
1822 public void RemoveHTTPHandler(string httpMethod, string path) 1823 public void RemoveHTTPHandler(string httpMethod, string path)
@@ -1848,17 +1849,16 @@ namespace OpenSim.Framework.Servers.HttpServer
1848 1849
1849 public bool RemoveAgentHandler(string agent, IHttpAgentHandler handler) 1850 public bool RemoveAgentHandler(string agent, IHttpAgentHandler handler)
1850 { 1851 {
1851 try 1852 lock (m_agentHandlers)
1852 { 1853 {
1853 if (handler == m_agentHandlers[agent]) 1854 IHttpAgentHandler foundHandler;
1855
1856 if (m_agentHandlers.TryGetValue(agent, out foundHandler) && foundHandler == handler)
1854 { 1857 {
1855 m_agentHandlers.Remove(agent); 1858 m_agentHandlers.Remove(agent);
1856 return true; 1859 return true;
1857 } 1860 }
1858 } 1861 }
1859 catch(KeyNotFoundException)
1860 {
1861 }
1862 1862
1863 return false; 1863 return false;
1864 } 1864 }
@@ -1876,18 +1876,16 @@ namespace OpenSim.Framework.Servers.HttpServer
1876 1876
1877 public bool RemoveLLSDHandler(string path, LLSDMethod handler) 1877 public bool RemoveLLSDHandler(string path, LLSDMethod handler)
1878 { 1878 {
1879 try 1879 lock (m_llsdHandlers)
1880 { 1880 {
1881 if (handler == m_llsdHandlers[path]) 1881 LLSDMethod foundHandler;
1882
1883 if (m_llsdHandlers.TryGetValue(path, out foundHandler) && foundHandler == handler)
1882 { 1884 {
1883 m_llsdHandlers.Remove(path); 1885 m_llsdHandlers.Remove(path);
1884 return true; 1886 return true;
1885 } 1887 }
1886 } 1888 }
1887 catch (KeyNotFoundException)
1888 {
1889 // This is an exception to prevent crashing because of invalid code
1890 }
1891 1889
1892 return false; 1890 return false;
1893 } 1891 }
diff --git a/OpenSim/Framework/Tests/AgentCircuitDataTest.cs b/OpenSim/Framework/Tests/AgentCircuitDataTest.cs
index 05d8469..0dce414 100644
--- a/OpenSim/Framework/Tests/AgentCircuitDataTest.cs
+++ b/OpenSim/Framework/Tests/AgentCircuitDataTest.cs
@@ -64,7 +64,7 @@ namespace OpenSim.Framework.Tests
64 SecureSessionId = UUID.Random(); 64 SecureSessionId = UUID.Random();
65 SessionId = UUID.Random(); 65 SessionId = UUID.Random();
66 66
67 AvAppearance = new AvatarAppearance(AgentId); 67 AvAppearance = new AvatarAppearance();
68 VisualParams = new byte[218]; 68 VisualParams = new byte[218];
69 69
70 //body 70 //body
diff --git a/OpenSim/Framework/Tests/AgentCircuitManagerTests.cs b/OpenSim/Framework/Tests/AgentCircuitManagerTests.cs
index 6c98897..9615f1b 100644
--- a/OpenSim/Framework/Tests/AgentCircuitManagerTests.cs
+++ b/OpenSim/Framework/Tests/AgentCircuitManagerTests.cs
@@ -68,7 +68,7 @@ namespace OpenSim.Framework.Tests
68 68
69 m_agentCircuitData1 = new AgentCircuitData(); 69 m_agentCircuitData1 = new AgentCircuitData();
70 m_agentCircuitData1.AgentID = AgentId1; 70 m_agentCircuitData1.AgentID = AgentId1;
71 m_agentCircuitData1.Appearance = new AvatarAppearance(AgentId1); 71 m_agentCircuitData1.Appearance = new AvatarAppearance();
72 m_agentCircuitData1.BaseFolder = BaseFolder; 72 m_agentCircuitData1.BaseFolder = BaseFolder;
73 m_agentCircuitData1.CapsPath = CapsPath; 73 m_agentCircuitData1.CapsPath = CapsPath;
74 m_agentCircuitData1.child = false; 74 m_agentCircuitData1.child = false;
@@ -83,7 +83,7 @@ namespace OpenSim.Framework.Tests
83 83
84 m_agentCircuitData2 = new AgentCircuitData(); 84 m_agentCircuitData2 = new AgentCircuitData();
85 m_agentCircuitData2.AgentID = AgentId2; 85 m_agentCircuitData2.AgentID = AgentId2;
86 m_agentCircuitData2.Appearance = new AvatarAppearance(AgentId2); 86 m_agentCircuitData2.Appearance = new AvatarAppearance();
87 m_agentCircuitData2.BaseFolder = BaseFolder; 87 m_agentCircuitData2.BaseFolder = BaseFolder;
88 m_agentCircuitData2.CapsPath = CapsPath; 88 m_agentCircuitData2.CapsPath = CapsPath;
89 m_agentCircuitData2.child = false; 89 m_agentCircuitData2.child = false;
diff --git a/OpenSim/Framework/Tests/UtilTest.cs b/OpenSim/Framework/Tests/UtilTest.cs
index 5eac411..c5a20e7 100644
--- a/OpenSim/Framework/Tests/UtilTest.cs
+++ b/OpenSim/Framework/Tests/UtilTest.cs
@@ -61,7 +61,7 @@ namespace OpenSim.Framework.Tests
61 "Magnitude of vector was incorrect."); 61 "Magnitude of vector was incorrect.");
62 62
63 TestDelegate d = delegate() { Util.GetNormalizedVector(v1); }; 63 TestDelegate d = delegate() { Util.GetNormalizedVector(v1); };
64 bool causesArgumentException = TestHelper.AssertThisDelegateCausesArgumentException(d); 64 bool causesArgumentException = TestHelpers.AssertThisDelegateCausesArgumentException(d);
65 Assert.That(causesArgumentException, Is.True, 65 Assert.That(causesArgumentException, Is.True,
66 "Getting magnitude of null vector did not cause argument exception."); 66 "Getting magnitude of null vector did not cause argument exception.");
67 67
@@ -94,12 +94,12 @@ namespace OpenSim.Framework.Tests
94 "Magnitude of vector was incorrect."); 94 "Magnitude of vector was incorrect.");
95 95
96 TestDelegate d = delegate() { Util.GetNormalizedVector(v1); }; 96 TestDelegate d = delegate() { Util.GetNormalizedVector(v1); };
97 bool causesArgumentException = TestHelper.AssertThisDelegateCausesArgumentException(d); 97 bool causesArgumentException = TestHelpers.AssertThisDelegateCausesArgumentException(d);
98 Assert.That(causesArgumentException, Is.True, 98 Assert.That(causesArgumentException, Is.True,
99 "Getting magnitude of null vector did not cause argument exception."); 99 "Getting magnitude of null vector did not cause argument exception.");
100 100
101 d = delegate() { Util.GetNormalizedVector(v2); }; 101 d = delegate() { Util.GetNormalizedVector(v2); };
102 causesArgumentException = TestHelper.AssertThisDelegateCausesArgumentException(d); 102 causesArgumentException = TestHelpers.AssertThisDelegateCausesArgumentException(d);
103 Assert.That(causesArgumentException, Is.True, 103 Assert.That(causesArgumentException, Is.True,
104 "Getting magnitude of null vector did not cause argument exception."); 104 "Getting magnitude of null vector did not cause argument exception.");
105 } 105 }
@@ -122,7 +122,7 @@ namespace OpenSim.Framework.Tests
122 "Magnitude of vector was incorrect."); 122 "Magnitude of vector was incorrect.");
123 123
124 TestDelegate d = delegate() { Util.GetNormalizedVector(v1); }; 124 TestDelegate d = delegate() { Util.GetNormalizedVector(v1); };
125 bool causesArgumentException = TestHelper.AssertThisDelegateCausesArgumentException(d); 125 bool causesArgumentException = TestHelpers.AssertThisDelegateCausesArgumentException(d);
126 Assert.That(causesArgumentException, Is.True, 126 Assert.That(causesArgumentException, Is.True,
127 "Getting magnitude of null vector did not cause argument exception."); 127 "Getting magnitude of null vector did not cause argument exception.");
128 128
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index b8b1039..2d58807 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -56,8 +56,13 @@ namespace OpenSim.Framework
56 /// <summary> 56 /// <summary>
57 /// The method used by Util.FireAndForget for asynchronously firing events 57 /// The method used by Util.FireAndForget for asynchronously firing events
58 /// </summary> 58 /// </summary>
59 /// <remarks>
60 /// None is used to execute the method in the same thread that made the call. It should only be used by regression
61 /// test code that relies on predictable event ordering.
62 /// </remarks>
59 public enum FireAndForgetMethod 63 public enum FireAndForgetMethod
60 { 64 {
65 None,
61 UnsafeQueueUserWorkItem, 66 UnsafeQueueUserWorkItem,
62 QueueUserWorkItem, 67 QueueUserWorkItem,
63 BeginInvoke, 68 BeginInvoke,
@@ -89,7 +94,8 @@ namespace OpenSim.Framework
89 public static readonly Regex UUIDPattern 94 public static readonly Regex UUIDPattern
90 = new Regex("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"); 95 = new Regex("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$");
91 96
92 public static FireAndForgetMethod FireAndForgetMethod = FireAndForgetMethod.SmartThreadPool; 97 public static FireAndForgetMethod DefaultFireAndForgetMethod = FireAndForgetMethod.SmartThreadPool;
98 public static FireAndForgetMethod FireAndForgetMethod = DefaultFireAndForgetMethod;
93 99
94 /// <summary> 100 /// <summary>
95 /// Gets the name of the directory where the current running executable 101 /// Gets the name of the directory where the current running executable
@@ -1511,25 +1517,47 @@ namespace OpenSim.Framework
1511 1517
1512 public static void FireAndForget(System.Threading.WaitCallback callback, object obj) 1518 public static void FireAndForget(System.Threading.WaitCallback callback, object obj)
1513 { 1519 {
1520 // When OpenSim interacts with a database or sends data over the wire, it must send this in en_US culture
1521 // so that we don't encounter problems where, for instance, data is saved with a culture that uses commas
1522 // for decimals places but is read by a culture that treats commas as number seperators.
1523 WaitCallback realCallback = delegate(object o)
1524 {
1525 Culture.SetCurrentCulture();
1526
1527 try
1528 {
1529 callback(o);
1530 }
1531 catch (Exception e)
1532 {
1533 m_log.ErrorFormat(
1534 "[UTIL]: Continuing after async_call_method thread terminated with exception {0}{1}",
1535 e.Message, e.StackTrace);
1536 }
1537 };
1538
1514 switch (FireAndForgetMethod) 1539 switch (FireAndForgetMethod)
1515 { 1540 {
1541 case FireAndForgetMethod.None:
1542 realCallback.Invoke(obj);
1543 break;
1516 case FireAndForgetMethod.UnsafeQueueUserWorkItem: 1544 case FireAndForgetMethod.UnsafeQueueUserWorkItem:
1517 ThreadPool.UnsafeQueueUserWorkItem(callback, obj); 1545 ThreadPool.UnsafeQueueUserWorkItem(realCallback, obj);
1518 break; 1546 break;
1519 case FireAndForgetMethod.QueueUserWorkItem: 1547 case FireAndForgetMethod.QueueUserWorkItem:
1520 ThreadPool.QueueUserWorkItem(callback, obj); 1548 ThreadPool.QueueUserWorkItem(realCallback, obj);
1521 break; 1549 break;
1522 case FireAndForgetMethod.BeginInvoke: 1550 case FireAndForgetMethod.BeginInvoke:
1523 FireAndForgetWrapper wrapper = FireAndForgetWrapper.Instance; 1551 FireAndForgetWrapper wrapper = FireAndForgetWrapper.Instance;
1524 wrapper.FireAndForget(callback, obj); 1552 wrapper.FireAndForget(realCallback, obj);
1525 break; 1553 break;
1526 case FireAndForgetMethod.SmartThreadPool: 1554 case FireAndForgetMethod.SmartThreadPool:
1527 if (m_ThreadPool == null) 1555 if (m_ThreadPool == null)
1528 m_ThreadPool = new SmartThreadPool(2000, 15, 2); 1556 m_ThreadPool = new SmartThreadPool(2000, 15, 2);
1529 m_ThreadPool.QueueWorkItem(SmartThreadPoolCallback, new object[] { callback, obj }); 1557 m_ThreadPool.QueueWorkItem(SmartThreadPoolCallback, new object[] { realCallback, obj });
1530 break; 1558 break;
1531 case FireAndForgetMethod.Thread: 1559 case FireAndForgetMethod.Thread:
1532 Thread thread = new Thread(delegate(object o) { callback(o); }); 1560 Thread thread = new Thread(delegate(object o) { realCallback(o); });
1533 thread.Start(obj); 1561 thread.Start(obj);
1534 break; 1562 break;
1535 default: 1563 default:
diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs
index 90ab982..971c0b7 100644
--- a/OpenSim/Framework/WebUtil.cs
+++ b/OpenSim/Framework/WebUtil.cs
@@ -908,15 +908,6 @@ namespace OpenSim.Framework
908 } 908 }
909 } 909 }
910 910
911 public class SynchronousRestObjectPoster
912 {
913 [Obsolete]
914 public static TResponse BeginPostObject<TRequest, TResponse>(string verb, string requestUrl, TRequest obj)
915 {
916 return SynchronousRestObjectRequester.MakeRequest<TRequest, TResponse>(verb, requestUrl, obj);
917 }
918 }
919
920 public class SynchronousRestObjectRequester 911 public class SynchronousRestObjectRequester
921 { 912 {
922 private static readonly ILog m_log = 913 private static readonly ILog m_log =
@@ -989,9 +980,6 @@ namespace OpenSim.Framework
989 { 980 {
990 using (HttpWebResponse resp = (HttpWebResponse)request.GetResponse()) 981 using (HttpWebResponse resp = (HttpWebResponse)request.GetResponse())
991 { 982 {
992 if (resp.StatusCode == HttpStatusCode.NotFound)
993 return deserial;
994
995 if (resp.ContentLength != 0) 983 if (resp.ContentLength != 0)
996 { 984 {
997 Stream respStream = resp.GetResponseStream(); 985 Stream respStream = resp.GetResponseStream();
@@ -1001,9 +989,19 @@ namespace OpenSim.Framework
1001 } 989 }
1002 else 990 else
1003 m_log.DebugFormat("[SynchronousRestObjectRequester]: Oops! no content found in response stream from {0} {1}", requestUrl, verb); 991 m_log.DebugFormat("[SynchronousRestObjectRequester]: Oops! no content found in response stream from {0} {1}", requestUrl, verb);
1004
1005 } 992 }
1006 } 993 }
994 catch (WebException e)
995 {
996 HttpWebResponse hwr = (HttpWebResponse)e.Response;
997
998 if (hwr != null && hwr.StatusCode == HttpStatusCode.NotFound)
999 return deserial;
1000 else
1001 m_log.ErrorFormat(
1002 "[SynchronousRestObjectRequester]: WebException {0} {1} {2} {3}",
1003 requestUrl, typeof(TResponse).ToString(), e.Message, e.StackTrace);
1004 }
1007 catch (System.InvalidOperationException) 1005 catch (System.InvalidOperationException)
1008 { 1006 {
1009 // This is what happens when there is invalid XML 1007 // This is what happens when there is invalid XML