aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/AssetBase.cs11
-rw-r--r--OpenSim/Framework/AvatarAppearance.cs313
-rw-r--r--OpenSim/Framework/AvatarWearable.cs18
-rw-r--r--OpenSim/Framework/ChildAgentDataUpdate.cs18
-rw-r--r--OpenSim/Framework/Communications/RestClient.cs2
-rw-r--r--OpenSim/Framework/Console/CommandConsole.cs19
-rw-r--r--OpenSim/Framework/EstateSettings.cs23
-rw-r--r--OpenSim/Framework/IClientAPI.cs31
-rw-r--r--OpenSim/Framework/IImprovedAssetCache.cs1
-rw-r--r--OpenSim/Framework/ILandObject.cs1
-rw-r--r--OpenSim/Framework/IMoneyModule.cs3
-rw-r--r--OpenSim/Framework/LandData.cs4
-rw-r--r--OpenSim/Framework/LocklessQueue.cs8
-rw-r--r--OpenSim/Framework/Monitoring/BaseStatsCollector.cs25
-rw-r--r--OpenSim/Framework/Monitoring/Watchdog.cs2
-rw-r--r--OpenSim/Framework/OSChatMessage.cs21
-rw-r--r--OpenSim/Framework/ObjectChangeData.cs80
-rw-r--r--OpenSim/Framework/ParcelMediaCommandEnum.cs2
-rw-r--r--OpenSim/Framework/PluginLoader.cs17
-rw-r--r--OpenSim/Framework/PrimitiveBaseShape.cs38
-rw-r--r--OpenSim/Framework/PriorityQueue.cs20
-rw-r--r--OpenSim/Framework/RegionInfo.cs13
-rw-r--r--OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs133
-rw-r--r--OpenSim/Framework/RegionSettings.cs22
-rw-r--r--OpenSim/Framework/Servers/BaseOpenSimServer.cs14
-rw-r--r--OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs86
-rw-r--r--OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs4
-rw-r--r--OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs137
-rw-r--r--OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs175
-rw-r--r--OpenSim/Framework/Servers/ServerBase.cs4
-rw-r--r--OpenSim/Framework/Servers/Tests/OSHttpTests.cs4
-rw-r--r--OpenSim/Framework/Servers/VersionInfo.cs6
-rw-r--r--OpenSim/Framework/TaskInventoryDictionary.cs189
-rw-r--r--OpenSim/Framework/TaskInventoryItem.cs2
-rw-r--r--OpenSim/Framework/Tests/MundaneFrameworkTests.cs6
-rw-r--r--OpenSim/Framework/ThrottleOutPacketType.cs2
-rw-r--r--OpenSim/Framework/Util.cs46
-rw-r--r--OpenSim/Framework/WearableCacheItem.cs157
-rw-r--r--OpenSim/Framework/WebUtil.cs33
39 files changed, 1386 insertions, 304 deletions
diff --git a/OpenSim/Framework/AssetBase.cs b/OpenSim/Framework/AssetBase.cs
index d2c6c57..5da8e11 100644
--- a/OpenSim/Framework/AssetBase.cs
+++ b/OpenSim/Framework/AssetBase.cs
@@ -60,6 +60,8 @@ namespace OpenSim.Framework
60 /// </summary> 60 /// </summary>
61 private AssetMetadata m_metadata; 61 private AssetMetadata m_metadata;
62 62
63 private int m_uploadAttempts;
64
63 // This is needed for .NET serialization!!! 65 // This is needed for .NET serialization!!!
64 // Do NOT "Optimize" away! 66 // Do NOT "Optimize" away!
65 public AssetBase() 67 public AssetBase()
@@ -148,7 +150,8 @@ namespace OpenSim.Framework
148 Type == (sbyte)AssetType.SnapshotFolder || 150 Type == (sbyte)AssetType.SnapshotFolder ||
149 Type == (sbyte)AssetType.TrashFolder || 151 Type == (sbyte)AssetType.TrashFolder ||
150 Type == (sbyte)AssetType.ImageJPEG || 152 Type == (sbyte)AssetType.ImageJPEG ||
151 Type == (sbyte) AssetType.ImageTGA || 153 Type == (sbyte)AssetType.ImageTGA ||
154 Type == (sbyte)AssetType.Mesh ||
152 Type == (sbyte) AssetType.LSLBytecode); 155 Type == (sbyte) AssetType.LSLBytecode);
153 } 156 }
154 } 157 }
@@ -198,6 +201,12 @@ namespace OpenSim.Framework
198 set { m_metadata.Type = value; } 201 set { m_metadata.Type = value; }
199 } 202 }
200 203
204 public int UploadAttempts
205 {
206 get { return m_uploadAttempts; }
207 set { m_uploadAttempts = value; }
208 }
209
201 /// <summary> 210 /// <summary>
202 /// Is this a region only asset, or does this exist on the asset server also 211 /// Is this a region only asset, or does this exist on the asset server also
203 /// </summary> 212 /// </summary>
diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs
index 157feb5..b7a0adf 100644
--- a/OpenSim/Framework/AvatarAppearance.cs
+++ b/OpenSim/Framework/AvatarAppearance.cs
@@ -40,8 +40,17 @@ namespace OpenSim.Framework
40 /// </summary> 40 /// </summary>
41 public class AvatarAppearance 41 public class AvatarAppearance
42 { 42 {
43 // SL box diferent to size
44 const float AVBOXAJUST = 0.2f;
45 // constrains for ubitode physics
46 const float AVBOXMINX = 0.2f;
47 const float AVBOXMINY = 0.3f;
48 const float AVBOXMINZ = 1.2f;
49
43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 50 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
44 51
52 // this is viewer capabilities and weared things dependent
53 // should be only used as initial default value ( V1 viewers )
45 public readonly static int VISUALPARAM_COUNT = 218; 54 public readonly static int VISUALPARAM_COUNT = 218;
46 55
47 public readonly static int TEXTURE_COUNT = 21; 56 public readonly static int TEXTURE_COUNT = 21;
@@ -53,7 +62,12 @@ namespace OpenSim.Framework
53 protected AvatarWearable[] m_wearables; 62 protected AvatarWearable[] m_wearables;
54 protected Dictionary<int, List<AvatarAttachment>> m_attachments; 63 protected Dictionary<int, List<AvatarAttachment>> m_attachments;
55 protected float m_avatarHeight = 0; 64 protected float m_avatarHeight = 0;
56 protected UUID[] m_texturehashes; 65 protected Vector3 m_avatarSize = new Vector3(0.45f, 0.6f, 1.9f); // sl Z cloud value
66 protected Vector3 m_avatarBoxSize = new Vector3(0.45f, 0.6f, 1.9f);
67 protected float m_avatarFeetOffset = 0;
68 protected float m_avatarAnimOffset = 0;
69 protected WearableCacheItem[] m_cacheitems;
70 protected bool m_cacheItemsDirty = true;
57 71
58 public virtual int Serial 72 public virtual int Serial
59 { 73 {
@@ -67,6 +81,21 @@ namespace OpenSim.Framework
67 set { m_visualparams = value; } 81 set { m_visualparams = value; }
68 } 82 }
69 83
84 public virtual Vector3 AvatarSize
85 {
86 get { return m_avatarSize; }
87 }
88
89 public virtual Vector3 AvatarBoxSize
90 {
91 get { return m_avatarBoxSize; }
92 }
93
94 public virtual float AvatarFeetOffset
95 {
96 get { return m_avatarFeetOffset + m_avatarAnimOffset; }
97 }
98
70 public virtual Primitive.TextureEntry Texture 99 public virtual Primitive.TextureEntry Texture
71 { 100 {
72 get { return m_texture; } 101 get { return m_texture; }
@@ -88,6 +117,18 @@ namespace OpenSim.Framework
88 get { return m_avatarHeight; } 117 get { return m_avatarHeight; }
89 set { m_avatarHeight = value; } 118 set { m_avatarHeight = value; }
90 } 119 }
120
121 public virtual WearableCacheItem[] WearableCacheItems
122 {
123 get { return m_cacheitems; }
124 set { m_cacheitems = value; }
125 }
126
127 public virtual bool WearableCacheItemsDirty
128 {
129 get { return m_cacheItemsDirty; }
130 set { m_cacheItemsDirty = value; }
131 }
91 132
92 public AvatarAppearance() 133 public AvatarAppearance()
93 { 134 {
@@ -97,10 +138,9 @@ namespace OpenSim.Framework
97 SetDefaultWearables(); 138 SetDefaultWearables();
98 SetDefaultTexture(); 139 SetDefaultTexture();
99 SetDefaultParams(); 140 SetDefaultParams();
100 SetHeight(); 141// SetHeight();
142 SetSize(new Vector3(0.45f,0.6f,1.9f));
101 m_attachments = new Dictionary<int, List<AvatarAttachment>>(); 143 m_attachments = new Dictionary<int, List<AvatarAttachment>>();
102
103 ResetTextureHashes();
104 } 144 }
105 145
106 public AvatarAppearance(OSDMap map) 146 public AvatarAppearance(OSDMap map)
@@ -108,7 +148,35 @@ namespace OpenSim.Framework
108// m_log.WarnFormat("[AVATAR APPEARANCE]: create appearance from OSDMap"); 148// m_log.WarnFormat("[AVATAR APPEARANCE]: create appearance from OSDMap");
109 149
110 Unpack(map); 150 Unpack(map);
111 SetHeight(); 151// SetHeight(); done in Unpack
152 }
153
154 public AvatarAppearance(AvatarWearable[] wearables, Primitive.TextureEntry textureEntry, byte[] visualParams)
155 {
156// m_log.WarnFormat("[AVATAR APPEARANCE] create initialized appearance");
157
158 m_serial = 0;
159
160 if (wearables != null)
161 m_wearables = wearables;
162 else
163 SetDefaultWearables();
164
165 if (textureEntry != null)
166 m_texture = textureEntry;
167 else
168 SetDefaultTexture();
169
170 if (visualParams != null)
171 m_visualparams = visualParams;
172 else
173 SetDefaultParams();
174
175// SetHeight();
176 if(m_avatarHeight == 0)
177 SetSize(new Vector3(0.45f,0.6f,1.9f));
178
179 m_attachments = new Dictionary<int, List<AvatarAttachment>>();
112 } 180 }
113 181
114 public AvatarAppearance(AvatarAppearance appearance) : this(appearance, true) 182 public AvatarAppearance(AvatarAppearance appearance) : this(appearance, true)
@@ -125,11 +193,10 @@ namespace OpenSim.Framework
125 SetDefaultWearables(); 193 SetDefaultWearables();
126 SetDefaultTexture(); 194 SetDefaultTexture();
127 SetDefaultParams(); 195 SetDefaultParams();
128 SetHeight(); 196// SetHeight();
197 SetSize(new Vector3(0.45f, 0.6f, 1.9f));
129 m_attachments = new Dictionary<int, List<AvatarAttachment>>(); 198 m_attachments = new Dictionary<int, List<AvatarAttachment>>();
130 199
131 ResetTextureHashes();
132
133 return; 200 return;
134 } 201 }
135 202
@@ -145,10 +212,6 @@ namespace OpenSim.Framework
145 SetWearable(i,appearance.Wearables[i]); 212 SetWearable(i,appearance.Wearables[i]);
146 } 213 }
147 214
148 m_texturehashes = new UUID[AvatarAppearance.TEXTURE_COUNT];
149 for (int i = 0; i < AvatarAppearance.TEXTURE_COUNT; i++)
150 m_texturehashes[i] = new UUID(appearance.m_texturehashes[i]);
151
152 m_texture = null; 215 m_texture = null;
153 if (appearance.Texture != null) 216 if (appearance.Texture != null)
154 { 217 {
@@ -160,7 +223,8 @@ namespace OpenSim.Framework
160 if (appearance.VisualParams != null) 223 if (appearance.VisualParams != null)
161 m_visualparams = (byte[])appearance.VisualParams.Clone(); 224 m_visualparams = (byte[])appearance.VisualParams.Clone();
162 225
163 m_avatarHeight = appearance.m_avatarHeight; 226// m_avatarHeight = appearance.m_avatarHeight;
227 SetSize(appearance.AvatarSize);
164 228
165 // Copy the attachment, force append mode since that ensures consistency 229 // Copy the attachment, force append mode since that ensures consistency
166 m_attachments = new Dictionary<int, List<AvatarAttachment>>(); 230 m_attachments = new Dictionary<int, List<AvatarAttachment>>();
@@ -183,37 +247,6 @@ namespace OpenSim.Framework
183 } 247 }
184 } 248 }
185 249
186 public void ResetTextureHashes()
187 {
188 m_texturehashes = new UUID[AvatarAppearance.TEXTURE_COUNT];
189 for (uint i = 0; i < AvatarAppearance.TEXTURE_COUNT; i++)
190 m_texturehashes[i] = UUID.Zero;
191 }
192
193 public UUID GetTextureHash(int textureIndex)
194 {
195 return m_texturehashes[NormalizeBakedTextureIndex(textureIndex)];
196 }
197
198 public void SetTextureHash(int textureIndex, UUID textureHash)
199 {
200 m_texturehashes[NormalizeBakedTextureIndex(textureIndex)] = new UUID(textureHash);
201 }
202
203 /// <summary>
204 /// Normalizes the texture index to the actual bake index, this is done to
205 /// accommodate older viewers that send the BAKE_INDICES index rather than
206 /// the actual texture index
207 /// </summary>
208 private int NormalizeBakedTextureIndex(int textureIndex)
209 {
210 // Earlier viewer send the index into the baked index array, just trying to be careful here
211 if (textureIndex < BAKE_INDICES.Length)
212 return BAKE_INDICES[textureIndex];
213
214 return textureIndex;
215 }
216
217 public void ClearWearables() 250 public void ClearWearables()
218 { 251 {
219 m_wearables = new AvatarWearable[AvatarWearable.MAX_WEARABLES]; 252 m_wearables = new AvatarWearable[AvatarWearable.MAX_WEARABLES];
@@ -237,7 +270,12 @@ namespace OpenSim.Framework
237 m_serial = 0; 270 m_serial = 0;
238 271
239 SetDefaultTexture(); 272 SetDefaultTexture();
240 ResetTextureHashes(); 273
274 //for (int i = 0; i < BAKE_INDICES.Length; i++)
275 // {
276 // int idx = BAKE_INDICES[i];
277 // m_texture.FaceTextures[idx].TextureID = UUID.Zero;
278 // }
241 } 279 }
242 280
243 protected virtual void SetDefaultParams() 281 protected virtual void SetDefaultParams()
@@ -249,6 +287,21 @@ namespace OpenSim.Framework
249// } 287// }
250 } 288 }
251 289
290 /// <summary>
291 /// Invalidate all of the baked textures in the appearance, useful
292 /// if you know that none are valid
293 /// </summary>
294 public virtual void ResetBakedTextures()
295 {
296 SetDefaultTexture();
297
298 //for (int i = 0; i < BAKE_INDICES.Length; i++)
299 // {
300 // int idx = BAKE_INDICES[i];
301 // m_texture.FaceTextures[idx].TextureID = UUID.Zero;
302 // }
303 }
304
252 protected virtual void SetDefaultTexture() 305 protected virtual void SetDefaultTexture()
253 { 306 {
254 m_texture = new Primitive.TextureEntry(new UUID(AppearanceManager.DEFAULT_AVATAR_TEXTURE)); 307 m_texture = new Primitive.TextureEntry(new UUID(AppearanceManager.DEFAULT_AVATAR_TEXTURE));
@@ -313,22 +366,33 @@ namespace OpenSim.Framework
313 // made. We determine if any of the visual parameters actually 366 // made. We determine if any of the visual parameters actually
314 // changed to know if the appearance should be saved later 367 // changed to know if the appearance should be saved later
315 bool changed = false; 368 bool changed = false;
316 for (int i = 0; i < AvatarAppearance.VISUALPARAM_COUNT; i++) 369
370 int newsize = visualParams.Length;
371
372 if (newsize != m_visualparams.Length)
373 {
374 changed = true;
375 m_visualparams = (byte[])visualParams.Clone();
376 }
377 else
317 { 378 {
318 if (visualParams[i] != m_visualparams[i]) 379
380 for (int i = 0; i < newsize; i++)
319 { 381 {
320// DEBUG ON 382 if (visualParams[i] != m_visualparams[i])
321// m_log.WarnFormat("[AVATARAPPEARANCE] vparams changed [{0}] {1} ==> {2}", 383 {
322// i,m_visualparams[i],visualParams[i]); 384 // DEBUG ON
323// DEBUG OFF 385 // m_log.WarnFormat("[AVATARAPPEARANCE] vparams changed [{0}] {1} ==> {2}",
324 m_visualparams[i] = visualParams[i]; 386 // i,m_visualparams[i],visualParams[i]);
325 changed = true; 387 // DEBUG OFF
388 m_visualparams[i] = visualParams[i];
389 changed = true;
390 }
326 } 391 }
327 } 392 }
328
329 // Reset the height if the visual parameters actually changed 393 // Reset the height if the visual parameters actually changed
330 if (changed) 394// if (changed)
331 SetHeight(); 395// SetHeight();
332 396
333 return changed; 397 return changed;
334 } 398 }
@@ -344,6 +408,7 @@ namespace OpenSim.Framework
344 /// </summary> 408 /// </summary>
345 public virtual void SetHeight() 409 public virtual void SetHeight()
346 { 410 {
411/*
347 // Start with shortest possible female avatar height 412 // Start with shortest possible female avatar height
348 m_avatarHeight = 1.14597f; 413 m_avatarHeight = 1.14597f;
349 // Add offset for male avatars 414 // Add offset for male avatars
@@ -356,6 +421,35 @@ namespace OpenSim.Framework
356 + 0.07f * (float)m_visualparams[(int)VPElement.SHOES_PLATFORM_HEIGHT] / 255.0f 421 + 0.07f * (float)m_visualparams[(int)VPElement.SHOES_PLATFORM_HEIGHT] / 255.0f
357 + 0.08f * (float)m_visualparams[(int)VPElement.SHOES_HEEL_HEIGHT] / 255.0f 422 + 0.08f * (float)m_visualparams[(int)VPElement.SHOES_HEEL_HEIGHT] / 255.0f
358 + 0.076f * (float)m_visualparams[(int)VPElement.SHAPE_NECK_LENGTH] / 255.0f; 423 + 0.076f * (float)m_visualparams[(int)VPElement.SHAPE_NECK_LENGTH] / 255.0f;
424*/
425 }
426
427 public void SetSize(Vector3 avSize)
428 {
429 if (avSize.X > 32f)
430 avSize.X = 32f;
431 else if (avSize.X < 0.1f)
432 avSize.X = 0.1f;
433
434 if (avSize.Y > 32f)
435 avSize.Y = 32f;
436 else if (avSize.Y < 0.1f)
437 avSize.Y = 0.1f;
438 if (avSize.Z > 32f)
439 avSize.Z = 32f;
440 else if (avSize.Z < 0.1f)
441 avSize.Z = 0.1f;
442
443 m_avatarSize = avSize;
444 m_avatarBoxSize = avSize;
445 m_avatarBoxSize.Z += AVBOXAJUST;
446 if (m_avatarBoxSize.X < AVBOXMINX)
447 m_avatarBoxSize.X = AVBOXMINX;
448 if (m_avatarBoxSize.Y < AVBOXMINY)
449 m_avatarBoxSize.Y = AVBOXMINY;
450 if (m_avatarBoxSize.Z < AVBOXMINZ)
451 m_avatarBoxSize.Z = AVBOXMINZ;
452 m_avatarHeight = m_avatarSize.Z;
359 } 453 }
360 454
361 public virtual void SetWearable(int wearableId, AvatarWearable wearable) 455 public virtual void SetWearable(int wearableId, AvatarWearable wearable)
@@ -386,7 +480,8 @@ namespace OpenSim.Framework
386 } 480 }
387 481
388 s += "Visual Params: "; 482 s += "Visual Params: ";
389 for (uint j = 0; j < AvatarAppearance.VISUALPARAM_COUNT; j++) 483 // for (uint j = 0; j < AvatarAppearance.VISUALPARAM_COUNT; j++)
484 for (uint j = 0; j < m_visualparams.Length; j++)
390 s += String.Format("{0},",m_visualparams[j]); 485 s += String.Format("{0},",m_visualparams[j]);
391 s += "\n"; 486 s += "\n";
392 487
@@ -402,18 +497,16 @@ namespace OpenSim.Framework
402 /// </remarks> 497 /// </remarks>
403 public List<AvatarAttachment> GetAttachments() 498 public List<AvatarAttachment> GetAttachments()
404 { 499 {
405 List<AvatarAttachment> alist = new List<AvatarAttachment>();
406
407 lock (m_attachments) 500 lock (m_attachments)
408 { 501 {
502 List<AvatarAttachment> alist = new List<AvatarAttachment>();
409 foreach (KeyValuePair<int, List<AvatarAttachment>> kvp in m_attachments) 503 foreach (KeyValuePair<int, List<AvatarAttachment>> kvp in m_attachments)
410 { 504 {
411 foreach (AvatarAttachment attach in kvp.Value) 505 foreach (AvatarAttachment attach in kvp.Value)
412 alist.Add(new AvatarAttachment(attach)); 506 alist.Add(new AvatarAttachment(attach));
413 } 507 }
414 } 508 return alist;
415 509 }
416 return alist;
417 } 510 }
418 511
419 internal void AppendAttachment(AvatarAttachment attach) 512 internal void AppendAttachment(AvatarAttachment attach)
@@ -557,7 +650,6 @@ namespace OpenSim.Framework
557 return kvp.Key; 650 return kvp.Key;
558 } 651 }
559 } 652 }
560
561 return 0; 653 return 0;
562 } 654 }
563 655
@@ -607,12 +699,6 @@ namespace OpenSim.Framework
607 data["serial"] = OSD.FromInteger(m_serial); 699 data["serial"] = OSD.FromInteger(m_serial);
608 data["height"] = OSD.FromReal(m_avatarHeight); 700 data["height"] = OSD.FromReal(m_avatarHeight);
609 701
610 // Hashes
611 OSDArray hashes = new OSDArray(AvatarAppearance.TEXTURE_COUNT);
612 for (uint i = 0; i < AvatarAppearance.TEXTURE_COUNT; i++)
613 hashes.Add(OSD.FromUUID(m_texturehashes[i]));
614 data["hashes"] = hashes;
615
616 // Wearables 702 // Wearables
617 OSDArray wears = new OSDArray(AvatarWearable.MAX_WEARABLES); 703 OSDArray wears = new OSDArray(AvatarWearable.MAX_WEARABLES);
618 for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) 704 for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++)
@@ -634,12 +720,14 @@ namespace OpenSim.Framework
634 OSDBinary visualparams = new OSDBinary(m_visualparams); 720 OSDBinary visualparams = new OSDBinary(m_visualparams);
635 data["visualparams"] = visualparams; 721 data["visualparams"] = visualparams;
636 722
637 // Attachments 723 lock (m_attachments)
638 List<AvatarAttachment> attachments = GetAttachments(); 724 {
639 OSDArray attachs = new OSDArray(attachments.Count); 725 // Attachments
640 foreach (AvatarAttachment attach in GetAttachments()) 726 OSDArray attachs = new OSDArray(m_attachments.Count);
641 attachs.Add(attach.Pack()); 727 foreach (AvatarAttachment attach in GetAttachments())
642 data["attachments"] = attachs; 728 attachs.Add(attach.Pack());
729 data["attachments"] = attachs;
730 }
643 731
644 return data; 732 return data;
645 } 733 }
@@ -653,29 +741,11 @@ namespace OpenSim.Framework
653 if ((data != null) && (data["serial"] != null)) 741 if ((data != null) && (data["serial"] != null))
654 m_serial = data["serial"].AsInteger(); 742 m_serial = data["serial"].AsInteger();
655 if ((data != null) && (data["height"] != null)) 743 if ((data != null) && (data["height"] != null))
656 m_avatarHeight = (float)data["height"].AsReal(); 744// m_avatarHeight = (float)data["height"].AsReal();
745 SetSize(new Vector3(0.45f,0.6f, (float)data["height"].AsReal()));
657 746
658 try 747 try
659 { 748 {
660 // Hashes
661 m_texturehashes = new UUID[AvatarAppearance.TEXTURE_COUNT];
662 if ((data != null) && (data["hashes"] != null) && (data["hashes"]).Type == OSDType.Array)
663 {
664 OSDArray hashes = (OSDArray)(data["hashes"]);
665 for (int i = 0; i < AvatarAppearance.TEXTURE_COUNT; i++)
666 {
667 UUID hashID = UUID.Zero;
668 if (i < hashes.Count && hashes[i] != null)
669 hashID = hashes[i].AsUUID();
670 m_texturehashes[i] = hashID;
671 }
672 }
673 else
674 {
675 for (uint i = 0; i < AvatarAppearance.TEXTURE_COUNT; i++)
676 m_texturehashes[i] = UUID.Zero;
677 }
678
679 // Wearables 749 // Wearables
680 SetDefaultWearables(); 750 SetDefaultWearables();
681 if ((data != null) && (data["wearables"] != null) && (data["wearables"]).Type == OSDType.Array) 751 if ((data != null) && (data["wearables"] != null) && (data["wearables"]).Type == OSDType.Array)
@@ -1505,7 +1575,58 @@ namespace OpenSim.Framework
1505 SHAPE_EYELID_INNER_CORNER_UP = 214, 1575 SHAPE_EYELID_INNER_CORNER_UP = 214,
1506 SKIRT_SKIRT_RED = 215, 1576 SKIRT_SKIRT_RED = 215,
1507 SKIRT_SKIRT_GREEN = 216, 1577 SKIRT_SKIRT_GREEN = 216,
1508 SKIRT_SKIRT_BLUE = 217 1578 SKIRT_SKIRT_BLUE = 217,
1579
1580 /// <summary>
1581 /// Avatar Physics section. These are 0 type visual params which get transmitted.
1582 /// </summary>
1583
1584 /// <summary>
1585 /// Breast Part 1
1586 /// </summary>
1587 BREAST_PHYSICS_MASS = 218,
1588 BREAST_PHYSICS_GRAVITY = 219,
1589 BREAST_PHYSICS_DRAG = 220,
1590 BREAST_PHYSICS_UPDOWN_MAX_EFFECT = 221,
1591 BREAST_PHYSICS_UPDOWN_SPRING = 222,
1592 BREAST_PHYSICS_UPDOWN_GAIN = 223,
1593 BREAST_PHYSICS_UPDOWN_DAMPING = 224,
1594 BREAST_PHYSICS_INOUT_MAX_EFFECT = 225,
1595 BREAST_PHYSICS_INOUT_SPRING = 226,
1596 BREAST_PHYSICS_INOUT_GAIN = 227,
1597 BREAST_PHYSICS_INOUT_DAMPING = 228,
1598 /// <summary>
1599 /// Belly
1600 /// </summary>
1601 BELLY_PHYISCS_MASS = 229,
1602 BELLY_PHYSICS_GRAVITY = 230,
1603 BELLY_PHYSICS_DRAG = 231,
1604 BELLY_PHYISCS_UPDOWN_MAX_EFFECT = 232,
1605 BELLY_PHYSICS_UPDOWN_SPRING = 233,
1606 BELLY_PHYSICS_UPDOWN_GAIN = 234,
1607 BELLY_PHYSICS_UPDOWN_DAMPING = 235,
1608
1609 /// <summary>
1610 /// Butt
1611 /// </summary>
1612 BUTT_PHYSICS_MASS = 236,
1613 BUTT_PHYSICS_GRAVITY = 237,
1614 BUTT_PHYSICS_DRAG = 238,
1615 BUTT_PHYSICS_UPDOWN_MAX_EFFECT = 239,
1616 BUTT_PHYSICS_UPDOWN_SPRING = 240,
1617 BUTT_PHYSICS_UPDOWN_GAIN = 241,
1618 BUTT_PHYSICS_UPDOWN_DAMPING = 242,
1619 BUTT_PHYSICS_LEFTRIGHT_MAX_EFFECT = 243,
1620 BUTT_PHYSICS_LEFTRIGHT_SPRING = 244,
1621 BUTT_PHYSICS_LEFTRIGHT_GAIN = 245,
1622 BUTT_PHYSICS_LEFTRIGHT_DAMPING = 246,
1623 /// <summary>
1624 /// Breast Part 2
1625 /// </summary>
1626 BREAST_PHYSICS_LEFTRIGHT_MAX_EFFECT = 247,
1627 BREAST_PHYSICS_LEFTRIGHT_SPRING= 248,
1628 BREAST_PHYSICS_LEFTRIGHT_GAIN = 249,
1629 BREAST_PHYSICS_LEFTRIGHT_DAMPING = 250
1509 } 1630 }
1510 #endregion 1631 #endregion
1511 } 1632 }
diff --git a/OpenSim/Framework/AvatarWearable.cs b/OpenSim/Framework/AvatarWearable.cs
index 8e27596..aee295a 100644
--- a/OpenSim/Framework/AvatarWearable.cs
+++ b/OpenSim/Framework/AvatarWearable.cs
@@ -62,9 +62,14 @@ namespace OpenSim.Framework
62 public static readonly int UNDERSHIRT = 10; 62 public static readonly int UNDERSHIRT = 10;
63 public static readonly int UNDERPANTS = 11; 63 public static readonly int UNDERPANTS = 11;
64 public static readonly int SKIRT = 12; 64 public static readonly int SKIRT = 12;
65
66 public static readonly int MAX_BASICWEARABLES = 13;
67
65 public static readonly int ALPHA = 13; 68 public static readonly int ALPHA = 13;
66 public static readonly int TATTOO = 14; 69 public static readonly int TATTOO = 14;
70// public static readonly int PHYSICS = 15;
67 71
72 // public static readonly int MAX_WEARABLES = 16;
68 public static readonly int MAX_WEARABLES = 15; 73 public static readonly int MAX_WEARABLES = 15;
69 74
70 public static readonly UUID DEFAULT_BODY_ITEM = new UUID("66c41e39-38f9-f75a-024e-585989bfaba9"); 75 public static readonly UUID DEFAULT_BODY_ITEM = new UUID("66c41e39-38f9-f75a-024e-585989bfaba9");
@@ -219,7 +224,7 @@ namespace OpenSim.Framework
219 { 224 {
220 get 225 get
221 { 226 {
222 AvatarWearable[] defaultWearables = new AvatarWearable[MAX_WEARABLES]; //should be 15 of these 227 AvatarWearable[] defaultWearables = new AvatarWearable[MAX_WEARABLES];
223 for (int i = 0; i < MAX_WEARABLES; i++) 228 for (int i = 0; i < MAX_WEARABLES; i++)
224 { 229 {
225 defaultWearables[i] = new AvatarWearable(); 230 defaultWearables[i] = new AvatarWearable();
@@ -242,10 +247,13 @@ namespace OpenSim.Framework
242 247
243// // Alpha 248// // Alpha
244// defaultWearables[ALPHA].Add(DEFAULT_ALPHA_ITEM, DEFAULT_ALPHA_ASSET); 249// defaultWearables[ALPHA].Add(DEFAULT_ALPHA_ITEM, DEFAULT_ALPHA_ASSET);
245 250
246// // Tattoo 251 // // Tattoo
247// defaultWearables[TATTOO].Add(DEFAULT_TATTOO_ITEM, DEFAULT_TATTOO_ASSET); 252 // defaultWearables[TATTOO].Add(DEFAULT_TATTOO_ITEM, DEFAULT_TATTOO_ASSET);
248 253
254 // // Physics
255 // defaultWearables[PHYSICS].Add(DEFAULT_TATTOO_ITEM, DEFAULT_TATTOO_ASSET);
256
249 return defaultWearables; 257 return defaultWearables;
250 } 258 }
251 } 259 }
diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs
index dfe60aa..8c32734 100644
--- a/OpenSim/Framework/ChildAgentDataUpdate.cs
+++ b/OpenSim/Framework/ChildAgentDataUpdate.cs
@@ -229,12 +229,14 @@ namespace OpenSim.Framework
229 229
230 public class ControllerData 230 public class ControllerData
231 { 231 {
232 public UUID ObjectID;
232 public UUID ItemID; 233 public UUID ItemID;
233 public uint IgnoreControls; 234 public uint IgnoreControls;
234 public uint EventControls; 235 public uint EventControls;
235 236
236 public ControllerData(UUID item, uint ignore, uint ev) 237 public ControllerData(UUID obj, UUID item, uint ignore, uint ev)
237 { 238 {
239 ObjectID = obj;
238 ItemID = item; 240 ItemID = item;
239 IgnoreControls = ignore; 241 IgnoreControls = ignore;
240 EventControls = ev; 242 EventControls = ev;
@@ -248,6 +250,7 @@ namespace OpenSim.Framework
248 public OSDMap PackUpdateMessage() 250 public OSDMap PackUpdateMessage()
249 { 251 {
250 OSDMap controldata = new OSDMap(); 252 OSDMap controldata = new OSDMap();
253 controldata["object"] = OSD.FromUUID(ObjectID);
251 controldata["item"] = OSD.FromUUID(ItemID); 254 controldata["item"] = OSD.FromUUID(ItemID);
252 controldata["ignore"] = OSD.FromInteger(IgnoreControls); 255 controldata["ignore"] = OSD.FromInteger(IgnoreControls);
253 controldata["event"] = OSD.FromInteger(EventControls); 256 controldata["event"] = OSD.FromInteger(EventControls);
@@ -258,6 +261,8 @@ namespace OpenSim.Framework
258 261
259 public void UnpackUpdateMessage(OSDMap args) 262 public void UnpackUpdateMessage(OSDMap args)
260 { 263 {
264 if (args["object"] != null)
265 ObjectID = args["object"].AsUUID();
261 if (args["item"] != null) 266 if (args["item"] != null)
262 ItemID = args["item"].AsUUID(); 267 ItemID = args["item"].AsUUID();
263 if (args["ignore"] != null) 268 if (args["ignore"] != null)
@@ -310,6 +315,8 @@ namespace OpenSim.Framework
310 public Animation AnimState = null; 315 public Animation AnimState = null;
311 316
312 public UUID GranterID; 317 public UUID GranterID;
318 public UUID ParentPart;
319 public Vector3 SitOffset;
313 320
314 // Appearance 321 // Appearance
315 public AvatarAppearance Appearance; 322 public AvatarAppearance Appearance;
@@ -480,6 +487,10 @@ namespace OpenSim.Framework
480 } 487 }
481 args["attach_objects"] = attObjs; 488 args["attach_objects"] = attObjs;
482 } 489 }
490
491 args["parent_part"] = OSD.FromUUID(ParentPart);
492 args["sit_offset"] = OSD.FromString(SitOffset.ToString());
493
483 return args; 494 return args;
484 } 495 }
485 496
@@ -711,6 +722,11 @@ namespace OpenSim.Framework
711 } 722 }
712 } 723 }
713 } 724 }
725
726 if (args["parent_part"] != null)
727 ParentPart = args["parent_part"].AsUUID();
728 if (args["sit_offset"] != null)
729 Vector3.TryParse(args["sit_offset"].AsString(), out SitOffset);
714 } 730 }
715 731
716 public AgentData() 732 public AgentData()
diff --git a/OpenSim/Framework/Communications/RestClient.cs b/OpenSim/Framework/Communications/RestClient.cs
index 97b3b60..42c0b18 100644
--- a/OpenSim/Framework/Communications/RestClient.cs
+++ b/OpenSim/Framework/Communications/RestClient.cs
@@ -363,7 +363,7 @@ namespace OpenSim.Framework.Communications
363 _request = (HttpWebRequest) WebRequest.Create(buildUri()); 363 _request = (HttpWebRequest) WebRequest.Create(buildUri());
364 _request.KeepAlive = false; 364 _request.KeepAlive = false;
365 _request.ContentType = "application/xml"; 365 _request.ContentType = "application/xml";
366 _request.Timeout = 900000; 366 _request.Timeout = 30000;
367 _request.Method = RequestMethod; 367 _request.Method = RequestMethod;
368 _asyncException = null; 368 _asyncException = null;
369 _request.ContentLength = src.Length; 369 _request.ContentLength = src.Length;
diff --git a/OpenSim/Framework/Console/CommandConsole.cs b/OpenSim/Framework/Console/CommandConsole.cs
index b9f402a..9490013 100644
--- a/OpenSim/Framework/Console/CommandConsole.cs
+++ b/OpenSim/Framework/Console/CommandConsole.cs
@@ -83,7 +83,7 @@ namespace OpenSim.Framework.Console
83 = "To enter an argument that contains spaces, surround the argument with double quotes.\nFor example, show object name \"My long object name\"\n"; 83 = "To enter an argument that contains spaces, surround the argument with double quotes.\nFor example, show object name \"My long object name\"\n";
84 84
85 public const string ItemHelpText 85 public const string ItemHelpText
86= @"For more information, type 'help all' to get a list of all commands, 86= @"For more information, type 'help' to get a list of all commands,
87 or type help <item>' where <item> is one of the following:"; 87 or type help <item>' where <item> is one of the following:";
88 88
89 /// <value> 89 /// <value>
@@ -116,12 +116,14 @@ namespace OpenSim.Framework.Console
116 if (helpParts.Count == 0) 116 if (helpParts.Count == 0)
117 { 117 {
118 help.Add(GeneralHelpText); 118 help.Add(GeneralHelpText);
119 help.Add(ItemHelpText); 119 help.AddRange(CollectAllCommandsHelp());
120 help.AddRange(CollectModulesHelp(tree));
121 } 120 }
122 else if (helpParts.Count == 1 && helpParts[0] == "all") 121 else if (helpParts.Count == 1 && helpParts[0] == "categories")
123 { 122 {
124 help.AddRange(CollectAllCommandsHelp()); 123 help.Add(""); // Will become a newline.
124 help.Add(GeneralHelpText);
125 help.Add(ItemHelpText);
126 help.AddRange(CollectModulesHelp(tree));
125 } 127 }
126 else 128 else
127 { 129 {
@@ -145,8 +147,11 @@ namespace OpenSim.Framework.Console
145 { 147 {
146 foreach (List<CommandInfo> commands in m_modulesCommands.Values) 148 foreach (List<CommandInfo> commands in m_modulesCommands.Values)
147 { 149 {
148 var ourHelpText = commands.ConvertAll(c => string.Format("{0} - {1}", c.help_text, c.long_help)); 150 foreach (CommandInfo c in commands)
149 help.AddRange(ourHelpText); 151 {
152 if (c.long_help != String.Empty)
153 help.Add(string.Format("{0} - {1}", c.help_text, c.long_help));
154 }
150 } 155 }
151 } 156 }
152 157
diff --git a/OpenSim/Framework/EstateSettings.cs b/OpenSim/Framework/EstateSettings.cs
index a02993d..5ddbd61 100644
--- a/OpenSim/Framework/EstateSettings.cs
+++ b/OpenSim/Framework/EstateSettings.cs
@@ -362,11 +362,30 @@ namespace OpenSim.Framework
362 return false; 362 return false;
363 } 363 }
364 364
365 public bool IsBanned(UUID avatarID) 365 public bool IsBanned(UUID avatarID, int userFlags)
366 { 366 {
367 foreach (EstateBan ban in l_EstateBans) 367 foreach (EstateBan ban in l_EstateBans)
368 if (ban.BannedUserID == avatarID) 368 if (ban.BannedUserID == avatarID)
369 return true; 369 return true;
370
371 if (!IsEstateManagerOrOwner(avatarID) && !HasAccess(avatarID))
372 {
373 if (DenyMinors)
374 {
375 if ((userFlags & 32) == 0)
376 {
377 return true;
378 }
379 }
380 if (DenyAnonymous)
381 {
382 if ((userFlags & 4) == 0)
383 {
384 return true;
385 }
386 }
387 }
388
370 return false; 389 return false;
371 } 390 }
372 391
@@ -374,7 +393,7 @@ namespace OpenSim.Framework
374 { 393 {
375 if (ban == null) 394 if (ban == null)
376 return; 395 return;
377 if (!IsBanned(ban.BannedUserID)) 396 if (!IsBanned(ban.BannedUserID, 32)) //Ignore age-based bans
378 l_EstateBans.Add(ban); 397 l_EstateBans.Add(ban);
379 } 398 }
380 399
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index 65f8395..6c9e7c9 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -64,14 +64,15 @@ namespace OpenSim.Framework
64 64
65 public delegate void NetworkStats(int inPackets, int outPackets, int unAckedBytes); 65 public delegate void NetworkStats(int inPackets, int outPackets, int unAckedBytes);
66 66
67 public delegate void SetAppearance(IClientAPI remoteClient, Primitive.TextureEntry textureEntry, byte[] visualParams, Vector3 AvSize, WearableCacheItem[] CacheItems);
67 public delegate void CachedTextureRequest(IClientAPI remoteClient, int serial, List<CachedTextureRequestArg> cachedTextureRequest); 68 public delegate void CachedTextureRequest(IClientAPI remoteClient, int serial, List<CachedTextureRequestArg> cachedTextureRequest);
68 69
69 public delegate void SetAppearance(IClientAPI remoteClient, Primitive.TextureEntry textureEntry, byte[] visualParams, List<CachedTextureRequestArg> cachedTextureData);
70
71 public delegate void StartAnim(IClientAPI remoteClient, UUID animID); 70 public delegate void StartAnim(IClientAPI remoteClient, UUID animID);
72 71
73 public delegate void StopAnim(IClientAPI remoteClient, UUID animID); 72 public delegate void StopAnim(IClientAPI remoteClient, UUID animID);
74 73
74 public delegate void ChangeAnim(UUID animID, bool addOrRemove, bool sendPack);
75
75 public delegate void LinkObjects(IClientAPI remoteClient, uint parent, List<uint> children); 76 public delegate void LinkObjects(IClientAPI remoteClient, uint parent, List<uint> children);
76 77
77 public delegate void DelinkObjects(List<uint> primIds, IClientAPI client); 78 public delegate void DelinkObjects(List<uint> primIds, IClientAPI client);
@@ -132,6 +133,8 @@ namespace OpenSim.Framework
132 133
133 public delegate void UpdateVector(uint localID, Vector3 pos, IClientAPI remoteClient); 134 public delegate void UpdateVector(uint localID, Vector3 pos, IClientAPI remoteClient);
134 135
136 public delegate void ClientChangeObject(uint localID, object data ,IClientAPI remoteClient);
137
135 public delegate void UpdatePrimRotation(uint localID, Quaternion rot, IClientAPI remoteClient); 138 public delegate void UpdatePrimRotation(uint localID, Quaternion rot, IClientAPI remoteClient);
136 139
137 public delegate void UpdatePrimSingleRotation(uint localID, Quaternion rot, IClientAPI remoteClient); 140 public delegate void UpdatePrimSingleRotation(uint localID, Quaternion rot, IClientAPI remoteClient);
@@ -268,6 +271,9 @@ namespace OpenSim.Framework
268 public delegate void MoveInventoryItem( 271 public delegate void MoveInventoryItem(
269 IClientAPI remoteClient, List<InventoryItemBase> items); 272 IClientAPI remoteClient, List<InventoryItemBase> items);
270 273
274 public delegate void MoveItemsAndLeaveCopy(
275 IClientAPI remoteClient, List<InventoryItemBase> items, UUID destFolder);
276
271 public delegate void RemoveInventoryItem( 277 public delegate void RemoveInventoryItem(
272 IClientAPI remoteClient, List<UUID> itemIDs); 278 IClientAPI remoteClient, List<UUID> itemIDs);
273 279
@@ -443,6 +449,7 @@ namespace OpenSim.Framework
443 public delegate void ClassifiedInfoRequest(UUID classifiedID, IClientAPI client); 449 public delegate void ClassifiedInfoRequest(UUID classifiedID, IClientAPI client);
444 public delegate void ClassifiedInfoUpdate(UUID classifiedID, uint category, string name, string description, UUID parcelID, uint parentEstate, UUID snapshotID, Vector3 globalPos, byte classifiedFlags, int price, IClientAPI client); 450 public delegate void ClassifiedInfoUpdate(UUID classifiedID, uint category, string name, string description, UUID parcelID, uint parentEstate, UUID snapshotID, Vector3 globalPos, byte classifiedFlags, int price, IClientAPI client);
445 public delegate void ClassifiedDelete(UUID classifiedID, IClientAPI client); 451 public delegate void ClassifiedDelete(UUID classifiedID, IClientAPI client);
452 public delegate void ClassifiedGodDelete(UUID classifiedID, UUID queryID, IClientAPI client);
446 453
447 public delegate void EventNotificationAddRequest(uint EventID, IClientAPI client); 454 public delegate void EventNotificationAddRequest(uint EventID, IClientAPI client);
448 public delegate void EventNotificationRemoveRequest(uint EventID, IClientAPI client); 455 public delegate void EventNotificationRemoveRequest(uint EventID, IClientAPI client);
@@ -465,9 +472,9 @@ namespace OpenSim.Framework
465 472
466 public delegate void AgentFOV(IClientAPI client, float verticalAngle); 473 public delegate void AgentFOV(IClientAPI client, float verticalAngle);
467 474
468 public delegate void MuteListEntryUpdate(IClientAPI client, UUID MuteID, string Name, int Flags,UUID AgentID); 475 public delegate void MuteListEntryUpdate(IClientAPI client, UUID MuteID, string Name, int type, uint flags);
469 476
470 public delegate void MuteListEntryRemove(IClientAPI client, UUID MuteID, string Name, UUID AgentID); 477 public delegate void MuteListEntryRemove(IClientAPI client, UUID MuteID, string Name);
471 478
472 public delegate void AvatarInterestReply(IClientAPI client,UUID target, uint wantmask, string wanttext, uint skillsmask, string skillstext, string languages); 479 public delegate void AvatarInterestReply(IClientAPI client,UUID target, uint wantmask, string wanttext, uint skillsmask, string skillstext, string languages);
473 480
@@ -505,6 +512,7 @@ namespace OpenSim.Framework
505 public delegate void SimWideDeletesDelegate(IClientAPI client,UUID agentID, int flags, UUID targetID); 512 public delegate void SimWideDeletesDelegate(IClientAPI client,UUID agentID, int flags, UUID targetID);
506 513
507 public delegate void SendPostcard(IClientAPI client); 514 public delegate void SendPostcard(IClientAPI client);
515 public delegate void ChangeInventoryItemFlags(IClientAPI client, UUID itemID, uint flags);
508 516
509 #endregion 517 #endregion
510 518
@@ -794,6 +802,7 @@ namespace OpenSim.Framework
794 event ObjectDrop OnObjectDrop; 802 event ObjectDrop OnObjectDrop;
795 event StartAnim OnStartAnim; 803 event StartAnim OnStartAnim;
796 event StopAnim OnStopAnim; 804 event StopAnim OnStopAnim;
805 event ChangeAnim OnChangeAnim;
797 event LinkObjects OnLinkObjects; 806 event LinkObjects OnLinkObjects;
798 event DelinkObjects OnDelinkObjects; 807 event DelinkObjects OnDelinkObjects;
799 event RequestMapBlocks OnRequestMapBlocks; 808 event RequestMapBlocks OnRequestMapBlocks;
@@ -858,6 +867,7 @@ namespace OpenSim.Framework
858 event RequestObjectPropertiesFamily OnRequestObjectPropertiesFamily; 867 event RequestObjectPropertiesFamily OnRequestObjectPropertiesFamily;
859 event UpdatePrimFlags OnUpdatePrimFlags; 868 event UpdatePrimFlags OnUpdatePrimFlags;
860 event UpdatePrimTexture OnUpdatePrimTexture; 869 event UpdatePrimTexture OnUpdatePrimTexture;
870 event ClientChangeObject onClientChangeObject;
861 event UpdateVector OnUpdatePrimGroupPosition; 871 event UpdateVector OnUpdatePrimGroupPosition;
862 event UpdateVector OnUpdatePrimSinglePosition; 872 event UpdateVector OnUpdatePrimSinglePosition;
863 event UpdatePrimRotation OnUpdatePrimGroupRotation; 873 event UpdatePrimRotation OnUpdatePrimGroupRotation;
@@ -882,6 +892,7 @@ namespace OpenSim.Framework
882 event RequestTaskInventory OnRequestTaskInventory; 892 event RequestTaskInventory OnRequestTaskInventory;
883 event UpdateInventoryItem OnUpdateInventoryItem; 893 event UpdateInventoryItem OnUpdateInventoryItem;
884 event CopyInventoryItem OnCopyInventoryItem; 894 event CopyInventoryItem OnCopyInventoryItem;
895 event MoveItemsAndLeaveCopy OnMoveItemsAndLeaveCopy;
885 event MoveInventoryItem OnMoveInventoryItem; 896 event MoveInventoryItem OnMoveInventoryItem;
886 event RemoveInventoryFolder OnRemoveInventoryFolder; 897 event RemoveInventoryFolder OnRemoveInventoryFolder;
887 event RemoveInventoryItem OnRemoveInventoryItem; 898 event RemoveInventoryItem OnRemoveInventoryItem;
@@ -1000,7 +1011,7 @@ namespace OpenSim.Framework
1000 event ClassifiedInfoRequest OnClassifiedInfoRequest; 1011 event ClassifiedInfoRequest OnClassifiedInfoRequest;
1001 event ClassifiedInfoUpdate OnClassifiedInfoUpdate; 1012 event ClassifiedInfoUpdate OnClassifiedInfoUpdate;
1002 event ClassifiedDelete OnClassifiedDelete; 1013 event ClassifiedDelete OnClassifiedDelete;
1003 event ClassifiedDelete OnClassifiedGodDelete; 1014 event ClassifiedGodDelete OnClassifiedGodDelete;
1004 1015
1005 event EventNotificationAddRequest OnEventNotificationAddRequest; 1016 event EventNotificationAddRequest OnEventNotificationAddRequest;
1006 event EventNotificationRemoveRequest OnEventNotificationRemoveRequest; 1017 event EventNotificationRemoveRequest OnEventNotificationRemoveRequest;
@@ -1039,11 +1050,12 @@ namespace OpenSim.Framework
1039 event GroupVoteHistoryRequest OnGroupVoteHistoryRequest; 1050 event GroupVoteHistoryRequest OnGroupVoteHistoryRequest;
1040 event SimWideDeletesDelegate OnSimWideDeletes; 1051 event SimWideDeletesDelegate OnSimWideDeletes;
1041 event SendPostcard OnSendPostcard; 1052 event SendPostcard OnSendPostcard;
1053 event ChangeInventoryItemFlags OnChangeInventoryItemFlags;
1042 event MuteListEntryUpdate OnUpdateMuteListEntry; 1054 event MuteListEntryUpdate OnUpdateMuteListEntry;
1043 event MuteListEntryRemove OnRemoveMuteListEntry; 1055 event MuteListEntryRemove OnRemoveMuteListEntry;
1044 event GodlikeMessage onGodlikeMessage; 1056 event GodlikeMessage onGodlikeMessage;
1045 event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate; 1057 event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate;
1046 1058 event GenericCall2 OnUpdateThrottles;
1047 /// <summary> 1059 /// <summary>
1048 /// Set the debug level at which packet output should be printed to console. 1060 /// Set the debug level at which packet output should be printed to console.
1049 /// </summary> 1061 /// </summary>
@@ -1064,7 +1076,7 @@ namespace OpenSim.Framework
1064 /// If true, attempts the close without checking active status. You do not want to try this except as a last 1076 /// If true, attempts the close without checking active status. You do not want to try this except as a last
1065 /// ditch attempt where Active == false but the ScenePresence still exists. 1077 /// ditch attempt where Active == false but the ScenePresence still exists.
1066 /// </param> 1078 /// </param>
1067 void Close(bool force); 1079 void Close(bool sendStop, bool force);
1068 1080
1069 void Kick(string message); 1081 void Kick(string message);
1070 1082
@@ -1167,6 +1179,8 @@ namespace OpenSim.Framework
1167 1179
1168 void SetChildAgentThrottle(byte[] throttle); 1180 void SetChildAgentThrottle(byte[] throttle);
1169 1181
1182 void SetAgentThrottleSilent(int throttle, int setting);
1183
1170 void SendAvatarDataImmediate(ISceneEntity avatar); 1184 void SendAvatarDataImmediate(ISceneEntity avatar);
1171 1185
1172 /// <summary> 1186 /// <summary>
@@ -1190,6 +1204,7 @@ namespace OpenSim.Framework
1190 /// </summary> 1204 /// </summary>
1191 /// <param name="Item"></param> 1205 /// <param name="Item"></param>
1192 void SendInventoryItemCreateUpdate(InventoryItemBase Item, uint callbackId); 1206 void SendInventoryItemCreateUpdate(InventoryItemBase Item, uint callbackId);
1207 void SendInventoryItemCreateUpdate(InventoryItemBase Item, UUID transactionID, uint callbackId);
1193 1208
1194 void SendRemoveInventoryItem(UUID itemID); 1209 void SendRemoveInventoryItem(UUID itemID);
1195 1210
@@ -1209,7 +1224,7 @@ namespace OpenSim.Framework
1209 /// <param name="node"></param> 1224 /// <param name="node"></param>
1210 void SendBulkUpdateInventory(InventoryNodeBase node); 1225 void SendBulkUpdateInventory(InventoryNodeBase node);
1211 1226
1212 void SendXferPacket(ulong xferID, uint packet, byte[] data); 1227 void SendXferPacket(ulong xferID, uint packet, byte[] data, bool isTaskInventory);
1213 1228
1214 void SendAbortXferPacket(ulong xferID); 1229 void SendAbortXferPacket(ulong xferID);
1215 1230
diff --git a/OpenSim/Framework/IImprovedAssetCache.cs b/OpenSim/Framework/IImprovedAssetCache.cs
index 251215a..a0b8b55 100644
--- a/OpenSim/Framework/IImprovedAssetCache.cs
+++ b/OpenSim/Framework/IImprovedAssetCache.cs
@@ -33,6 +33,7 @@ namespace OpenSim.Framework
33 { 33 {
34 void Cache(AssetBase asset); 34 void Cache(AssetBase asset);
35 AssetBase Get(string id); 35 AssetBase Get(string id);
36 bool Check(string id);
36 void Expire(string id); 37 void Expire(string id);
37 void Clear(); 38 void Clear();
38 } 39 }
diff --git a/OpenSim/Framework/ILandObject.cs b/OpenSim/Framework/ILandObject.cs
index 4f98d7b..7a24d1e 100644
--- a/OpenSim/Framework/ILandObject.cs
+++ b/OpenSim/Framework/ILandObject.cs
@@ -70,6 +70,7 @@ namespace OpenSim.Framework
70 void UpdateLandProperties(LandUpdateArgs args, IClientAPI remote_client); 70 void UpdateLandProperties(LandUpdateArgs args, IClientAPI remote_client);
71 bool IsEitherBannedOrRestricted(UUID avatar); 71 bool IsEitherBannedOrRestricted(UUID avatar);
72 bool IsBannedFromLand(UUID avatar); 72 bool IsBannedFromLand(UUID avatar);
73 bool CanBeOnThisLand(UUID avatar, float posHeight);
73 bool IsRestrictedFromLand(UUID avatar); 74 bool IsRestrictedFromLand(UUID avatar);
74 bool IsInLandAccessList(UUID avatar); 75 bool IsInLandAccessList(UUID avatar);
75 void SendLandUpdateToClient(IClientAPI remote_client); 76 void SendLandUpdateToClient(IClientAPI remote_client);
diff --git a/OpenSim/Framework/IMoneyModule.cs b/OpenSim/Framework/IMoneyModule.cs
index 52f3e83..415b7df 100644
--- a/OpenSim/Framework/IMoneyModule.cs
+++ b/OpenSim/Framework/IMoneyModule.cs
@@ -33,7 +33,7 @@ namespace OpenSim.Framework
33 public interface IMoneyModule 33 public interface IMoneyModule
34 { 34 {
35 bool ObjectGiveMoney(UUID objectID, UUID fromID, UUID toID, 35 bool ObjectGiveMoney(UUID objectID, UUID fromID, UUID toID,
36 int amount); 36 int amount, UUID txn);
37 37
38 int GetBalance(UUID agentID); 38 int GetBalance(UUID agentID);
39 bool UploadCovered(UUID agentID, int amount); 39 bool UploadCovered(UUID agentID, int amount);
@@ -41,6 +41,7 @@ namespace OpenSim.Framework
41 void ApplyCharge(UUID agentID, int amount, MoneyTransactionType type); 41 void ApplyCharge(UUID agentID, int amount, MoneyTransactionType type);
42 void ApplyCharge(UUID agentID, int amount, MoneyTransactionType type, string extraData); 42 void ApplyCharge(UUID agentID, int amount, MoneyTransactionType type, string extraData);
43 void ApplyUploadCharge(UUID agentID, int amount, string text); 43 void ApplyUploadCharge(UUID agentID, int amount, string text);
44 void MoveMoney(UUID fromUser, UUID toUser, int amount, string text);
44 45
45 int UploadCharge { get; } 46 int UploadCharge { get; }
46 int GroupCreationCharge { get; } 47 int GroupCreationCharge { get; }
diff --git a/OpenSim/Framework/LandData.cs b/OpenSim/Framework/LandData.cs
index fc02f33..4dffd3f 100644
--- a/OpenSim/Framework/LandData.cs
+++ b/OpenSim/Framework/LandData.cs
@@ -67,9 +67,9 @@ namespace OpenSim.Framework
67 67
68 private uint _flags = (uint)ParcelFlags.AllowFly | (uint)ParcelFlags.AllowLandmark | 68 private uint _flags = (uint)ParcelFlags.AllowFly | (uint)ParcelFlags.AllowLandmark |
69 (uint)ParcelFlags.AllowAPrimitiveEntry | 69 (uint)ParcelFlags.AllowAPrimitiveEntry |
70 (uint)ParcelFlags.AllowDeedToGroup | (uint)ParcelFlags.AllowTerraform | 70 (uint)ParcelFlags.AllowDeedToGroup |
71 (uint)ParcelFlags.CreateObjects | (uint)ParcelFlags.AllowOtherScripts | 71 (uint)ParcelFlags.CreateObjects | (uint)ParcelFlags.AllowOtherScripts |
72 (uint)ParcelFlags.SoundLocal | (uint)ParcelFlags.AllowVoiceChat; 72 (uint)ParcelFlags.AllowVoiceChat;
73 73
74 private byte _landingType = 0; 74 private byte _landingType = 0;
75 private string _name = "Your Parcel"; 75 private string _name = "Your Parcel";
diff --git a/OpenSim/Framework/LocklessQueue.cs b/OpenSim/Framework/LocklessQueue.cs
index 84f887c..9bd9baf 100644
--- a/OpenSim/Framework/LocklessQueue.cs
+++ b/OpenSim/Framework/LocklessQueue.cs
@@ -29,7 +29,7 @@ using System.Threading;
29 29
30namespace OpenSim.Framework 30namespace OpenSim.Framework
31{ 31{
32 public sealed class LocklessQueue<T> 32 public class LocklessQueue<T>
33 { 33 {
34 private sealed class SingleLinkNode 34 private sealed class SingleLinkNode
35 { 35 {
@@ -41,7 +41,7 @@ namespace OpenSim.Framework
41 SingleLinkNode tail; 41 SingleLinkNode tail;
42 int count; 42 int count;
43 43
44 public int Count { get { return count; } } 44 public virtual int Count { get { return count; } }
45 45
46 public LocklessQueue() 46 public LocklessQueue()
47 { 47 {
@@ -76,7 +76,7 @@ namespace OpenSim.Framework
76 Interlocked.Increment(ref count); 76 Interlocked.Increment(ref count);
77 } 77 }
78 78
79 public bool Dequeue(out T item) 79 public virtual bool Dequeue(out T item)
80 { 80 {
81 item = default(T); 81 item = default(T);
82 SingleLinkNode oldHead = null; 82 SingleLinkNode oldHead = null;
@@ -136,4 +136,4 @@ namespace OpenSim.Framework
136 (object)Interlocked.CompareExchange<SingleLinkNode>(ref location, newValue, comparand); 136 (object)Interlocked.CompareExchange<SingleLinkNode>(ref location, newValue, comparand);
137 } 137 }
138 } 138 }
139} \ No newline at end of file 139}
diff --git a/OpenSim/Framework/Monitoring/BaseStatsCollector.cs b/OpenSim/Framework/Monitoring/BaseStatsCollector.cs
index be1d02b..23dba09 100644
--- a/OpenSim/Framework/Monitoring/BaseStatsCollector.cs
+++ b/OpenSim/Framework/Monitoring/BaseStatsCollector.cs
@@ -43,10 +43,9 @@ namespace OpenSim.Framework.Monitoring
43 StringBuilder sb = new StringBuilder(Environment.NewLine); 43 StringBuilder sb = new StringBuilder(Environment.NewLine);
44 sb.Append("MEMORY STATISTICS"); 44 sb.Append("MEMORY STATISTICS");
45 sb.Append(Environment.NewLine); 45 sb.Append(Environment.NewLine);
46
47 sb.AppendFormat( 46 sb.AppendFormat(
48 "Allocated to OpenSim objects: {0} MB\n", 47 "Allocated to OpenSim objects: {0} MB\n",
49 Math.Round(GC.GetTotalMemory(false) / 1024.0 / 1024.0)); 48 Math.Round(GC.GetTotalMemory(false) / 1024.0 / 1024.0));
50 49
51 sb.AppendFormat( 50 sb.AppendFormat(
52 "OpenSim last object memory churn : {0} MB/s\n", 51 "OpenSim last object memory churn : {0} MB/s\n",
@@ -56,9 +55,23 @@ namespace OpenSim.Framework.Monitoring
56 "OpenSim average object memory churn : {0} MB/s\n", 55 "OpenSim average object memory churn : {0} MB/s\n",
57 Math.Round((MemoryWatchdog.AverageMemoryChurn * 1000) / 1024.0 / 1024, 3)); 56 Math.Round((MemoryWatchdog.AverageMemoryChurn * 1000) / 1024.0 / 1024, 3));
58 57
59 sb.AppendFormat( 58 Process myprocess = Process.GetCurrentProcess();
60 "Process memory : {0} MB\n", 59 if (!myprocess.HasExited)
61 Math.Round(Process.GetCurrentProcess().WorkingSet64 / 1024.0 / 1024.0)); 60 {
61 myprocess.Refresh();
62 sb.AppendFormat(
63 "Process memory: Physical {0} MB \t Paged {1} MB \t Virtual {2} MB\n",
64 Math.Round(Process.GetCurrentProcess().WorkingSet64 / 1024.0 / 1024.0),
65 Math.Round(Process.GetCurrentProcess().PagedMemorySize64 / 1024.0 / 1024.0),
66 Math.Round(Process.GetCurrentProcess().VirtualMemorySize64 / 1024.0 / 1024.0));
67 sb.AppendFormat(
68 "Peak process memory: Physical {0} MB \t Paged {1} MB \t Virtual {2} MB\n",
69 Math.Round(Process.GetCurrentProcess().PeakWorkingSet64 / 1024.0 / 1024.0),
70 Math.Round(Process.GetCurrentProcess().PeakPagedMemorySize64 / 1024.0 / 1024.0),
71 Math.Round(Process.GetCurrentProcess().PeakVirtualMemorySize64 / 1024.0 / 1024.0));
72 }
73 else
74 sb.Append("Process reported as Exited \n");
62 75
63 return sb.ToString(); 76 return sb.ToString();
64 } 77 }
diff --git a/OpenSim/Framework/Monitoring/Watchdog.cs b/OpenSim/Framework/Monitoring/Watchdog.cs
index 3f992b1..69d2db5 100644
--- a/OpenSim/Framework/Monitoring/Watchdog.cs
+++ b/OpenSim/Framework/Monitoring/Watchdog.cs
@@ -385,4 +385,4 @@ namespace OpenSim.Framework.Monitoring
385 m_watchdogTimer.Start(); 385 m_watchdogTimer.Start();
386 } 386 }
387 } 387 }
388} \ No newline at end of file 388}
diff --git a/OpenSim/Framework/OSChatMessage.cs b/OpenSim/Framework/OSChatMessage.cs
index 455756d..7450be2 100644
--- a/OpenSim/Framework/OSChatMessage.cs
+++ b/OpenSim/Framework/OSChatMessage.cs
@@ -51,12 +51,11 @@ namespace OpenSim.Framework
51 protected object m_senderObject; 51 protected object m_senderObject;
52 protected ChatTypeEnum m_type; 52 protected ChatTypeEnum m_type;
53 protected UUID m_fromID; 53 protected UUID m_fromID;
54 protected UUID m_toID; 54 protected UUID m_destination = UUID.Zero;
55 55
56 public OSChatMessage() 56 public OSChatMessage()
57 { 57 {
58 m_position = new Vector3(); 58 m_position = new Vector3();
59 m_toID = UUID.Zero;
60 } 59 }
61 60
62 /// <summary> 61 /// <summary>
@@ -104,15 +103,6 @@ namespace OpenSim.Framework
104 set { m_from = value; } 103 set { m_from = value; }
105 } 104 }
106 105
107 /// <summary>
108 /// The name of the sender (needed for scripts)
109 /// </summary>
110 public string To
111 {
112 get { return m_from; }
113 set { m_from = value; }
114 }
115
116 #region IEventArgs Members 106 #region IEventArgs Members
117 107
118 /// TODO: Sender and SenderObject should just be Sender and of 108 /// TODO: Sender and SenderObject should just be Sender and of
@@ -142,13 +132,10 @@ namespace OpenSim.Framework
142 set { m_fromID = value; } 132 set { m_fromID = value; }
143 } 133 }
144 134
145 /// <summary> 135 public UUID Destination
146 /// The single recipient or all if not set.
147 /// </summary>
148 public UUID TargetUUID
149 { 136 {
150 get { return m_toID; } 137 get { return m_destination; }
151 set { m_toID = value; } 138 set { m_destination = value; }
152 } 139 }
153 140
154 /// <summary> 141 /// <summary>
diff --git a/OpenSim/Framework/ObjectChangeData.cs b/OpenSim/Framework/ObjectChangeData.cs
new file mode 100644
index 0000000..8d56291
--- /dev/null
+++ b/OpenSim/Framework/ObjectChangeData.cs
@@ -0,0 +1,80 @@
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 OpenMetaverse;
29
30namespace OpenSim.Framework
31{
32 public enum ObjectChangeType : uint
33 {
34 // bits definitions
35 Position = 0x01,
36 Rotation = 0x02,
37 Scale = 0x04,
38 Group = 0x08,
39 UniformScale = 0x10,
40
41 // macros from above
42 // single prim
43 primP = 0x01,
44 primR = 0x02,
45 primPR = 0x03,
46 primS = 0x04,
47 primPS = 0x05,
48 primRS = 0x06,
49 primPSR = 0x07,
50
51 primUS = 0x14,
52 primPUS = 0x15,
53 primRUS = 0x16,
54 primPUSR = 0x17,
55
56 // group
57 groupP = 0x09,
58 groupR = 0x0A,
59 groupPR = 0x0B,
60 groupS = 0x0C,
61 groupPS = 0x0D,
62 groupRS = 0x0E,
63 groupPSR = 0x0F,
64
65 groupUS = 0x1C,
66 groupPUS = 0x1D,
67 groupRUS = 0x1E,
68 groupPUSR = 0x1F,
69
70 PRSmask = 0x07
71 }
72
73 public struct ObjectChangeData
74 {
75 public Quaternion rotation;
76 public Vector3 position;
77 public Vector3 scale;
78 public ObjectChangeType change;
79 }
80}
diff --git a/OpenSim/Framework/ParcelMediaCommandEnum.cs b/OpenSim/Framework/ParcelMediaCommandEnum.cs
index 93c41ec..e714382 100644
--- a/OpenSim/Framework/ParcelMediaCommandEnum.cs
+++ b/OpenSim/Framework/ParcelMediaCommandEnum.cs
@@ -27,7 +27,7 @@
27 27
28namespace OpenSim.Framework 28namespace OpenSim.Framework
29{ 29{
30 public enum ParcelMediaCommandEnum 30 public enum ParcelMediaCommandEnum : int
31 { 31 {
32 Stop = 0, 32 Stop = 0,
33 Pause = 1, 33 Pause = 1,
diff --git a/OpenSim/Framework/PluginLoader.cs b/OpenSim/Framework/PluginLoader.cs
index 819cb7b..cc80943 100644
--- a/OpenSim/Framework/PluginLoader.cs
+++ b/OpenSim/Framework/PluginLoader.cs
@@ -244,13 +244,22 @@ namespace OpenSim.Framework
244 // The Mono addin manager (in Mono.Addins.dll version 0.2.0.0) 244 // The Mono addin manager (in Mono.Addins.dll version 0.2.0.0)
245 // occasionally seems to corrupt its addin cache 245 // occasionally seems to corrupt its addin cache
246 // Hence, as a temporary solution we'll remove it before each startup 246 // Hence, as a temporary solution we'll remove it before each startup
247
248 string customDir = Environment.GetEnvironmentVariable ("MONO_ADDINS_REGISTRY");
249 string v0 = "addin-db-000";
250 string v1 = "addin-db-001";
251 if (customDir != null && customDir != String.Empty)
252 {
253 v0 = Path.Combine(customDir, v0);
254 v1 = Path.Combine(customDir, v1);
255 }
247 try 256 try
248 { 257 {
249 if (Directory.Exists("addin-db-000")) 258 if (Directory.Exists(v0))
250 Directory.Delete("addin-db-000", true); 259 Directory.Delete(v0, true);
251 260
252 if (Directory.Exists("addin-db-001")) 261 if (Directory.Exists(v1))
253 Directory.Delete("addin-db-001", true); 262 Directory.Delete(v1, true);
254 } 263 }
255 catch (IOException) 264 catch (IOException)
256 { 265 {
diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs
index c1e1a4f..df928dc 100644
--- a/OpenSim/Framework/PrimitiveBaseShape.cs
+++ b/OpenSim/Framework/PrimitiveBaseShape.cs
@@ -717,7 +717,12 @@ namespace OpenSim.Framework
717 return _lightColorR; 717 return _lightColorR;
718 } 718 }
719 set { 719 set {
720 _lightColorR = value; 720 if (value < 0)
721 _lightColorR = 0;
722 else if (value > 1.0f)
723 _lightColorR = 1.0f;
724 else
725 _lightColorR = value;
721 } 726 }
722 } 727 }
723 728
@@ -726,7 +731,12 @@ namespace OpenSim.Framework
726 return _lightColorG; 731 return _lightColorG;
727 } 732 }
728 set { 733 set {
729 _lightColorG = value; 734 if (value < 0)
735 _lightColorG = 0;
736 else if (value > 1.0f)
737 _lightColorG = 1.0f;
738 else
739 _lightColorG = value;
730 } 740 }
731 } 741 }
732 742
@@ -735,7 +745,12 @@ namespace OpenSim.Framework
735 return _lightColorB; 745 return _lightColorB;
736 } 746 }
737 set { 747 set {
738 _lightColorB = value; 748 if (value < 0)
749 _lightColorB = 0;
750 else if (value > 1.0f)
751 _lightColorB = 1.0f;
752 else
753 _lightColorB = value;
739 } 754 }
740 } 755 }
741 756
@@ -744,7 +759,12 @@ namespace OpenSim.Framework
744 return _lightColorA; 759 return _lightColorA;
745 } 760 }
746 set { 761 set {
747 _lightColorA = value; 762 if (value < 0)
763 _lightColorA = 0;
764 else if (value > 1.0f)
765 _lightColorA = 1.0f;
766 else
767 _lightColorA = value;
748 } 768 }
749 } 769 }
750 770
@@ -858,6 +878,11 @@ namespace OpenSim.Framework
858 878
859 public ulong GetMeshKey(Vector3 size, float lod) 879 public ulong GetMeshKey(Vector3 size, float lod)
860 { 880 {
881 return GetMeshKey(size, lod, false);
882 }
883
884 public ulong GetMeshKey(Vector3 size, float lod, bool convex)
885 {
861 ulong hash = 5381; 886 ulong hash = 5381;
862 887
863 hash = djb2(hash, this.PathCurve); 888 hash = djb2(hash, this.PathCurve);
@@ -903,6 +928,9 @@ namespace OpenSim.Framework
903 hash = djb2(hash, scaleBytes[i]); 928 hash = djb2(hash, scaleBytes[i]);
904 } 929 }
905 930
931 if(convex)
932 hash = djb2(hash, 0xa5);
933
906 return hash; 934 return hash;
907 } 935 }
908 936
@@ -1406,7 +1434,7 @@ namespace OpenSim.Framework
1406 prim.Textures = this.Textures; 1434 prim.Textures = this.Textures;
1407 1435
1408 prim.Properties = new Primitive.ObjectProperties(); 1436 prim.Properties = new Primitive.ObjectProperties();
1409 prim.Properties.Name = "Primitive"; 1437 prim.Properties.Name = "Object";
1410 prim.Properties.Description = ""; 1438 prim.Properties.Description = "";
1411 prim.Properties.CreatorID = UUID.Zero; 1439 prim.Properties.CreatorID = UUID.Zero;
1412 prim.Properties.GroupID = UUID.Zero; 1440 prim.Properties.GroupID = UUID.Zero;
diff --git a/OpenSim/Framework/PriorityQueue.cs b/OpenSim/Framework/PriorityQueue.cs
index e7a7f7f..e4f1111 100644
--- a/OpenSim/Framework/PriorityQueue.cs
+++ b/OpenSim/Framework/PriorityQueue.cs
@@ -45,7 +45,8 @@ namespace OpenSim.Framework
45 /// <summary> 45 /// <summary>
46 /// Total number of queues (priorities) available 46 /// Total number of queues (priorities) available
47 /// </summary> 47 /// </summary>
48 public const uint NumberOfQueues = 12; 48
49 public const uint NumberOfQueues = 12; // includes immediate queues, m_queueCounts need to be set acording
49 50
50 /// <summary> 51 /// <summary>
51 /// Number of queuest (priorities) that are processed immediately 52 /// Number of queuest (priorities) that are processed immediately
@@ -60,7 +61,8 @@ namespace OpenSim.Framework
60 // each pass. weighted towards the higher priority queues 61 // each pass. weighted towards the higher priority queues
61 private uint m_nextQueue = 0; 62 private uint m_nextQueue = 0;
62 private uint m_countFromQueue = 0; 63 private uint m_countFromQueue = 0;
63 private uint[] m_queueCounts = { 8, 4, 4, 2, 2, 2, 2, 1, 1, 1, 1, 1 }; 64 // first queues are imediate, so no counts
65 private uint[] m_queueCounts = {0, 0, 8, 4, 4, 2, 2, 2, 2, 1, 1, 1};
64 66
65 // next request is a counter of the number of updates queued, it provides 67 // next request is a counter of the number of updates queued, it provides
66 // a total ordering on the updates coming through the queue and is more 68 // a total ordering on the updates coming through the queue and is more
@@ -137,7 +139,7 @@ namespace OpenSim.Framework
137 /// </summary> 139 /// </summary>
138 public bool TryDequeue(out IEntityUpdate value, out Int32 timeinqueue) 140 public bool TryDequeue(out IEntityUpdate value, out Int32 timeinqueue)
139 { 141 {
140 // If there is anything in priority queue 0, return it first no 142 // If there is anything in imediate queues, return it first no
141 // matter what else. Breaks fairness. But very useful. 143 // matter what else. Breaks fairness. But very useful.
142 for (int iq = 0; iq < NumberOfImmediateQueues; iq++) 144 for (int iq = 0; iq < NumberOfImmediateQueues; iq++)
143 { 145 {
@@ -172,14 +174,13 @@ namespace OpenSim.Framework
172 } 174 }
173 175
174 // Find the next non-immediate queue with updates in it 176 // Find the next non-immediate queue with updates in it
175 for (int i = 0; i < NumberOfQueues; ++i) 177 for (uint i = NumberOfImmediateQueues; i < NumberOfQueues; ++i)
176 { 178 {
177 m_nextQueue = (uint)((m_nextQueue + 1) % NumberOfQueues); 179 m_nextQueue++;
178 m_countFromQueue = m_queueCounts[m_nextQueue]; 180 if(m_nextQueue >= NumberOfQueues)
181 m_nextQueue = NumberOfImmediateQueues;
179 182
180 // if this is one of the immediate queues, just skip it 183 m_countFromQueue = m_queueCounts[m_nextQueue];
181 if (m_nextQueue < NumberOfImmediateQueues)
182 continue;
183 184
184 if (m_heaps[m_nextQueue].Count > 0) 185 if (m_heaps[m_nextQueue].Count > 0)
185 { 186 {
@@ -189,7 +190,6 @@ namespace OpenSim.Framework
189 m_lookupTable.Remove(item.Value.Entity.LocalId); 190 m_lookupTable.Remove(item.Value.Entity.LocalId);
190 timeinqueue = Util.EnvironmentTickCountSubtract(item.EntryTime); 191 timeinqueue = Util.EnvironmentTickCountSubtract(item.EntryTime);
191 value = item.Value; 192 value = item.Value;
192
193 return true; 193 return true;
194 } 194 }
195 } 195 }
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs
index 24b9c89..6dde62f 100644
--- a/OpenSim/Framework/RegionInfo.cs
+++ b/OpenSim/Framework/RegionInfo.cs
@@ -40,6 +40,7 @@ using OpenMetaverse.StructuredData;
40 40
41namespace OpenSim.Framework 41namespace OpenSim.Framework
42{ 42{
43 [Serializable]
43 public class RegionLightShareData : ICloneable 44 public class RegionLightShareData : ICloneable
44 { 45 {
45 public bool valid = false; 46 public bool valid = false;
@@ -102,6 +103,7 @@ namespace OpenSim.Framework
102 103
103 public bool commFailTF = false; 104 public bool commFailTF = false;
104 public ConfigurationMember configMember; 105 public ConfigurationMember configMember;
106 public string DataStore = String.Empty;
105 public string RegionFile = String.Empty; 107 public string RegionFile = String.Empty;
106 public bool isSandbox = false; 108 public bool isSandbox = false;
107 public bool Persistent = true; 109 public bool Persistent = true;
@@ -707,6 +709,9 @@ namespace OpenSim.Framework
707 string location = String.Format("{0},{1}", m_regionLocX, m_regionLocY); 709 string location = String.Format("{0},{1}", m_regionLocX, m_regionLocY);
708 config.Set("Location", location); 710 config.Set("Location", location);
709 711
712 if (DataStore != String.Empty)
713 config.Set("Datastore", DataStore);
714
710 config.Set("InternalAddress", m_internalEndPoint.Address.ToString()); 715 config.Set("InternalAddress", m_internalEndPoint.Address.ToString());
711 config.Set("InternalPort", m_internalEndPoint.Port); 716 config.Set("InternalPort", m_internalEndPoint.Port);
712 717
@@ -921,6 +926,9 @@ namespace OpenSim.Framework
921 case "sim_location_y": 926 case "sim_location_y":
922 m_regionLocY = (uint) configuration_result; 927 m_regionLocY = (uint) configuration_result;
923 break; 928 break;
929 case "datastore":
930 DataStore = (string) configuration_result;
931 break;
924 case "internal_ip_address": 932 case "internal_ip_address":
925 IPAddress address = (IPAddress) configuration_result; 933 IPAddress address = (IPAddress) configuration_result;
926 m_internalEndPoint = new IPEndPoint(address, 0); 934 m_internalEndPoint = new IPEndPoint(address, 0);
@@ -1077,6 +1085,11 @@ namespace OpenSim.Framework
1077 return regionInfo; 1085 return regionInfo;
1078 } 1086 }
1079 1087
1088 public int getInternalEndPointPort()
1089 {
1090 return m_internalEndPoint.Port;
1091 }
1092
1080 public Dictionary<string, object> ToKeyValuePairs() 1093 public Dictionary<string, object> ToKeyValuePairs()
1081 { 1094 {
1082 Dictionary<string, object> kvp = new Dictionary<string, object>(); 1095 Dictionary<string, object> kvp = new Dictionary<string, object>();
diff --git a/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs b/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs
index 05c64fa..c7caf6f 100644
--- a/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs
+++ b/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs
@@ -48,6 +48,9 @@ namespace OpenSim.Framework.RegionLoader.Web
48 48
49 public RegionInfo[] LoadRegions() 49 public RegionInfo[] LoadRegions()
50 { 50 {
51 int tries = 3;
52 int wait = 2000;
53
51 if (m_configSource == null) 54 if (m_configSource == null)
52 { 55 {
53 m_log.Error("[WEBLOADER]: Unable to load configuration source!"); 56 m_log.Error("[WEBLOADER]: Unable to load configuration source!");
@@ -66,82 +69,74 @@ namespace OpenSim.Framework.RegionLoader.Web
66 } 69 }
67 else 70 else
68 { 71 {
69 RegionInfo[] regionInfos = new RegionInfo[] {}; 72 while(tries > 0)
70 int regionCount = 0; 73 {
71 HttpWebRequest webRequest = (HttpWebRequest) WebRequest.Create(url); 74 RegionInfo[] regionInfos = new RegionInfo[] {};
72 webRequest.Timeout = 30000; //30 Second Timeout 75 int regionCount = 0;
73 m_log.DebugFormat("[WEBLOADER]: Sending download request to {0}", url); 76 HttpWebRequest webRequest = (HttpWebRequest) WebRequest.Create(url);
74 77 webRequest.Timeout = 30000; //30 Second Timeout
75 try 78 m_log.DebugFormat("[WEBLOADER]: Sending download request to {0}", url);
76 {
77 string xmlSource = String.Empty;
78 79
79 using (HttpWebResponse webResponse = (HttpWebResponse) webRequest.GetResponse()) 80 try
80 { 81 {
81 m_log.Debug("[WEBLOADER]: Downloading region information..."); 82 HttpWebResponse webResponse = (HttpWebResponse) webRequest.GetResponse();
83 m_log.Debug("[WEBLOADER]: Downloading region information...");
84 StreamReader reader = new StreamReader(webResponse.GetResponseStream());
85 string xmlSource = String.Empty;
86 string tempStr = reader.ReadLine();
87 while (tempStr != null)
88 {
89 xmlSource = xmlSource + tempStr;
90 tempStr = reader.ReadLine();
91 }
92 m_log.Debug("[WEBLOADER]: Done downloading region information from server. Total Bytes: " +
93 xmlSource.Length);
94 XmlDocument xmlDoc = new XmlDocument();
95 xmlDoc.LoadXml(xmlSource);
96 if (xmlDoc.FirstChild.Name == "Regions")
97 {
98 regionCount = xmlDoc.FirstChild.ChildNodes.Count;
99
100 if (regionCount > 0)
101 {
102 regionInfos = new RegionInfo[regionCount];
103 int i;
104 for (i = 0; i < xmlDoc.FirstChild.ChildNodes.Count; i++)
105 {
106 m_log.Debug(xmlDoc.FirstChild.ChildNodes[i].OuterXml);
107 regionInfos[i] =
108 new RegionInfo("REGION CONFIG #" + (i + 1), xmlDoc.FirstChild.ChildNodes[i],false,m_configSource);
109 }
110 }
111 }
112 }
113 catch (WebException ex)
114 {
115 if (((HttpWebResponse)ex.Response).StatusCode == HttpStatusCode.NotFound)
116 {
117 if (!allowRegionless)
118 throw ex;
119 }
120 else
121 throw ex;
122 }
82 123
83 using (Stream s = webResponse.GetResponseStream()) 124 if (regionCount > 0 | allowRegionless)
84 { 125 return regionInfos;
85 using (StreamReader reader = new StreamReader(s))
86 {
87 string tempStr = reader.ReadLine();
88 while (tempStr != null)
89 {
90 xmlSource = xmlSource + tempStr;
91 tempStr = reader.ReadLine();
92 }
93 }
94 }
95 }
96 126
97 m_log.Debug("[WEBLOADER]: Done downloading region information from server. Total Bytes: " + 127 m_log.Debug("[WEBLOADER]: Request yielded no regions.");
98 xmlSource.Length); 128 tries--;
99 XmlDocument xmlDoc = new XmlDocument(); 129 if (tries > 0)
100 xmlDoc.LoadXml(xmlSource);
101 if (xmlDoc.FirstChild.Name == "Regions")
102 {
103 regionCount = xmlDoc.FirstChild.ChildNodes.Count;
104
105 if (regionCount > 0)
106 {
107 regionInfos = new RegionInfo[regionCount];
108 int i;
109 for (i = 0; i < xmlDoc.FirstChild.ChildNodes.Count; i++)
110 {
111 m_log.Debug(xmlDoc.FirstChild.ChildNodes[i].OuterXml);
112 regionInfos[i] =
113 new RegionInfo("REGION CONFIG #" + (i + 1), xmlDoc.FirstChild.ChildNodes[i],false,m_configSource);
114 }
115 }
116 }
117 }
118 catch (WebException ex)
119 {
120 using (HttpWebResponse response = (HttpWebResponse)ex.Response)
121 { 130 {
122 if (response.StatusCode == HttpStatusCode.NotFound) 131 m_log.Debug("[WEBLOADER]: Retrying");
123 { 132 System.Threading.Thread.Sleep(wait);
124 if (!allowRegionless)
125 throw ex;
126 }
127 else
128 {
129 throw ex;
130 }
131 } 133 }
132 } 134 }
133 135
134 if (regionCount > 0 | allowRegionless) 136 m_log.Error("[WEBLOADER]: No region configs were available.");
135 { 137 return null;
136 return regionInfos;
137 }
138 else
139 {
140 m_log.Error("[WEBLOADER]: No region configs were available.");
141 return null;
142 }
143 } 138 }
144 } 139 }
145 } 140 }
146 } 141 }
147} \ No newline at end of file 142}
diff --git a/OpenSim/Framework/RegionSettings.cs b/OpenSim/Framework/RegionSettings.cs
index 47dbcec..47a2780 100644
--- a/OpenSim/Framework/RegionSettings.cs
+++ b/OpenSim/Framework/RegionSettings.cs
@@ -482,6 +482,28 @@ namespace OpenSim.Framework
482 set { m_LoadedCreationID = value; } 482 set { m_LoadedCreationID = value; }
483 } 483 }
484 484
485 private bool m_GodBlockSearch = false;
486 public bool GodBlockSearch
487 {
488 get { return m_GodBlockSearch; }
489 set { m_GodBlockSearch = value; }
490 }
491
492 private bool m_Casino = false;
493 public bool Casino
494 {
495 get { return m_Casino; }
496 set { m_Casino = value; }
497 }
498
499 // Telehub support
500 private bool m_TelehubEnabled = false;
501 public bool HasTelehub
502 {
503 get { return m_TelehubEnabled; }
504 set { m_TelehubEnabled = value; }
505 }
506
485 // Connected Telehub object 507 // Connected Telehub object
486 private UUID m_TelehubObject = UUID.Zero; 508 private UUID m_TelehubObject = UUID.Zero;
487 public UUID TelehubObject 509 public UUID TelehubObject
diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
index 035b3ad..6c04c69 100644
--- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs
+++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
@@ -133,7 +133,17 @@ namespace OpenSim.Framework.Servers
133 /// Performs initialisation of the scene, such as loading configuration from disk. 133 /// Performs initialisation of the scene, such as loading configuration from disk.
134 /// </summary> 134 /// </summary>
135 public virtual void Startup() 135 public virtual void Startup()
136 { 136 {
137 m_log.Info("[STARTUP]: Beginning startup processing");
138
139 m_log.Info("[STARTUP]: Careminster version: " + m_version + Environment.NewLine);
140 // clr version potentially is more confusing than helpful, since it doesn't tell us if we're running under Mono/MS .NET and
141 // the clr version number doesn't match the project version number under Mono.
142 //m_log.Info("[STARTUP]: Virtual machine runtime version: " + Environment.Version + Environment.NewLine);
143 m_log.InfoFormat(
144 "[STARTUP]: Operating system version: {0}, .NET platform {1}, {2}-bit\n",
145 Environment.OSVersion, Environment.OSVersion.Platform, Util.Is64BitProcess() ? "64" : "32");
146
137 StartupSpecific(); 147 StartupSpecific();
138 148
139 TimeSpan timeTaken = DateTime.Now - m_startuptime; 149 TimeSpan timeTaken = DateTime.Now - m_startuptime;
@@ -179,4 +189,4 @@ namespace OpenSim.Framework.Servers
179 } 189 }
180 } 190 }
181 } 191 }
182} \ No newline at end of file 192}
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
index 96a030b..d29cc61 100644
--- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
@@ -395,6 +395,7 @@ namespace OpenSim.Framework.Servers.HttpServer
395 StreamReader reader = new StreamReader(requestStream, encoding); 395 StreamReader reader = new StreamReader(requestStream, encoding);
396 396
397 string requestBody = reader.ReadToEnd(); 397 string requestBody = reader.ReadToEnd();
398 reader.Close();
398 399
399 Hashtable keysvals = new Hashtable(); 400 Hashtable keysvals = new Hashtable();
400 Hashtable headervals = new Hashtable(); 401 Hashtable headervals = new Hashtable();
@@ -736,7 +737,7 @@ namespace OpenSim.Framework.Servers.HttpServer
736 // Every month or so this will wrap and give bad numbers, not really a problem 737 // Every month or so this will wrap and give bad numbers, not really a problem
737 // since its just for reporting 738 // since its just for reporting
738 int tickdiff = requestEndTick - requestStartTick; 739 int tickdiff = requestEndTick - requestStartTick;
739 if (tickdiff > 3000 && requestHandler != null && requestHandler.Name != "GetTexture") 740 if (tickdiff > 3000 && (requestHandler == null || requestHandler.Name == null || requestHandler.Name != "GetTexture"))
740 { 741 {
741 m_log.InfoFormat( 742 m_log.InfoFormat(
742 "[BASE HTTP SERVER]: Slow handling of {0} {1} {2} {3} {4} from {5} took {6}ms", 743 "[BASE HTTP SERVER]: Slow handling of {0} {1} {2} {3} {4} from {5} took {6}ms",
@@ -1657,10 +1658,40 @@ namespace OpenSim.Framework.Servers.HttpServer
1657 1658
1658 internal byte[] DoHTTPGruntWork(Hashtable responsedata, OSHttpResponse response) 1659 internal byte[] DoHTTPGruntWork(Hashtable responsedata, OSHttpResponse response)
1659 { 1660 {
1660 //m_log.Info("[BASE HTTP SERVER]: Doing HTTP Grunt work with response"); 1661 int responsecode;
1661 int responsecode = (int)responsedata["int_response_code"]; 1662 string responseString = String.Empty;
1662 string responseString = (string)responsedata["str_response_string"]; 1663 byte[] responseData = null;
1663 string contentType = (string)responsedata["content_type"]; 1664 string contentType;
1665
1666 if (responsedata == null)
1667 {
1668 responsecode = 500;
1669 responseString = "No response could be obtained";
1670 contentType = "text/plain";
1671 responsedata = new Hashtable();
1672 }
1673 else
1674 {
1675 try
1676 {
1677 //m_log.Info("[BASE HTTP SERVER]: Doing HTTP Grunt work with response");
1678 responsecode = (int)responsedata["int_response_code"];
1679 if (responsedata["bin_response_data"] != null)
1680 responseData = (byte[])responsedata["bin_response_data"];
1681 else
1682 responseString = (string)responsedata["str_response_string"];
1683 contentType = (string)responsedata["content_type"];
1684 if (responseString == null)
1685 responseString = String.Empty;
1686 }
1687 catch
1688 {
1689 responsecode = 500;
1690 responseString = "No response could be obtained";
1691 contentType = "text/plain";
1692 responsedata = new Hashtable();
1693 }
1694 }
1664 1695
1665 if (responsedata.ContainsKey("error_status_text")) 1696 if (responsedata.ContainsKey("error_status_text"))
1666 { 1697 {
@@ -1705,25 +1736,40 @@ namespace OpenSim.Framework.Servers.HttpServer
1705 1736
1706 response.AddHeader("Content-Type", contentType); 1737 response.AddHeader("Content-Type", contentType);
1707 1738
1739 if (responsedata.ContainsKey("headers"))
1740 {
1741 Hashtable headerdata = (Hashtable)responsedata["headers"];
1742
1743 foreach (string header in headerdata.Keys)
1744 response.AddHeader(header, (string)headerdata[header]);
1745 }
1746
1708 byte[] buffer; 1747 byte[] buffer;
1709 1748
1710 if (!(contentType.Contains("image") 1749 if (responseData != null)
1711 || contentType.Contains("x-shockwave-flash")
1712 || contentType.Contains("application/x-oar")
1713 || contentType.Contains("application/vnd.ll.mesh")))
1714 { 1750 {
1715 // Text 1751 buffer = responseData;
1716 buffer = Encoding.UTF8.GetBytes(responseString);
1717 } 1752 }
1718 else 1753 else
1719 { 1754 {
1720 // Binary! 1755 if (!(contentType.Contains("image")
1721 buffer = Convert.FromBase64String(responseString); 1756 || contentType.Contains("x-shockwave-flash")
1722 } 1757 || contentType.Contains("application/x-oar")
1758 || contentType.Contains("application/vnd.ll.mesh")))
1759 {
1760 // Text
1761 buffer = Encoding.UTF8.GetBytes(responseString);
1762 }
1763 else
1764 {
1765 // Binary!
1766 buffer = Convert.FromBase64String(responseString);
1767 }
1723 1768
1724 response.SendChunked = false; 1769 response.SendChunked = false;
1725 response.ContentLength64 = buffer.Length; 1770 response.ContentLength64 = buffer.Length;
1726 response.ContentEncoding = Encoding.UTF8; 1771 response.ContentEncoding = Encoding.UTF8;
1772 }
1727 1773
1728 return buffer; 1774 return buffer;
1729 } 1775 }
@@ -1804,7 +1850,7 @@ namespace OpenSim.Framework.Servers.HttpServer
1804 m_httpListener2.Start(64); 1850 m_httpListener2.Start(64);
1805 1851
1806 // Long Poll Service Manager with 3 worker threads a 25 second timeout for no events 1852 // Long Poll Service Manager with 3 worker threads a 25 second timeout for no events
1807 m_PollServiceManager = new PollServiceRequestManager(this, 3, 25000); 1853 m_PollServiceManager = new PollServiceRequestManager(this, 4, 25000);
1808 m_PollServiceManager.Start(); 1854 m_PollServiceManager.Start();
1809 HTTPDRunning = true; 1855 HTTPDRunning = true;
1810 1856
@@ -1839,7 +1885,9 @@ namespace OpenSim.Framework.Servers.HttpServer
1839 1885
1840 public void httpServerException(object source, Exception exception) 1886 public void httpServerException(object source, Exception exception)
1841 { 1887 {
1842 m_log.Error(String.Format("[BASE HTTP SERVER]: {0} had an exception: {1} ", source.ToString(), exception.Message), exception); 1888 if (source.ToString() == "HttpServer.HttpListener" && exception.ToString().StartsWith("Mono.Security.Protocol.Tls.TlsException"))
1889 return;
1890 m_log.ErrorFormat("[BASE HTTP SERVER]: {0} had an exception {1}", source.ToString(), exception.ToString());
1843 /* 1891 /*
1844 if (HTTPDRunning)// && NotSocketErrors > 5) 1892 if (HTTPDRunning)// && NotSocketErrors > 5)
1845 { 1893 {
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs
index 3079a7e..c19ac32 100644
--- a/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs
+++ b/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs
@@ -52,7 +52,9 @@ namespace OpenSim.Framework.Servers.HttpServer
52 { 52 {
53 Normal = 0, 53 Normal = 0,
54 LslHttp = 1, 54 LslHttp = 1,
55 Inventory = 2 55 Inventory = 2,
56 Texture = 3,
57 Mesh = 4
56 } 58 }
57 59
58 public PollServiceEventArgs( 60 public PollServiceEventArgs(
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs
index aee3e3c..c2254c4 100644
--- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs
+++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs
@@ -34,6 +34,143 @@ using HttpServer;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Monitoring; 35using OpenSim.Framework.Monitoring;
36using Amib.Threading; 36using Amib.Threading;
37
38
39/*
40namespace OpenSim.Framework.Servers.HttpServer
41{
42
43 public class PollServiceRequestManager
44 {
45// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
46
47 private readonly BaseHttpServer m_server;
48 private static Queue m_requests = Queue.Synchronized(new Queue());
49 private static ManualResetEvent m_ev = new ManualResetEvent(false);
50 private uint m_WorkerThreadCount = 0;
51 private Thread[] m_workerThreads;
52 private PollServiceWorkerThread[] m_PollServiceWorkerThreads;
53 private volatile bool m_running = true;
54 private int m_pollTimeout;
55
56 public PollServiceRequestManager(BaseHttpServer pSrv, uint pWorkerThreadCount, int pTimeout)
57 {
58 m_server = pSrv;
59 m_WorkerThreadCount = pWorkerThreadCount;
60 m_pollTimeout = pTimeout;
61 }
62
63 public void Start()
64 {
65 m_running = true;
66 m_workerThreads = new Thread[m_WorkerThreadCount];
67 m_PollServiceWorkerThreads = new PollServiceWorkerThread[m_WorkerThreadCount];
68
69 //startup worker threads
70 for (uint i = 0; i < m_WorkerThreadCount; i++)
71 {
72 m_PollServiceWorkerThreads[i] = new PollServiceWorkerThread(m_server, m_pollTimeout);
73 m_PollServiceWorkerThreads[i].ReQueue += ReQueueEvent;
74
75 m_workerThreads[i]
76 = Watchdog.StartThread(
77 m_PollServiceWorkerThreads[i].ThreadStart,
78 String.Format("PollServiceWorkerThread{0}", i),
79 ThreadPriority.Normal,
80 false,
81 true,
82 int.MaxValue);
83 }
84
85 Watchdog.StartThread(
86 this.ThreadStart,
87 "PollServiceWatcherThread",
88 ThreadPriority.Normal,
89 false,
90 true,
91 1000 * 60 * 10);
92 }
93
94 internal void ReQueueEvent(PollServiceHttpRequest req)
95 {
96 // Do accounting stuff here
97 Enqueue(req);
98 }
99
100 public void Enqueue(PollServiceHttpRequest req)
101 {
102 lock (m_requests)
103 m_requests.Enqueue(req);
104 m_ev.Set();
105 }
106
107 public void ThreadStart()
108 {
109 while (m_running)
110 {
111 m_ev.WaitOne(1000);
112 m_ev.Reset();
113 Watchdog.UpdateThread();
114 ProcessQueuedRequests();
115 }
116 }
117
118 private void ProcessQueuedRequests()
119 {
120 lock (m_requests)
121 {
122 if (m_requests.Count == 0)
123 return;
124
125// m_log.DebugFormat("[POLL SERVICE REQUEST MANAGER]: Processing {0} requests", m_requests.Count);
126
127 int reqperthread = (int) (m_requests.Count/m_WorkerThreadCount) + 1;
128
129 // For Each WorkerThread
130 for (int tc = 0; tc < m_WorkerThreadCount && m_requests.Count > 0; tc++)
131 {
132 //Loop over number of requests each thread handles.
133 for (int i = 0; i < reqperthread && m_requests.Count > 0; i++)
134 {
135 try
136 {
137 m_PollServiceWorkerThreads[tc].Enqueue((PollServiceHttpRequest)m_requests.Dequeue());
138 }
139 catch (InvalidOperationException)
140 {
141 // The queue is empty, we did our calculations wrong!
142 return;
143 }
144
145 }
146 }
147 }
148
149 }
150
151 public void Stop()
152 {
153 m_running = false;
154
155 foreach (object o in m_requests)
156 {
157 PollServiceHttpRequest req = (PollServiceHttpRequest) o;
158 m_server.DoHTTPGruntWork(
159 req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id),
160 new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request), req.HttpContext));
161 }
162
163 m_requests.Clear();
164
165 foreach (Thread t in m_workerThreads)
166 {
167 t.Abort();
168 }
169 }
170 }
171}
172 */
173
37using System.IO; 174using System.IO;
38using System.Text; 175using System.Text;
39using System.Collections.Generic; 176using System.Collections.Generic;
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs
new file mode 100644
index 0000000..1c529b6
--- /dev/null
+++ b/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs
@@ -0,0 +1,175 @@
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
28/* Ubit work moved to PollServiceRequestManager
29
30using System;
31using System.Collections;
32using System.Collections.Generic;
33using System.IO;
34using System.Text;
35using HttpServer;
36using OpenMetaverse;
37using System.Reflection;
38using log4net;
39using OpenSim.Framework.Monitoring;
40
41namespace OpenSim.Framework.Servers.HttpServer
42{
43 public delegate void ReQueuePollServiceItem(PollServiceHttpRequest req);
44
45 public class PollServiceWorkerThread
46 {
47 private static readonly ILog m_log =
48 LogManager.GetLogger(
49 MethodBase.GetCurrentMethod().DeclaringType);
50
51 public event ReQueuePollServiceItem ReQueue;
52
53 private readonly BaseHttpServer m_server;
54 private BlockingQueue<PollServiceHttpRequest> m_request;
55 private bool m_running = true;
56 private int m_timeout = 250;
57
58 public PollServiceWorkerThread(BaseHttpServer pSrv, int pTimeout)
59 {
60 m_request = new BlockingQueue<PollServiceHttpRequest>();
61 m_server = pSrv;
62 m_timeout = pTimeout;
63 }
64
65 public void ThreadStart()
66 {
67 Run();
68 }
69
70 public void Run()
71 {
72 while (m_running)
73 {
74 PollServiceHttpRequest req = m_request.Dequeue();
75
76 Watchdog.UpdateThread();
77
78 try
79 {
80 if (req.PollServiceArgs.HasEvents(req.RequestID, req.PollServiceArgs.Id))
81 {
82 StreamReader str;
83 try
84 {
85 str = new StreamReader(req.Request.Body);
86 }
87 catch (System.ArgumentException)
88 {
89 // Stream was not readable means a child agent
90 // was closed due to logout, leaving the
91 // Event Queue request orphaned.
92 continue;
93 }
94
95 try
96 {
97 Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id, str.ReadToEnd());
98 DoHTTPGruntWork(m_server, req, responsedata);
99 }
100 catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream
101 {
102 // Ignore it, no need to reply
103 }
104 }
105 else
106 {
107 if ((Environment.TickCount - req.RequestTime) > m_timeout)
108 {
109 DoHTTPGruntWork(
110 m_server,
111 req,
112 req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id));
113 }
114 else
115 {
116 ReQueuePollServiceItem reQueueItem = ReQueue;
117 if (reQueueItem != null)
118 reQueueItem(req);
119 }
120 }
121 }
122 catch (Exception e)
123 {
124 m_log.ErrorFormat("Exception in poll service thread: " + e.ToString());
125 }
126 }
127 }
128
129 internal void Enqueue(PollServiceHttpRequest pPollServiceHttpRequest)
130 {
131 m_request.Enqueue(pPollServiceHttpRequest);
132 }
133
134 /// <summary>
135 /// FIXME: This should be part of BaseHttpServer
136 /// </summary>
137 internal static void DoHTTPGruntWork(BaseHttpServer server, PollServiceHttpRequest req, Hashtable responsedata)
138 {
139 OSHttpResponse response
140 = new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request), req.HttpContext);
141
142 byte[] buffer = server.DoHTTPGruntWork(responsedata, response);
143
144 response.SendChunked = false;
145 response.ContentLength64 = buffer.Length;
146 response.ContentEncoding = Encoding.UTF8;
147
148 try
149 {
150 response.OutputStream.Write(buffer, 0, buffer.Length);
151 }
152 catch (Exception ex)
153 {
154 m_log.Warn(string.Format("[POLL SERVICE WORKER THREAD]: Error ", ex));
155 }
156 finally
157 {
158 //response.OutputStream.Close();
159 try
160 {
161 response.OutputStream.Flush();
162 response.Send();
163
164 //if (!response.KeepAlive && response.ReuseContext)
165 // response.FreeContext();
166 }
167 catch (Exception e)
168 {
169 m_log.Warn(String.Format("[POLL SERVICE WORKER THREAD]: Error ", e));
170 }
171 }
172 }
173 }
174}
175*/ \ No newline at end of file
diff --git a/OpenSim/Framework/Servers/ServerBase.cs b/OpenSim/Framework/Servers/ServerBase.cs
index 2c4a687..b9e3c18 100644
--- a/OpenSim/Framework/Servers/ServerBase.cs
+++ b/OpenSim/Framework/Servers/ServerBase.cs
@@ -598,7 +598,7 @@ namespace OpenSim.Framework.Servers
598 } 598 }
599 } 599 }
600 600
601 protected string GetVersionText() 601 public string GetVersionText()
602 { 602 {
603 return String.Format("Version: {0} (interface version {1})", m_version, VersionInfo.MajorInterfaceVersion); 603 return String.Format("Version: {0} (interface version {1})", m_version, VersionInfo.MajorInterfaceVersion);
604 } 604 }
@@ -699,4 +699,4 @@ namespace OpenSim.Framework.Servers
699 m_console.OutputFormat(format, components); 699 m_console.OutputFormat(format, components);
700 } 700 }
701 } 701 }
702} \ No newline at end of file 702}
diff --git a/OpenSim/Framework/Servers/Tests/OSHttpTests.cs b/OpenSim/Framework/Servers/Tests/OSHttpTests.cs
index 5b912b4..deae45c 100644
--- a/OpenSim/Framework/Servers/Tests/OSHttpTests.cs
+++ b/OpenSim/Framework/Servers/Tests/OSHttpTests.cs
@@ -81,6 +81,10 @@ namespace OpenSim.Framework.Servers.Tests
81 /// </summary> 81 /// </summary>
82 public event EventHandler<RequestEventArgs> RequestReceived = delegate { }; 82 public event EventHandler<RequestEventArgs> RequestReceived = delegate { };
83 83
84 public bool CanSend { get { return true; } }
85 public string RemoteEndPoint { get { return ""; } }
86 public string RemoteEndPointAddress { get { return ""; } }
87 public string RemoteEndPointPort { get { return ""; } }
84 } 88 }
85 89
86 public class TestHttpRequest: IHttpRequest 90 public class TestHttpRequest: IHttpRequest
diff --git a/OpenSim/Framework/Servers/VersionInfo.cs b/OpenSim/Framework/Servers/VersionInfo.cs
index 80568e0..737c14d 100644
--- a/OpenSim/Framework/Servers/VersionInfo.cs
+++ b/OpenSim/Framework/Servers/VersionInfo.cs
@@ -29,11 +29,11 @@ namespace OpenSim
29{ 29{
30 public class VersionInfo 30 public class VersionInfo
31 { 31 {
32 private const string VERSION_NUMBER = "0.7.6"; 32 private const string VERSION_NUMBER = "0.7.6CM";
33 private const Flavour VERSION_FLAVOUR = Flavour.Dev; 33 private const Flavour VERSION_FLAVOUR = Flavour.Dev;
34 34
35 public enum Flavour 35 public enum Flavour
36 { 36 {
37 Unknown, 37 Unknown,
38 Dev, 38 Dev,
39 RC1, 39 RC1,
@@ -50,7 +50,7 @@ namespace OpenSim
50 50
51 public static string GetVersionString(string versionNumber, Flavour flavour) 51 public static string GetVersionString(string versionNumber, Flavour flavour)
52 { 52 {
53 string versionString = "OpenSim " + versionNumber + " " + flavour; 53 string versionString = "Careminster " + versionNumber + " " + flavour;
54 return versionString.PadRight(VERSIONINFO_VERSION_LENGTH); 54 return versionString.PadRight(VERSIONINFO_VERSION_LENGTH);
55 } 55 }
56 56
diff --git a/OpenSim/Framework/TaskInventoryDictionary.cs b/OpenSim/Framework/TaskInventoryDictionary.cs
index 8af2c41..62ecbd1 100644
--- a/OpenSim/Framework/TaskInventoryDictionary.cs
+++ b/OpenSim/Framework/TaskInventoryDictionary.cs
@@ -27,9 +27,13 @@
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Threading;
31using System.Reflection;
30using System.Xml; 32using System.Xml;
33using System.Diagnostics;
31using System.Xml.Schema; 34using System.Xml.Schema;
32using System.Xml.Serialization; 35using System.Xml.Serialization;
36using log4net;
33using OpenMetaverse; 37using OpenMetaverse;
34 38
35namespace OpenSim.Framework 39namespace OpenSim.Framework
@@ -47,6 +51,180 @@ namespace OpenSim.Framework
47 // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 51 // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
48 52
49 private static XmlSerializer tiiSerializer = new XmlSerializer(typeof (TaskInventoryItem)); 53 private static XmlSerializer tiiSerializer = new XmlSerializer(typeof (TaskInventoryItem));
54 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
55
56 private Thread LockedByThread;
57// private string WriterStack;
58
59// private Dictionary<Thread, string> ReadLockers =
60// new Dictionary<Thread, string>();
61
62 /// <value>
63 /// An advanced lock for inventory data
64 /// </value>
65 private System.Threading.ReaderWriterLockSlim m_itemLock = new System.Threading.ReaderWriterLockSlim();
66
67 /// <summary>
68 /// Are we readlocked by the calling thread?
69 /// </summary>
70 public bool IsReadLockedByMe()
71 {
72 if (m_itemLock.RecursiveReadCount > 0)
73 {
74 return true;
75 }
76 else
77 {
78 return false;
79 }
80 }
81
82 /// <summary>
83 /// Lock our inventory list for reading (many can read, one can write)
84 /// </summary>
85 public void LockItemsForRead(bool locked)
86 {
87 if (locked)
88 {
89 if (m_itemLock.IsWriteLockHeld && LockedByThread != null)
90 {
91 if (!LockedByThread.IsAlive)
92 {
93 //Locked by dead thread, reset.
94 m_itemLock = new System.Threading.ReaderWriterLockSlim();
95 }
96 }
97
98 if (m_itemLock.RecursiveReadCount > 0)
99 {
100 m_log.Error("[TaskInventoryDictionary] Recursive read lock requested. This should not happen and means something needs to be fixed. For now though, it's safe to continue.");
101 try
102 {
103 // That call stack is useful for end users only. RealProgrammers need a full dump. Commented.
104 // StackTrace stackTrace = new StackTrace(); // get call stack
105 // StackFrame[] stackFrames = stackTrace.GetFrames(); // get method calls (frames)
106 //
107 // // write call stack method names
108 // foreach (StackFrame stackFrame in stackFrames)
109 // {
110 // m_log.Error("[SceneObjectGroup.m_parts] "+(stackFrame.GetMethod().Name)); // write method name
111 // }
112
113 // The below is far more useful
114// System.Console.WriteLine("------------------------------------------");
115// System.Console.WriteLine("My call stack:\n" + Environment.StackTrace);
116// System.Console.WriteLine("------------------------------------------");
117// foreach (KeyValuePair<Thread, string> kvp in ReadLockers)
118// {
119// System.Console.WriteLine("Locker name {0} call stack:\n" + kvp.Value, kvp.Key.Name);
120// System.Console.WriteLine("------------------------------------------");
121// }
122 }
123 catch
124 {}
125 m_itemLock.ExitReadLock();
126 }
127 if (m_itemLock.RecursiveWriteCount > 0)
128 {
129 m_log.Error("[TaskInventoryDictionary] Recursive write lock requested. This should not happen and means something needs to be fixed.");
130// try
131// {
132// System.Console.WriteLine("------------------------------------------");
133// System.Console.WriteLine("My call stack:\n" + Environment.StackTrace);
134// System.Console.WriteLine("------------------------------------------");
135// System.Console.WriteLine("Locker's call stack:\n" + WriterStack);
136// System.Console.WriteLine("------------------------------------------");
137// }
138// catch
139// {}
140 m_itemLock.ExitWriteLock();
141 }
142
143 while (!m_itemLock.TryEnterReadLock(60000))
144 {
145 m_log.Error("Thread lock detected while trying to aquire READ lock in TaskInventoryDictionary. Locked by thread " + LockedByThread.Name + ". I'm going to try to solve the thread lock automatically to preserve region stability, but this needs to be fixed.");
146 if (m_itemLock.IsWriteLockHeld)
147 {
148 m_itemLock = new System.Threading.ReaderWriterLockSlim();
149// System.Console.WriteLine("------------------------------------------");
150// System.Console.WriteLine("My call stack:\n" + Environment.StackTrace);
151// System.Console.WriteLine("------------------------------------------");
152// System.Console.WriteLine("Locker's call stack:\n" + WriterStack);
153// System.Console.WriteLine("------------------------------------------");
154// LockedByThread = null;
155// ReadLockers.Clear();
156 }
157 }
158// ReadLockers[Thread.CurrentThread] = Environment.StackTrace;
159 }
160 else
161 {
162 if (m_itemLock.RecursiveReadCount>0)
163 {
164 m_itemLock.ExitReadLock();
165 }
166// if (m_itemLock.RecursiveReadCount == 0)
167// ReadLockers.Remove(Thread.CurrentThread);
168 }
169 }
170
171 /// <summary>
172 /// Lock our inventory list for writing (many can read, one can write)
173 /// </summary>
174 public void LockItemsForWrite(bool locked)
175 {
176 if (locked)
177 {
178 //Enter a write lock, wait indefinately for one to open.
179 if (m_itemLock.RecursiveReadCount > 0)
180 {
181 m_log.Error("[TaskInventoryDictionary] Recursive read lock requested. This should not happen and means something needs to be fixed. For now though, it's safe to continue.");
182 m_itemLock.ExitReadLock();
183 }
184 if (m_itemLock.RecursiveWriteCount > 0)
185 {
186 m_log.Error("[TaskInventoryDictionary] Recursive write lock requested. This should not happen and means something needs to be fixed.");
187
188 m_itemLock.ExitWriteLock();
189 }
190 while (!m_itemLock.TryEnterWriteLock(60000))
191 {
192 if (m_itemLock.IsWriteLockHeld)
193 {
194 m_log.Error("Thread lock detected while trying to aquire WRITE lock in TaskInventoryDictionary. Locked by thread " + LockedByThread.Name + ". I'm going to try to solve the thread lock automatically to preserve region stability, but this needs to be fixed.");
195// System.Console.WriteLine("------------------------------------------");
196// System.Console.WriteLine("My call stack:\n" + Environment.StackTrace);
197// System.Console.WriteLine("------------------------------------------");
198// System.Console.WriteLine("Locker's call stack:\n" + WriterStack);
199// System.Console.WriteLine("------------------------------------------");
200 }
201 else
202 {
203 m_log.Error("Thread lock detected while trying to aquire WRITE lock in TaskInventoryDictionary. Locked by a reader. I'm going to try to solve the thread lock automatically to preserve region stability, but this needs to be fixed.");
204// System.Console.WriteLine("------------------------------------------");
205// System.Console.WriteLine("My call stack:\n" + Environment.StackTrace);
206// System.Console.WriteLine("------------------------------------------");
207// foreach (KeyValuePair<Thread, string> kvp in ReadLockers)
208// {
209// System.Console.WriteLine("Locker name {0} call stack:\n" + kvp.Value, kvp.Key.Name);
210// System.Console.WriteLine("------------------------------------------");
211// }
212 }
213 m_itemLock = new System.Threading.ReaderWriterLockSlim();
214// ReadLockers.Clear();
215 }
216
217 LockedByThread = Thread.CurrentThread;
218// WriterStack = Environment.StackTrace;
219 }
220 else
221 {
222 if (m_itemLock.RecursiveWriteCount > 0)
223 {
224 m_itemLock.ExitWriteLock();
225 }
226 }
227 }
50 228
51 #region ICloneable Members 229 #region ICloneable Members
52 230
@@ -54,14 +232,13 @@ namespace OpenSim.Framework
54 { 232 {
55 TaskInventoryDictionary clone = new TaskInventoryDictionary(); 233 TaskInventoryDictionary clone = new TaskInventoryDictionary();
56 234
57 lock (this) 235 m_itemLock.EnterReadLock();
236 foreach (UUID uuid in Keys)
58 { 237 {
59 foreach (UUID uuid in Keys) 238 clone.Add(uuid, (TaskInventoryItem) this[uuid].Clone());
60 {
61 clone.Add(uuid, (TaskInventoryItem) this[uuid].Clone());
62 }
63 } 239 }
64 240 m_itemLock.ExitReadLock();
241
65 return clone; 242 return clone;
66 } 243 }
67 244
diff --git a/OpenSim/Framework/TaskInventoryItem.cs b/OpenSim/Framework/TaskInventoryItem.cs
index a06f8e7..574ee56 100644
--- a/OpenSim/Framework/TaskInventoryItem.cs
+++ b/OpenSim/Framework/TaskInventoryItem.cs
@@ -72,7 +72,7 @@ namespace OpenSim.Framework
72 private UUID _loadedID = UUID.Zero; 72 private UUID _loadedID = UUID.Zero;
73 73
74 private bool _ownerChanged = false; 74 private bool _ownerChanged = false;
75 75
76 public UUID AssetID { 76 public UUID AssetID {
77 get { 77 get {
78 return _assetID; 78 return _assetID;
diff --git a/OpenSim/Framework/Tests/MundaneFrameworkTests.cs b/OpenSim/Framework/Tests/MundaneFrameworkTests.cs
index 1dc8053..0fbdaf3 100644
--- a/OpenSim/Framework/Tests/MundaneFrameworkTests.cs
+++ b/OpenSim/Framework/Tests/MundaneFrameworkTests.cs
@@ -218,12 +218,12 @@ namespace OpenSim.Framework.Tests
218 BannedHostNameMask = string.Empty, 218 BannedHostNameMask = string.Empty,
219 BannedUserID = bannedUserId} 219 BannedUserID = bannedUserId}
220 ); 220 );
221 Assert.IsTrue(es.IsBanned(bannedUserId), "User Should be banned but is not."); 221 Assert.IsTrue(es.IsBanned(bannedUserId, 32), "User Should be banned but is not.");
222 Assert.IsFalse(es.IsBanned(UUID.Zero), "User Should not be banned but is."); 222 Assert.IsFalse(es.IsBanned(UUID.Zero, 32), "User Should not be banned but is.");
223 223
224 es.RemoveBan(bannedUserId); 224 es.RemoveBan(bannedUserId);
225 225
226 Assert.IsFalse(es.IsBanned(bannedUserId), "User Should not be banned but is."); 226 Assert.IsFalse(es.IsBanned(bannedUserId, 32), "User Should not be banned but is.");
227 227
228 es.AddEstateManager(UUID.Zero); 228 es.AddEstateManager(UUID.Zero);
229 229
diff --git a/OpenSim/Framework/ThrottleOutPacketType.cs b/OpenSim/Framework/ThrottleOutPacketType.cs
index ca4b126..87899f0 100644
--- a/OpenSim/Framework/ThrottleOutPacketType.cs
+++ b/OpenSim/Framework/ThrottleOutPacketType.cs
@@ -47,6 +47,8 @@ namespace OpenSim.Framework
47 Texture = 5, 47 Texture = 5,
48 /// <summary>Non-texture assets</summary> 48 /// <summary>Non-texture assets</summary>
49 Asset = 6, 49 Asset = 6,
50
51 HighPriority = 128,
50 } 52 }
51 53
52 [Flags] 54 [Flags]
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 7f0850f..0852b49 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -516,19 +516,25 @@ namespace OpenSim.Framework
516 /// </summary> 516 /// </summary>
517 /// <param name="data"></param> 517 /// <param name="data"></param>
518 /// <returns></returns> 518 /// <returns></returns>
519
519 public static string Md5Hash(string data) 520 public static string Md5Hash(string data)
520 { 521 {
521 byte[] dataMd5 = ComputeMD5Hash(data); 522 return Md5Hash(data, Encoding.Default);
523 }
524
525 public static string Md5Hash(string data, Encoding encoding)
526 {
527 byte[] dataMd5 = ComputeMD5Hash(data, encoding);
522 StringBuilder sb = new StringBuilder(); 528 StringBuilder sb = new StringBuilder();
523 for (int i = 0; i < dataMd5.Length; i++) 529 for (int i = 0; i < dataMd5.Length; i++)
524 sb.AppendFormat("{0:x2}", dataMd5[i]); 530 sb.AppendFormat("{0:x2}", dataMd5[i]);
525 return sb.ToString(); 531 return sb.ToString();
526 } 532 }
527 533
528 private static byte[] ComputeMD5Hash(string data) 534 private static byte[] ComputeMD5Hash(string data, Encoding encoding)
529 { 535 {
530 MD5 md5 = MD5.Create(); 536 MD5 md5 = MD5.Create();
531 return md5.ComputeHash(Encoding.Default.GetBytes(data)); 537 return md5.ComputeHash(encoding.GetBytes(data));
532 } 538 }
533 539
534 /// <summary> 540 /// <summary>
@@ -536,6 +542,12 @@ namespace OpenSim.Framework
536 /// </summary> 542 /// </summary>
537 /// <param name="data"></param> 543 /// <param name="data"></param>
538 /// <returns></returns> 544 /// <returns></returns>
545
546 public static string SHA1Hash(string data, Encoding enc)
547 {
548 return SHA1Hash(enc.GetBytes(data));
549 }
550
539 public static string SHA1Hash(string data) 551 public static string SHA1Hash(string data)
540 { 552 {
541 return SHA1Hash(Encoding.Default.GetBytes(data)); 553 return SHA1Hash(Encoding.Default.GetBytes(data));
@@ -1277,19 +1289,19 @@ namespace OpenSim.Framework
1277 { 1289 {
1278 string os = String.Empty; 1290 string os = String.Empty;
1279 1291
1280 if (Environment.OSVersion.Platform != PlatformID.Unix) 1292// if (Environment.OSVersion.Platform != PlatformID.Unix)
1281 { 1293// {
1282 os = Environment.OSVersion.ToString(); 1294// os = Environment.OSVersion.ToString();
1283 } 1295// }
1284 else 1296// else
1285 { 1297// {
1286 os = ReadEtcIssue(); 1298// os = ReadEtcIssue();
1287 } 1299// }
1288 1300//
1289 if (os.Length > 45) 1301// if (os.Length > 45)
1290 { 1302// {
1291 os = os.Substring(0, 45); 1303// os = os.Substring(0, 45);
1292 } 1304// }
1293 1305
1294 return os; 1306 return os;
1295 } 1307 }
@@ -1421,7 +1433,7 @@ namespace OpenSim.Framework
1421 1433
1422 public static Guid GetHashGuid(string data, string salt) 1434 public static Guid GetHashGuid(string data, string salt)
1423 { 1435 {
1424 byte[] hash = ComputeMD5Hash(data + salt); 1436 byte[] hash = ComputeMD5Hash(data + salt, Encoding.Default);
1425 1437
1426 //string s = BitConverter.ToString(hash); 1438 //string s = BitConverter.ToString(hash);
1427 1439
diff --git a/OpenSim/Framework/WearableCacheItem.cs b/OpenSim/Framework/WearableCacheItem.cs
new file mode 100644
index 0000000..1aecf79
--- /dev/null
+++ b/OpenSim/Framework/WearableCacheItem.cs
@@ -0,0 +1,157 @@
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 OpenMetaverse;
31using OpenMetaverse.StructuredData;
32
33namespace OpenSim.Framework
34{
35 [Serializable]
36 public class WearableCacheItem
37 {
38 public uint TextureIndex { get; set; }
39 public UUID CacheId { get; set; }
40 public UUID TextureID { get; set; }
41 public AssetBase TextureAsset { get; set; }
42
43
44 public static WearableCacheItem[] GetDefaultCacheItem()
45 {
46 int itemmax = 21;
47 WearableCacheItem[] retitems = new WearableCacheItem[itemmax];
48 for (uint i=0;i<itemmax;i++)
49 retitems[i] = new WearableCacheItem() {CacheId = UUID.Zero, TextureID = UUID.Zero, TextureIndex = i + 1};
50 return retitems;
51 }
52 public static WearableCacheItem[] FromOSD(OSD pInput, IImprovedAssetCache dataCache)
53 {
54 List<WearableCacheItem> ret = new List<WearableCacheItem>();
55 if (pInput.Type == OSDType.Array)
56 {
57 OSDArray itemarray = (OSDArray) pInput;
58 foreach (OSDMap item in itemarray)
59 {
60 ret.Add(new WearableCacheItem()
61 {
62 TextureIndex = item["textureindex"].AsUInteger(),
63 CacheId = item["cacheid"].AsUUID(),
64 TextureID = item["textureid"].AsUUID()
65 });
66
67 if (dataCache != null && item.ContainsKey("assetdata"))
68 {
69 AssetBase asset = new AssetBase(item["textureid"].AsUUID(),"BakedTexture",(sbyte)AssetType.Texture,UUID.Zero.ToString());
70 asset.Temporary = true;
71 asset.Data = item["assetdata"].AsBinary();
72 dataCache.Cache(asset);
73 }
74 }
75 }
76 else if (pInput.Type == OSDType.Map)
77 {
78 OSDMap item = (OSDMap) pInput;
79 ret.Add(new WearableCacheItem(){
80 TextureIndex = item["textureindex"].AsUInteger(),
81 CacheId = item["cacheid"].AsUUID(),
82 TextureID = item["textureid"].AsUUID()
83 });
84 if (dataCache != null && item.ContainsKey("assetdata"))
85 {
86 string assetCreator = item["assetcreator"].AsString();
87 string assetName = item["assetname"].AsString();
88 AssetBase asset = new AssetBase(item["textureid"].AsUUID(), assetName, (sbyte)AssetType.Texture, assetCreator);
89 asset.Temporary = true;
90 asset.Data = item["assetdata"].AsBinary();
91 dataCache.Cache(asset);
92 }
93 }
94 else
95 {
96 return new WearableCacheItem[0];
97 }
98 return ret.ToArray();
99
100 }
101 public static OSD ToOSD(WearableCacheItem[] pcacheItems, IImprovedAssetCache dataCache)
102 {
103 OSDArray arr = new OSDArray();
104 foreach (WearableCacheItem item in pcacheItems)
105 {
106 OSDMap itemmap = new OSDMap();
107 itemmap.Add("textureindex", OSD.FromUInteger(item.TextureIndex));
108 itemmap.Add("cacheid", OSD.FromUUID(item.CacheId));
109 itemmap.Add("textureid", OSD.FromUUID(item.TextureID));
110 if (dataCache != null)
111 {
112 if (dataCache.Check(item.TextureID.ToString()))
113 {
114 AssetBase assetItem = dataCache.Get(item.TextureID.ToString());
115 if (assetItem != null)
116 {
117 itemmap.Add("assetdata", OSD.FromBinary(assetItem.Data));
118 itemmap.Add("assetcreator", OSD.FromString(assetItem.CreatorID));
119 itemmap.Add("assetname", OSD.FromString(assetItem.Name));
120 }
121 }
122 }
123 arr.Add(itemmap);
124 }
125 return arr;
126 }
127 public static WearableCacheItem SearchTextureIndex(uint pTextureIndex,WearableCacheItem[] pcacheItems)
128 {
129 for (int i = 0; i < pcacheItems.Length; i++)
130 {
131 if (pcacheItems[i].TextureIndex == pTextureIndex)
132 return pcacheItems[i];
133 }
134 return null;
135 }
136 public static WearableCacheItem SearchTextureCacheId(UUID pCacheId, WearableCacheItem[] pcacheItems)
137 {
138 for (int i = 0; i < pcacheItems.Length; i++)
139 {
140 if (pcacheItems[i].CacheId == pCacheId)
141 return pcacheItems[i];
142 }
143 return null;
144 }
145 public static WearableCacheItem SearchTextureTextureId(UUID pTextureId, WearableCacheItem[] pcacheItems)
146 {
147 for (int i = 0; i < pcacheItems.Length; i++)
148 {
149 if (pcacheItems[i].TextureID == pTextureId)
150 return pcacheItems[i];
151 }
152 return null;
153 }
154 }
155
156
157}
diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs
index 701fbb0..bf57fd4 100644
--- a/OpenSim/Framework/WebUtil.cs
+++ b/OpenSim/Framework/WebUtil.cs
@@ -235,6 +235,7 @@ namespace OpenSim.Framework
235 catch (Exception ex) 235 catch (Exception ex)
236 { 236 {
237 errorMessage = ex.Message; 237 errorMessage = ex.Message;
238 m_log.Debug("[WEB UTIL]: Exception making request: " + ex.ToString());
238 } 239 }
239 finally 240 finally
240 { 241 {
@@ -318,7 +319,7 @@ namespace OpenSim.Framework
318 /// </summary> 319 /// </summary>
319 public static OSDMap PostToService(string url, NameValueCollection data) 320 public static OSDMap PostToService(string url, NameValueCollection data)
320 { 321 {
321 return ServiceFormRequest(url,data,10000); 322 return ServiceFormRequest(url,data, 20000);
322 } 323 }
323 324
324 public static OSDMap ServiceFormRequest(string url, NameValueCollection data, int timeout) 325 public static OSDMap ServiceFormRequest(string url, NameValueCollection data, int timeout)
@@ -732,7 +733,8 @@ namespace OpenSim.Framework
732 reqnum, verb, requestUrl); 733 reqnum, verb, requestUrl);
733 734
734 int tickstart = Util.EnvironmentTickCount(); 735 int tickstart = Util.EnvironmentTickCount();
735 int tickdata = 0; 736// int tickdata = 0;
737 int tickdiff = 0;
736 738
737 Type type = typeof(TRequest); 739 Type type = typeof(TRequest);
738 740
@@ -775,8 +777,8 @@ namespace OpenSim.Framework
775 requestStream.Close(); 777 requestStream.Close();
776 778
777 // capture how much time was spent writing 779 // capture how much time was spent writing
778 tickdata = Util.EnvironmentTickCountSubtract(tickstart); 780 // useless in this async
779 781// tickdata = Util.EnvironmentTickCountSubtract(tickstart);
780 request.BeginGetResponse(delegate(IAsyncResult ar) 782 request.BeginGetResponse(delegate(IAsyncResult ar)
781 { 783 {
782 response = request.EndGetResponse(ar); 784 response = request.EndGetResponse(ar);
@@ -793,7 +795,8 @@ namespace OpenSim.Framework
793 finally 795 finally
794 { 796 {
795 // Let's not close this 797 // Let's not close this
796 //buffer.Close(); 798 // yes do close it
799 buffer.Close();
797 respStream.Close(); 800 respStream.Close();
798 response.Close(); 801 response.Close();
799 } 802 }
@@ -862,7 +865,6 @@ namespace OpenSim.Framework
862 } 865 }
863 866
864 // m_log.DebugFormat("[ASYNC REQUEST]: Received {0}", deserial.ToString()); 867 // m_log.DebugFormat("[ASYNC REQUEST]: Received {0}", deserial.ToString());
865
866 try 868 try
867 { 869 {
868 action(deserial); 870 action(deserial);
@@ -877,9 +879,10 @@ namespace OpenSim.Framework
877 }, null); 879 }, null);
878 } 880 }
879 881
880 int tickdiff = Util.EnvironmentTickCountSubtract(tickstart); 882 tickdiff = Util.EnvironmentTickCountSubtract(tickstart);
881 if (tickdiff > WebUtil.LongCallTime) 883 if (tickdiff > WebUtil.LongCallTime)
882 { 884 {
885/*
883 string originalRequest = null; 886 string originalRequest = null;
884 887
885 if (buffer != null) 888 if (buffer != null)
@@ -898,12 +901,19 @@ namespace OpenSim.Framework
898 tickdiff, 901 tickdiff,
899 tickdata, 902 tickdata,
900 originalRequest); 903 originalRequest);
904*/
905 m_log.InfoFormat(
906 "[ASYNC REQUEST]: Slow WebRequest SETUP <{0}> {1} {2} took {3}ms",
907 reqnum,
908 verb,
909 requestUrl,
910 tickdiff);
901 } 911 }
902 else if (WebUtil.DebugLevel >= 4) 912 else if (WebUtil.DebugLevel >= 4)
903 { 913 {
904 m_log.DebugFormat( 914 m_log.DebugFormat(
905 "[WEB UTIL]: HTTP OUT {0} took {1}ms, {2}ms writing", 915 "[WEB UTIL]: HTTP OUT {0} took {1}ms",
906 reqnum, tickdiff, tickdata); 916 reqnum, tickdiff);
907 } 917 }
908 } 918 }
909 } 919 }
@@ -938,6 +948,8 @@ namespace OpenSim.Framework
938 request.Method = verb; 948 request.Method = verb;
939 string respstring = String.Empty; 949 string respstring = String.Empty;
940 950
951 int tickset = Util.EnvironmentTickCountSubtract(tickstart);
952
941 using (MemoryStream buffer = new MemoryStream()) 953 using (MemoryStream buffer = new MemoryStream())
942 { 954 {
943 if ((verb == "POST") || (verb == "PUT")) 955 if ((verb == "POST") || (verb == "PUT"))
@@ -1017,6 +1029,7 @@ namespace OpenSim.Framework
1017 verb, 1029 verb,
1018 requestUrl, 1030 requestUrl,
1019 tickdiff, 1031 tickdiff,
1032 tickset,
1020 tickdata, 1033 tickdata,
1021 obj.Length > WebUtil.MaxRequestDiagLength ? obj.Remove(WebUtil.MaxRequestDiagLength) : obj); 1034 obj.Length > WebUtil.MaxRequestDiagLength ? obj.Remove(WebUtil.MaxRequestDiagLength) : obj);
1022 else if (WebUtil.DebugLevel >= 4) 1035 else if (WebUtil.DebugLevel >= 4)
@@ -1075,6 +1088,8 @@ namespace OpenSim.Framework
1075 ht.ServicePoint.ConnectionLimit = maxConnections; 1088 ht.ServicePoint.ConnectionLimit = maxConnections;
1076 1089
1077 request.Method = verb; 1090 request.Method = verb;
1091 if (pTimeout != 0)
1092 request.Timeout = pTimeout * 1000;
1078 MemoryStream buffer = null; 1093 MemoryStream buffer = null;
1079 1094
1080 if ((verb == "POST") || (verb == "PUT")) 1095 if ((verb == "POST") || (verb == "PUT"))