aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/AssetBase.cs8
-rw-r--r--OpenSim/Framework/AvatarAppearance.cs111
-rw-r--r--OpenSim/Framework/Communications/RestClient.cs2
-rw-r--r--OpenSim/Framework/EstateSettings.cs56
-rw-r--r--OpenSim/Framework/ICallingCardModule.cs13
-rw-r--r--OpenSim/Framework/IClientAPI.cs11
-rw-r--r--OpenSim/Framework/IMoneyModule.cs1
-rw-r--r--OpenSim/Framework/LandData.cs2
-rw-r--r--OpenSim/Framework/ParcelMediaCommandEnum.cs2
-rw-r--r--OpenSim/Framework/PluginLoader.cs17
-rw-r--r--OpenSim/Framework/PrimitiveBaseShape.cs30
-rw-r--r--OpenSim/Framework/RegionInfo.cs19
-rw-r--r--OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs65
-rw-r--r--OpenSim/Framework/Servers/BaseOpenSimServer.cs2
-rw-r--r--OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs2
-rw-r--r--OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs19
-rw-r--r--OpenSim/Framework/Servers/VersionInfo.cs4
-rw-r--r--OpenSim/Framework/TaskInventoryDictionary.cs162
-rw-r--r--OpenSim/Framework/TaskInventoryItem.cs17
-rw-r--r--OpenSim/Framework/Tests/MundaneFrameworkTests.cs6
-rw-r--r--OpenSim/Framework/UndoStack.cs56
-rw-r--r--OpenSim/Framework/Util.cs52
-rw-r--r--OpenSim/Framework/Watchdog.cs8
-rw-r--r--OpenSim/Framework/WebUtil.cs13
24 files changed, 523 insertions, 155 deletions
diff --git a/OpenSim/Framework/AssetBase.cs b/OpenSim/Framework/AssetBase.cs
index 53d28be..98fa846 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()
@@ -197,6 +199,12 @@ namespace OpenSim.Framework
197 set { m_metadata.Type = value; } 199 set { m_metadata.Type = value; }
198 } 200 }
199 201
202 public int UploadAttempts
203 {
204 get { return m_uploadAttempts; }
205 set { m_uploadAttempts = value; }
206 }
207
200 /// <summary> 208 /// <summary>
201 /// Is this a region only asset, or does this exist on the asset server also 209 /// Is this a region only asset, or does this exist on the asset server also
202 /// </summary> 210 /// </summary>
diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs
index 5a6b265..c0bc47e 100644
--- a/OpenSim/Framework/AvatarAppearance.cs
+++ b/OpenSim/Framework/AvatarAppearance.cs
@@ -256,6 +256,21 @@ namespace OpenSim.Framework
256// } 256// }
257 } 257 }
258 258
259 /// <summary>
260 /// Invalidate all of the baked textures in the appearance, useful
261 /// if you know that none are valid
262 /// </summary>
263 public virtual void ResetBakedTextures()
264 {
265 SetDefaultTexture();
266
267 //for (int i = 0; i < BAKE_INDICES.Length; i++)
268 // {
269 // int idx = BAKE_INDICES[i];
270 // m_texture.FaceTextures[idx].TextureID = UUID.Zero;
271 // }
272 }
273
259 protected virtual void SetDefaultTexture() 274 protected virtual void SetDefaultTexture()
260 { 275 {
261 m_texture = new Primitive.TextureEntry(new UUID(AppearanceManager.DEFAULT_AVATAR_TEXTURE)); 276 m_texture = new Primitive.TextureEntry(new UUID(AppearanceManager.DEFAULT_AVATAR_TEXTURE));
@@ -399,27 +414,36 @@ namespace OpenSim.Framework
399 /// </summary> 414 /// </summary>
400 public List<AvatarAttachment> GetAttachments() 415 public List<AvatarAttachment> GetAttachments()
401 { 416 {
402 List<AvatarAttachment> alist = new List<AvatarAttachment>(); 417 lock (m_attachments)
403 foreach (KeyValuePair<int, List<AvatarAttachment>> kvp in m_attachments)
404 { 418 {
405 foreach (AvatarAttachment attach in kvp.Value) 419 List<AvatarAttachment> alist = new List<AvatarAttachment>();
406 alist.Add(new AvatarAttachment(attach)); 420 foreach (KeyValuePair<int, List<AvatarAttachment>> kvp in m_attachments)
407 } 421 {
422 foreach (AvatarAttachment attach in kvp.Value)
423 alist.Add(new AvatarAttachment(attach));
424 }
408 425
409 return alist; 426 return alist;
427 }
410 } 428 }
411 429
412 internal void AppendAttachment(AvatarAttachment attach) 430 internal void AppendAttachment(AvatarAttachment attach)
413 { 431 {
414 if (! m_attachments.ContainsKey(attach.AttachPoint)) 432 lock (m_attachments)
415 m_attachments[attach.AttachPoint] = new List<AvatarAttachment>(); 433 {
416 m_attachments[attach.AttachPoint].Add(attach); 434 if (!m_attachments.ContainsKey(attach.AttachPoint))
435 m_attachments[attach.AttachPoint] = new List<AvatarAttachment>();
436 m_attachments[attach.AttachPoint].Add(attach);
437 }
417 } 438 }
418 439
419 internal void ReplaceAttachment(AvatarAttachment attach) 440 internal void ReplaceAttachment(AvatarAttachment attach)
420 { 441 {
421 m_attachments[attach.AttachPoint] = new List<AvatarAttachment>(); 442 lock (m_attachments)
422 m_attachments[attach.AttachPoint].Add(attach); 443 {
444 m_attachments[attach.AttachPoint] = new List<AvatarAttachment>();
445 m_attachments[attach.AttachPoint].Add(attach);
446 }
423 } 447 }
424 448
425 /// <summary> 449 /// <summary>
@@ -436,12 +460,15 @@ namespace OpenSim.Framework
436 460
437 if (item == UUID.Zero) 461 if (item == UUID.Zero)
438 { 462 {
439 if (m_attachments.ContainsKey(attachpoint)) 463 lock (m_attachments)
440 { 464 {
441 m_attachments.Remove(attachpoint); 465 if (m_attachments.ContainsKey(attachpoint))
442 return true; 466 {
467 m_attachments.Remove(attachpoint);
468 return true;
469 }
470 return false;
443 } 471 }
444 return false;
445 } 472 }
446 473
447 // check if the item is already attached at this point 474 // check if the item is already attached at this point
@@ -467,30 +494,36 @@ namespace OpenSim.Framework
467 494
468 public int GetAttachpoint(UUID itemID) 495 public int GetAttachpoint(UUID itemID)
469 { 496 {
470 foreach (KeyValuePair<int, List<AvatarAttachment>> kvp in m_attachments) 497 lock (m_attachments)
471 { 498 {
472 int index = kvp.Value.FindIndex(delegate(AvatarAttachment a) { return a.ItemID == itemID; }); 499 foreach (KeyValuePair<int, List<AvatarAttachment>> kvp in m_attachments)
473 if (index >= 0) 500 {
474 return kvp.Key; 501 int index = kvp.Value.FindIndex(delegate(AvatarAttachment a) { return a.ItemID == itemID; });
475 } 502 if (index >= 0)
503 return kvp.Key;
504 }
476 505
477 return 0; 506 return 0;
507 }
478 } 508 }
479 509
480 public bool DetachAttachment(UUID itemID) 510 public bool DetachAttachment(UUID itemID)
481 { 511 {
482 foreach (KeyValuePair<int, List<AvatarAttachment>> kvp in m_attachments) 512 lock (m_attachments)
483 { 513 {
484 int index = kvp.Value.FindIndex(delegate(AvatarAttachment a) { return a.ItemID == itemID; }); 514 foreach (KeyValuePair<int, List<AvatarAttachment>> kvp in m_attachments)
485 if (index >= 0)
486 { 515 {
487 // Remove it from the list of attachments at that attach point 516 int index = kvp.Value.FindIndex(delegate(AvatarAttachment a) { return a.ItemID == itemID; });
488 m_attachments[kvp.Key].RemoveAt(index); 517 if (index >= 0)
518 {
519 // Remove it from the list of attachments at that attach point
520 m_attachments[kvp.Key].RemoveAt(index);
489 521
490 // And remove the list if there are no more attachments here 522 // And remove the list if there are no more attachments here
491 if (m_attachments[kvp.Key].Count == 0) 523 if (m_attachments[kvp.Key].Count == 0)
492 m_attachments.Remove(kvp.Key); 524 m_attachments.Remove(kvp.Key);
493 return true; 525 return true;
526 }
494 } 527 }
495 } 528 }
496 return false; 529 return false;
@@ -498,7 +531,10 @@ namespace OpenSim.Framework
498 531
499 public void ClearAttachments() 532 public void ClearAttachments()
500 { 533 {
501 m_attachments.Clear(); 534 lock (m_attachments)
535 {
536 m_attachments.Clear();
537 }
502 } 538 }
503 539
504 #region Packing Functions 540 #region Packing Functions
@@ -535,11 +571,14 @@ namespace OpenSim.Framework
535 OSDBinary visualparams = new OSDBinary(m_visualparams); 571 OSDBinary visualparams = new OSDBinary(m_visualparams);
536 data["visualparams"] = visualparams; 572 data["visualparams"] = visualparams;
537 573
538 // Attachments 574 lock (m_attachments)
539 OSDArray attachs = new OSDArray(m_attachments.Count); 575 {
540 foreach (AvatarAttachment attach in GetAttachments()) 576 // Attachments
541 attachs.Add(attach.Pack()); 577 OSDArray attachs = new OSDArray(m_attachments.Count);
542 data["attachments"] = attachs; 578 foreach (AvatarAttachment attach in GetAttachments())
579 attachs.Add(attach.Pack());
580 data["attachments"] = attachs;
581 }
543 582
544 return data; 583 return data;
545 } 584 }
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/EstateSettings.cs b/OpenSim/Framework/EstateSettings.cs
index 2a495b0..afbdd49 100644
--- a/OpenSim/Framework/EstateSettings.cs
+++ b/OpenSim/Framework/EstateSettings.cs
@@ -58,6 +58,30 @@ namespace OpenSim.Framework
58 set { m_EstateName = value; } 58 set { m_EstateName = value; }
59 } 59 }
60 60
61 private bool m_AllowLandmark = true;
62
63 public bool AllowLandmark
64 {
65 get { return m_AllowLandmark; }
66 set { m_AllowLandmark = value; }
67 }
68
69 private bool m_AllowParcelChanges = true;
70
71 public bool AllowParcelChanges
72 {
73 get { return m_AllowParcelChanges; }
74 set { m_AllowParcelChanges = value; }
75 }
76
77 private bool m_AllowSetHome = true;
78
79 public bool AllowSetHome
80 {
81 get { return m_AllowSetHome; }
82 set { m_AllowSetHome = value; }
83 }
84
61 private uint m_ParentEstateID = 1; 85 private uint m_ParentEstateID = 1;
62 86
63 public uint ParentEstateID 87 public uint ParentEstateID
@@ -338,11 +362,30 @@ namespace OpenSim.Framework
338 return false; 362 return false;
339 } 363 }
340 364
341 public bool IsBanned(UUID avatarID) 365 public bool IsBanned(UUID avatarID, int userFlags)
342 { 366 {
343 foreach (EstateBan ban in l_EstateBans) 367 foreach (EstateBan ban in l_EstateBans)
344 if (ban.BannedUserID == avatarID) 368 if (ban.BannedUserID == avatarID)
345 return true; 369 return true;
370
371 if (!IsEstateManager(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
346 return false; 389 return false;
347 } 390 }
348 391
@@ -350,7 +393,7 @@ namespace OpenSim.Framework
350 { 393 {
351 if (ban == null) 394 if (ban == null)
352 return; 395 return;
353 if (!IsBanned(ban.BannedUserID)) 396 if (!IsBanned(ban.BannedUserID, 32)) //Ignore age-based bans
354 l_EstateBans.Add(ban); 397 l_EstateBans.Add(ban);
355 } 398 }
356 399
@@ -373,5 +416,14 @@ namespace OpenSim.Framework
373 416
374 return l_EstateAccess.Contains(user); 417 return l_EstateAccess.Contains(user);
375 } 418 }
419
420 public void SetFromFlags(ulong regionFlags)
421 {
422 ResetHomeOnTeleport = ((regionFlags & (ulong)RegionFlags.ResetHomeOnTeleport) == (ulong)RegionFlags.ResetHomeOnTeleport);
423 BlockDwell = ((regionFlags & (ulong)RegionFlags.BlockDwell) == (ulong)RegionFlags.BlockDwell);
424 AllowLandmark = ((regionFlags & (ulong)RegionFlags.AllowLandmark) == (ulong)RegionFlags.AllowLandmark);
425 AllowParcelChanges = ((regionFlags & (ulong)RegionFlags.AllowParcelChanges) == (ulong)RegionFlags.AllowParcelChanges);
426 AllowSetHome = ((regionFlags & (ulong)RegionFlags.AllowSetHome) == (ulong)RegionFlags.AllowSetHome);
427 }
376 } 428 }
377} 429}
diff --git a/OpenSim/Framework/ICallingCardModule.cs b/OpenSim/Framework/ICallingCardModule.cs
new file mode 100644
index 0000000..17e6de35
--- /dev/null
+++ b/OpenSim/Framework/ICallingCardModule.cs
@@ -0,0 +1,13 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using OpenMetaverse;
5using OpenSim.Framework;
6
7namespace OpenSim.Framework
8{
9 public interface ICallingCardModule
10 {
11 UUID CreateCallingCard(UUID userID, UUID creatorID, UUID folderID);
12 }
13}
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index 5bf0b7b..6ec69d3 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -265,6 +265,9 @@ namespace OpenSim.Framework
265 public delegate void MoveInventoryItem( 265 public delegate void MoveInventoryItem(
266 IClientAPI remoteClient, List<InventoryItemBase> items); 266 IClientAPI remoteClient, List<InventoryItemBase> items);
267 267
268 public delegate void MoveItemsAndLeaveCopy(
269 IClientAPI remoteClient, List<InventoryItemBase> items, UUID destFolder);
270
268 public delegate void RemoveInventoryItem( 271 public delegate void RemoveInventoryItem(
269 IClientAPI remoteClient, List<UUID> itemIDs); 272 IClientAPI remoteClient, List<UUID> itemIDs);
270 273
@@ -460,9 +463,9 @@ namespace OpenSim.Framework
460 463
461 public delegate void AgentFOV(IClientAPI client, float verticalAngle); 464 public delegate void AgentFOV(IClientAPI client, float verticalAngle);
462 465
463 public delegate void MuteListEntryUpdate(IClientAPI client, UUID MuteID, string Name, int Flags,UUID AgentID); 466 public delegate void MuteListEntryUpdate(IClientAPI client, UUID MuteID, string Name, int type, uint flags);
464 467
465 public delegate void MuteListEntryRemove(IClientAPI client, UUID MuteID, string Name, UUID AgentID); 468 public delegate void MuteListEntryRemove(IClientAPI client, UUID MuteID, string Name);
466 469
467 public delegate void AvatarInterestReply(IClientAPI client,UUID target, uint wantmask, string wanttext, uint skillsmask, string skillstext, string languages); 470 public delegate void AvatarInterestReply(IClientAPI client,UUID target, uint wantmask, string wanttext, uint skillsmask, string skillstext, string languages);
468 471
@@ -792,6 +795,7 @@ namespace OpenSim.Framework
792 event RequestTaskInventory OnRequestTaskInventory; 795 event RequestTaskInventory OnRequestTaskInventory;
793 event UpdateInventoryItem OnUpdateInventoryItem; 796 event UpdateInventoryItem OnUpdateInventoryItem;
794 event CopyInventoryItem OnCopyInventoryItem; 797 event CopyInventoryItem OnCopyInventoryItem;
798 event MoveItemsAndLeaveCopy OnMoveItemsAndLeaveCopy;
795 event MoveInventoryItem OnMoveInventoryItem; 799 event MoveInventoryItem OnMoveInventoryItem;
796 event RemoveInventoryFolder OnRemoveInventoryFolder; 800 event RemoveInventoryFolder OnRemoveInventoryFolder;
797 event RemoveInventoryItem OnRemoveInventoryItem; 801 event RemoveInventoryItem OnRemoveInventoryItem;
@@ -962,6 +966,7 @@ namespace OpenSim.Framework
962 void InPacket(object NewPack); 966 void InPacket(object NewPack);
963 void ProcessInPacket(Packet NewPack); 967 void ProcessInPacket(Packet NewPack);
964 void Close(); 968 void Close();
969 void Close(bool sendStop);
965 void Kick(string message); 970 void Kick(string message);
966 971
967 /// <summary> 972 /// <summary>
@@ -993,7 +998,7 @@ namespace OpenSim.Framework
993 /// </summary> 998 /// </summary>
994 /// <param name="regionHandle"></param> 999 /// <param name="regionHandle"></param>
995 /// <param name="localID"></param> 1000 /// <param name="localID"></param>
996 void SendKillObject(ulong regionHandle, uint localID); 1001 void SendKillObject(ulong regionHandle, List<uint> localID);
997 1002
998 void SendAnimations(UUID[] animID, int[] seqs, UUID sourceAgentId, UUID[] objectIDs); 1003 void SendAnimations(UUID[] animID, int[] seqs, UUID sourceAgentId, UUID[] objectIDs);
999 void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args); 1004 void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args);
diff --git a/OpenSim/Framework/IMoneyModule.cs b/OpenSim/Framework/IMoneyModule.cs
index 3d4873d..ea6ed4b 100644
--- a/OpenSim/Framework/IMoneyModule.cs
+++ b/OpenSim/Framework/IMoneyModule.cs
@@ -40,6 +40,7 @@ namespace OpenSim.Framework
40 bool AmountCovered(IClientAPI client, int amount); 40 bool AmountCovered(IClientAPI client, int amount);
41 void ApplyCharge(UUID agentID, int amount, string text); 41 void ApplyCharge(UUID agentID, int amount, string text);
42 void ApplyUploadCharge(UUID agentID, int amount, string text); 42 void ApplyUploadCharge(UUID agentID, int amount, string text);
43 void MoveMoney(UUID fromUser, UUID toUser, int amount, string text);
43 44
44 int UploadCharge { get; } 45 int UploadCharge { get; }
45 int GroupCreationCharge { get; } 46 int GroupCreationCharge { get; }
diff --git a/OpenSim/Framework/LandData.cs b/OpenSim/Framework/LandData.cs
index c107143..282a128 100644
--- a/OpenSim/Framework/LandData.cs
+++ b/OpenSim/Framework/LandData.cs
@@ -60,7 +60,7 @@ namespace OpenSim.Framework
60 60
61 private uint _flags = (uint) ParcelFlags.AllowFly | (uint) ParcelFlags.AllowLandmark | 61 private uint _flags = (uint) ParcelFlags.AllowFly | (uint) ParcelFlags.AllowLandmark |
62 (uint) ParcelFlags.AllowAPrimitiveEntry | 62 (uint) ParcelFlags.AllowAPrimitiveEntry |
63 (uint) ParcelFlags.AllowDeedToGroup | (uint) ParcelFlags.AllowTerraform | 63 (uint) ParcelFlags.AllowDeedToGroup |
64 (uint) ParcelFlags.CreateObjects | (uint) ParcelFlags.AllowOtherScripts | 64 (uint) ParcelFlags.CreateObjects | (uint) ParcelFlags.AllowOtherScripts |
65 (uint) ParcelFlags.SoundLocal; 65 (uint) ParcelFlags.SoundLocal;
66 66
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 7b5fb2e..44f484e 100644
--- a/OpenSim/Framework/PrimitiveBaseShape.cs
+++ b/OpenSim/Framework/PrimitiveBaseShape.cs
@@ -708,7 +708,12 @@ namespace OpenSim.Framework
708 return _lightColorR; 708 return _lightColorR;
709 } 709 }
710 set { 710 set {
711 _lightColorR = value; 711 if (value < 0)
712 _lightColorR = 0;
713 else if (value > 1.0f)
714 _lightColorR = 1.0f;
715 else
716 _lightColorR = value;
712 } 717 }
713 } 718 }
714 719
@@ -717,7 +722,12 @@ namespace OpenSim.Framework
717 return _lightColorG; 722 return _lightColorG;
718 } 723 }
719 set { 724 set {
720 _lightColorG = value; 725 if (value < 0)
726 _lightColorG = 0;
727 else if (value > 1.0f)
728 _lightColorG = 1.0f;
729 else
730 _lightColorG = value;
721 } 731 }
722 } 732 }
723 733
@@ -726,7 +736,12 @@ namespace OpenSim.Framework
726 return _lightColorB; 736 return _lightColorB;
727 } 737 }
728 set { 738 set {
729 _lightColorB = value; 739 if (value < 0)
740 _lightColorB = 0;
741 else if (value > 1.0f)
742 _lightColorB = 1.0f;
743 else
744 _lightColorB = value;
730 } 745 }
731 } 746 }
732 747
@@ -735,7 +750,12 @@ namespace OpenSim.Framework
735 return _lightColorA; 750 return _lightColorA;
736 } 751 }
737 set { 752 set {
738 _lightColorA = value; 753 if (value < 0)
754 _lightColorA = 0;
755 else if (value > 1.0f)
756 _lightColorA = 1.0f;
757 else
758 _lightColorA = value;
739 } 759 }
740 } 760 }
741 761
@@ -1333,7 +1353,7 @@ namespace OpenSim.Framework
1333 prim.Textures = this.Textures; 1353 prim.Textures = this.Textures;
1334 1354
1335 prim.Properties = new Primitive.ObjectProperties(); 1355 prim.Properties = new Primitive.ObjectProperties();
1336 prim.Properties.Name = "Primitive"; 1356 prim.Properties.Name = "Object";
1337 prim.Properties.Description = ""; 1357 prim.Properties.Description = "";
1338 prim.Properties.CreatorID = UUID.Zero; 1358 prim.Properties.CreatorID = UUID.Zero;
1339 prim.Properties.GroupID = UUID.Zero; 1359 prim.Properties.GroupID = UUID.Zero;
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs
index daf0a25..d154bff 100644
--- a/OpenSim/Framework/RegionInfo.cs
+++ b/OpenSim/Framework/RegionInfo.cs
@@ -40,6 +40,7 @@ using OpenSim.Framework.Console;
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;
@@ -347,6 +348,7 @@ namespace OpenSim.Framework
347 348
348 public bool commFailTF = false; 349 public bool commFailTF = false;
349 public ConfigurationMember configMember; 350 public ConfigurationMember configMember;
351 public string DataStore = String.Empty;
350 public string RegionFile = String.Empty; 352 public string RegionFile = String.Empty;
351 public bool isSandbox = false; 353 public bool isSandbox = false;
352 public bool Persistent = true; 354 public bool Persistent = true;
@@ -745,6 +747,10 @@ namespace OpenSim.Framework
745 m_regionLocX = Convert.ToUInt32(locationElements[0]); 747 m_regionLocX = Convert.ToUInt32(locationElements[0]);
746 m_regionLocY = Convert.ToUInt32(locationElements[1]); 748 m_regionLocY = Convert.ToUInt32(locationElements[1]);
747 749
750
751 // Datastore (is this implemented? Omitted from example!)
752 DataStore = config.GetString("Datastore", String.Empty);
753
748 // Internal IP 754 // Internal IP
749 IPAddress address; 755 IPAddress address;
750 756
@@ -841,6 +847,9 @@ namespace OpenSim.Framework
841 string location = String.Format("{0},{1}", m_regionLocX, m_regionLocY); 847 string location = String.Format("{0},{1}", m_regionLocX, m_regionLocY);
842 config.Set("Location", location); 848 config.Set("Location", location);
843 849
850 if (DataStore != String.Empty)
851 config.Set("Datastore", DataStore);
852
844 config.Set("InternalAddress", m_internalEndPoint.Address.ToString()); 853 config.Set("InternalAddress", m_internalEndPoint.Address.ToString());
845 config.Set("InternalPort", m_internalEndPoint.Port); 854 config.Set("InternalPort", m_internalEndPoint.Port);
846 855
@@ -1017,6 +1026,9 @@ namespace OpenSim.Framework
1017 case "sim_location_y": 1026 case "sim_location_y":
1018 m_regionLocY = (uint) configuration_result; 1027 m_regionLocY = (uint) configuration_result;
1019 break; 1028 break;
1029 case "datastore":
1030 DataStore = (string) configuration_result;
1031 break;
1020 case "internal_ip_address": 1032 case "internal_ip_address":
1021 IPAddress address = (IPAddress) configuration_result; 1033 IPAddress address = (IPAddress) configuration_result;
1022 m_internalEndPoint = new IPEndPoint(address, 0); 1034 m_internalEndPoint = new IPEndPoint(address, 0);
@@ -1164,6 +1176,11 @@ namespace OpenSim.Framework
1164 return regionInfo; 1176 return regionInfo;
1165 } 1177 }
1166 1178
1179 public int getInternalEndPointPort()
1180 {
1181 return m_internalEndPoint.Port;
1182 }
1183
1167 public Dictionary<string, object> ToKeyValuePairs() 1184 public Dictionary<string, object> ToKeyValuePairs()
1168 { 1185 {
1169 Dictionary<string, object> kvp = new Dictionary<string, object>(); 1186 Dictionary<string, object> kvp = new Dictionary<string, object>();
@@ -1182,4 +1199,4 @@ namespace OpenSim.Framework
1182 return kvp; 1199 return kvp;
1183 } 1200 }
1184 } 1201 }
1185} \ No newline at end of file 1202}
diff --git a/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs b/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs
index de4898a..f0ffc2c 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!");
@@ -64,35 +67,47 @@ namespace OpenSim.Framework.RegionLoader.Web
64 } 67 }
65 else 68 else
66 { 69 {
67 HttpWebRequest webRequest = (HttpWebRequest) WebRequest.Create(url); 70 while (tries > 0)
68 webRequest.Timeout = 30000; //30 Second Timeout
69 m_log.DebugFormat("[WEBLOADER]: Sending download request to {0}", url);
70 HttpWebResponse webResponse = (HttpWebResponse) webRequest.GetResponse();
71 m_log.Debug("[WEBLOADER]: Downloading region information...");
72 StreamReader reader = new StreamReader(webResponse.GetResponseStream());
73 string xmlSource = String.Empty;
74 string tempStr = reader.ReadLine();
75 while (tempStr != null)
76 {
77 xmlSource = xmlSource + tempStr;
78 tempStr = reader.ReadLine();
79 }
80 m_log.Debug("[WEBLOADER]: Done downloading region information from server. Total Bytes: " +
81 xmlSource.Length);
82 XmlDocument xmlDoc = new XmlDocument();
83 xmlDoc.LoadXml(xmlSource);
84 if (xmlDoc.FirstChild.Name == "Regions")
85 { 71 {
86 RegionInfo[] regionInfos = new RegionInfo[xmlDoc.FirstChild.ChildNodes.Count]; 72 HttpWebRequest webRequest = (HttpWebRequest) WebRequest.Create(url);
87 int i; 73 webRequest.Timeout = 30000; //30 Second Timeout
88 for (i = 0; i < xmlDoc.FirstChild.ChildNodes.Count; i++) 74 m_log.Debug("[WEBLOADER]: Sending Download Request...");
75 HttpWebResponse webResponse = (HttpWebResponse) webRequest.GetResponse();
76 m_log.Debug("[WEBLOADER]: Downloading Region Information From Remote Server...");
77 StreamReader reader = new StreamReader(webResponse.GetResponseStream());
78 string xmlSource = String.Empty;
79 string tempStr = reader.ReadLine();
80 while (tempStr != null)
81 {
82 xmlSource = xmlSource + tempStr;
83 tempStr = reader.ReadLine();
84 }
85 m_log.Debug("[WEBLOADER]: Done downloading region information from server. Total Bytes: " +
86 xmlSource.Length);
87 XmlDocument xmlDoc = new XmlDocument();
88 xmlDoc.LoadXml(xmlSource);
89 if (xmlDoc.FirstChild.Name == "Regions")
89 { 90 {
90 m_log.Debug(xmlDoc.FirstChild.ChildNodes[i].OuterXml); 91 RegionInfo[] regionInfos = new RegionInfo[xmlDoc.FirstChild.ChildNodes.Count];
91 regionInfos[i] = 92 int i;
92 new RegionInfo("REGION CONFIG #" + (i + 1), xmlDoc.FirstChild.ChildNodes[i],false,m_configSource); 93 for (i = 0; i < xmlDoc.FirstChild.ChildNodes.Count; i++)
94 {
95 m_log.Debug(xmlDoc.FirstChild.ChildNodes[i].OuterXml);
96 regionInfos[i] =
97 new RegionInfo("REGION CONFIG #" + (i + 1), xmlDoc.FirstChild.ChildNodes[i],false,m_configSource);
98 }
99
100 if (i > 0)
101 return regionInfos;
93 } 102 }
94 103
95 return regionInfos; 104 m_log.Debug("[WEBLOADER]: Request yielded no regions.");
105 tries--;
106 if (tries > 0)
107 {
108 m_log.Debug("[WEBLOADER]: Retrying");
109 System.Threading.Thread.Sleep(wait);
110 }
96 } 111 }
97 return null; 112 return null;
98 } 113 }
diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
index 21e1e09..5c3cad4 100644
--- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs
+++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
@@ -280,7 +280,7 @@ namespace OpenSim.Framework.Servers
280 280
281 EnhanceVersionInformation(); 281 EnhanceVersionInformation();
282 282
283 m_log.Info("[STARTUP]: OpenSimulator version: " + m_version + Environment.NewLine); 283 m_log.Info("[STARTUP]: Careminster version: " + m_version + Environment.NewLine);
284 // clr version potentially is more confusing than helpful, since it doesn't tell us if we're running under Mono/MS .NET and 284 // clr version potentially is more confusing than helpful, since it doesn't tell us if we're running under Mono/MS .NET and
285 // the clr version number doesn't match the project version number under Mono. 285 // the clr version number doesn't match the project version number under Mono.
286 //m_log.Info("[STARTUP]: Virtual machine runtime version: " + Environment.Version + Environment.NewLine); 286 //m_log.Info("[STARTUP]: Virtual machine runtime version: " + Environment.Version + Environment.NewLine);
diff --git a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs
index 41ece86..d5646d0 100644
--- a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs
+++ b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs
@@ -83,7 +83,7 @@ namespace OpenSim.Framework.Servers.HttpServer
83 } 83 }
84 catch (Exception e) 84 catch (Exception e)
85 { 85 {
86 m_log.DebugFormat("[FORMS]: exception occured on sending request to {0}: " + e.ToString(), requestUrl); 86 m_log.DebugFormat("[FORMS]: exception occured on sending request to {0}: with {1} " + e.ToString(), requestUrl,obj);
87 } 87 }
88 finally 88 finally
89 { 89 {
diff --git a/OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs b/OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs
index eab463c..077a1e8 100644
--- a/OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs
+++ b/OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs
@@ -57,11 +57,27 @@ namespace OpenSim.Framework.Servers.HttpServer
57 /// the request. You'll want to make sure you deal with this as they're not uncommon</exception> 57 /// the request. You'll want to make sure you deal with this as they're not uncommon</exception>
58 public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj) 58 public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj)
59 { 59 {
60 return MakeRequest<TRequest, TResponse>(verb, requestUrl, obj, 100);
61 }
62 /// <summary>
63 /// Perform a synchronous REST request.
64 /// </summary>
65 /// <param name="verb"></param>
66 /// <param name="requestUrl"></param>
67 /// <param name="obj"> </param>
68 /// <param name="timeout"> </param>
69 /// <returns></returns>
70 ///
71 /// <exception cref="System.Net.WebException">Thrown if we encounter a network issue while posting
72 /// the request. You'll want to make sure you deal with this as they're not uncommon</exception>
73 public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj, int pTimeout)
74 {
60 Type type = typeof (TRequest); 75 Type type = typeof (TRequest);
61 TResponse deserial = default(TResponse); 76 TResponse deserial = default(TResponse);
62 77
63 WebRequest request = WebRequest.Create(requestUrl); 78 WebRequest request = WebRequest.Create(requestUrl);
64 request.Method = verb; 79 request.Method = verb;
80 request.Timeout = pTimeout * 1000;
65 81
66 if ((verb == "POST") || (verb == "PUT")) 82 if ((verb == "POST") || (verb == "PUT"))
67 { 83 {
@@ -81,7 +97,6 @@ namespace OpenSim.Framework.Servers.HttpServer
81 97
82 int length = (int) buffer.Length; 98 int length = (int) buffer.Length;
83 request.ContentLength = length; 99 request.ContentLength = length;
84
85 Stream requestStream = null; 100 Stream requestStream = null;
86 try 101 try
87 { 102 {
@@ -103,7 +118,7 @@ namespace OpenSim.Framework.Servers.HttpServer
103 { 118 {
104 using (WebResponse resp = request.GetResponse()) 119 using (WebResponse resp = request.GetResponse())
105 { 120 {
106 if (resp.ContentLength > 0) 121 if (resp.ContentLength != 0)
107 { 122 {
108 Stream respStream = resp.GetResponseStream(); 123 Stream respStream = resp.GetResponseStream();
109 XmlSerializer deserializer = new XmlSerializer(typeof(TResponse)); 124 XmlSerializer deserializer = new XmlSerializer(typeof(TResponse));
diff --git a/OpenSim/Framework/Servers/VersionInfo.cs b/OpenSim/Framework/Servers/VersionInfo.cs
index c9d4c93..ce6ecf8 100644
--- a/OpenSim/Framework/Servers/VersionInfo.cs
+++ b/OpenSim/Framework/Servers/VersionInfo.cs
@@ -33,7 +33,7 @@ namespace OpenSim
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,
@@ -49,7 +49,7 @@ namespace OpenSim
49 49
50 public static string GetVersionString(string versionNumber, Flavour flavour) 50 public static string GetVersionString(string versionNumber, Flavour flavour)
51 { 51 {
52 string versionString = "OpenSim " + versionNumber + " " + flavour; 52 string versionString = "Careminster " + versionNumber + " " + flavour;
53 return versionString.PadRight(VERSIONINFO_VERSION_LENGTH); 53 return versionString.PadRight(VERSIONINFO_VERSION_LENGTH);
54 } 54 }
55 55
diff --git a/OpenSim/Framework/TaskInventoryDictionary.cs b/OpenSim/Framework/TaskInventoryDictionary.cs
index 25ae6b0..814758a 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
@@ -45,6 +49,155 @@ namespace OpenSim.Framework
45 // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 49 // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
46 50
47 private static XmlSerializer tiiSerializer = new XmlSerializer(typeof (TaskInventoryItem)); 51 private static XmlSerializer tiiSerializer = new XmlSerializer(typeof (TaskInventoryItem));
52 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
53
54 private Thread LockedByThread;
55 private string WriterStack;
56
57 private Dictionary<Thread, string> ReadLockers =
58 new Dictionary<Thread, string>();
59
60 /// <value>
61 /// An advanced lock for inventory data
62 /// </value>
63 private System.Threading.ReaderWriterLockSlim m_itemLock = new System.Threading.ReaderWriterLockSlim();
64
65 /// <summary>
66 /// Are we readlocked by the calling thread?
67 /// </summary>
68 public bool IsReadLockedByMe()
69 {
70 if (m_itemLock.RecursiveReadCount > 0)
71 {
72 return true;
73 }
74 else
75 {
76 return false;
77 }
78 }
79
80 /// <summary>
81 /// Lock our inventory list for reading (many can read, one can write)
82 /// </summary>
83 public void LockItemsForRead(bool locked)
84 {
85 if (locked)
86 {
87 if (m_itemLock.IsWriteLockHeld && LockedByThread != null)
88 {
89 if (!LockedByThread.IsAlive)
90 {
91 //Locked by dead thread, reset.
92 m_itemLock = new System.Threading.ReaderWriterLockSlim();
93 }
94 }
95
96 if (m_itemLock.RecursiveReadCount > 0)
97 {
98 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.");
99 try
100 {
101 StackTrace stackTrace = new StackTrace(); // get call stack
102 StackFrame[] stackFrames = stackTrace.GetFrames(); // get method calls (frames)
103
104 // write call stack method names
105 foreach (StackFrame stackFrame in stackFrames)
106 {
107 m_log.Error("[SceneObjectGroup.m_parts] "+(stackFrame.GetMethod().Name)); // write method name
108 }
109 }
110 catch
111 {}
112 m_itemLock.ExitReadLock();
113 }
114 if (m_itemLock.RecursiveWriteCount > 0)
115 {
116 m_log.Error("[TaskInventoryDictionary] Recursive write lock requested. This should not happen and means something needs to be fixed.");
117 m_itemLock.ExitWriteLock();
118 }
119
120 while (!m_itemLock.TryEnterReadLock(60000))
121 {
122 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.");
123 if (m_itemLock.IsWriteLockHeld)
124 {
125 m_itemLock = new System.Threading.ReaderWriterLockSlim();
126 System.Console.WriteLine("------------------------------------------");
127 System.Console.WriteLine("My call stack:\n" + Environment.StackTrace);
128 System.Console.WriteLine("------------------------------------------");
129 System.Console.WriteLine("Locker's call stack:\n" + WriterStack);
130 System.Console.WriteLine("------------------------------------------");
131 LockedByThread = null;
132 ReadLockers.Clear();
133 }
134 }
135 }
136 else
137 {
138 if (m_itemLock.RecursiveReadCount>0)
139 {
140 m_itemLock.ExitReadLock();
141 }
142 }
143 }
144
145 /// <summary>
146 /// Lock our inventory list for writing (many can read, one can write)
147 /// </summary>
148 public void LockItemsForWrite(bool locked)
149 {
150 if (locked)
151 {
152 //Enter a write lock, wait indefinately for one to open.
153 if (m_itemLock.RecursiveReadCount > 0)
154 {
155 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.");
156 m_itemLock.ExitReadLock();
157 }
158 if (m_itemLock.RecursiveWriteCount > 0)
159 {
160 m_log.Error("[TaskInventoryDictionary] Recursive write lock requested. This should not happen and means something needs to be fixed.");
161 m_itemLock.ExitWriteLock();
162 }
163 while (!m_itemLock.TryEnterWriteLock(60000))
164 {
165 if (m_itemLock.IsWriteLockHeld)
166 {
167 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.");
168 System.Console.WriteLine("------------------------------------------");
169 System.Console.WriteLine("My call stack:\n" + Environment.StackTrace);
170 System.Console.WriteLine("------------------------------------------");
171 System.Console.WriteLine("Locker's call stack:\n" + WriterStack);
172 System.Console.WriteLine("------------------------------------------");
173 }
174 else
175 {
176 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.");
177 System.Console.WriteLine("------------------------------------------");
178 System.Console.WriteLine("My call stack:\n" + Environment.StackTrace);
179 System.Console.WriteLine("------------------------------------------");
180 foreach (KeyValuePair<Thread, string> kvp in ReadLockers)
181 {
182 System.Console.WriteLine("Locker name {0} call stack:\n" + kvp.Value, kvp.Key.Name);
183 System.Console.WriteLine("------------------------------------------");
184 }
185 }
186 m_itemLock = new System.Threading.ReaderWriterLockSlim();
187 ReadLockers.Clear();
188 }
189
190 LockedByThread = Thread.CurrentThread;
191 WriterStack = Environment.StackTrace;
192 }
193 else
194 {
195 if (m_itemLock.RecursiveWriteCount > 0)
196 {
197 m_itemLock.ExitWriteLock();
198 }
199 }
200 }
48 201
49 #region ICloneable Members 202 #region ICloneable Members
50 203
@@ -52,13 +205,12 @@ namespace OpenSim.Framework
52 { 205 {
53 TaskInventoryDictionary clone = new TaskInventoryDictionary(); 206 TaskInventoryDictionary clone = new TaskInventoryDictionary();
54 207
55 lock (this) 208 m_itemLock.EnterReadLock();
209 foreach (UUID uuid in Keys)
56 { 210 {
57 foreach (UUID uuid in Keys) 211 clone.Add(uuid, (TaskInventoryItem) this[uuid].Clone());
58 {
59 clone.Add(uuid, (TaskInventoryItem) this[uuid].Clone());
60 }
61 } 212 }
213 m_itemLock.ExitReadLock();
62 214
63 return clone; 215 return clone;
64 } 216 }
diff --git a/OpenSim/Framework/TaskInventoryItem.cs b/OpenSim/Framework/TaskInventoryItem.cs
index 30d775c..be2b8c8 100644
--- a/OpenSim/Framework/TaskInventoryItem.cs
+++ b/OpenSim/Framework/TaskInventoryItem.cs
@@ -121,9 +121,12 @@ namespace OpenSim.Framework
121 private UUID _permsGranter; 121 private UUID _permsGranter;
122 private int _permsMask; 122 private int _permsMask;
123 private int _type = 0; 123 private int _type = 0;
124 private UUID _oldID; 124 private UUID _oldID = UUID.Zero;
125 125
126 private bool _ownerChanged = false; 126 private bool _ownerChanged = false;
127
128 // This used ONLY during copy. It can't be relied on at other times!
129 private bool _scriptRunning = true;
127 130
128 public UUID AssetID { 131 public UUID AssetID {
129 get { 132 get {
@@ -387,6 +390,15 @@ namespace OpenSim.Framework
387 } 390 }
388 } 391 }
389 392
393 public bool ScriptRunning {
394 get {
395 return _scriptRunning;
396 }
397 set {
398 _scriptRunning = value;
399 }
400 }
401
390 // See ICloneable 402 // See ICloneable
391 403
392 #region ICloneable Members 404 #region ICloneable Members
@@ -404,7 +416,8 @@ namespace OpenSim.Framework
404 /// <param name="partID">The new part ID to which this item belongs</param> 416 /// <param name="partID">The new part ID to which this item belongs</param>
405 public void ResetIDs(UUID partID) 417 public void ResetIDs(UUID partID)
406 { 418 {
407 OldItemID = ItemID; 419 if (_oldID == UUID.Zero)
420 _oldID = ItemID;
408 ItemID = UUID.Random(); 421 ItemID = UUID.Random();
409 ParentPartID = partID; 422 ParentPartID = partID;
410 ParentID = partID; 423 ParentID = partID;
diff --git a/OpenSim/Framework/Tests/MundaneFrameworkTests.cs b/OpenSim/Framework/Tests/MundaneFrameworkTests.cs
index e7f8bfc..e131260 100644
--- a/OpenSim/Framework/Tests/MundaneFrameworkTests.cs
+++ b/OpenSim/Framework/Tests/MundaneFrameworkTests.cs
@@ -217,12 +217,12 @@ namespace OpenSim.Framework.Tests
217 BannedHostNameMask = string.Empty, 217 BannedHostNameMask = string.Empty,
218 BannedUserID = bannedUserId} 218 BannedUserID = bannedUserId}
219 ); 219 );
220 Assert.IsTrue(es.IsBanned(bannedUserId), "User Should be banned but is not."); 220 Assert.IsTrue(es.IsBanned(bannedUserId, 32), "User Should be banned but is not.");
221 Assert.IsFalse(es.IsBanned(UUID.Zero), "User Should not be banned but is."); 221 Assert.IsFalse(es.IsBanned(UUID.Zero, 32), "User Should not be banned but is.");
222 222
223 es.RemoveBan(bannedUserId); 223 es.RemoveBan(bannedUserId);
224 224
225 Assert.IsFalse(es.IsBanned(bannedUserId), "User Should not be banned but is."); 225 Assert.IsFalse(es.IsBanned(bannedUserId, 32), "User Should not be banned but is.");
226 226
227 es.AddEstateManager(UUID.Zero); 227 es.AddEstateManager(UUID.Zero);
228 228
diff --git a/OpenSim/Framework/UndoStack.cs b/OpenSim/Framework/UndoStack.cs
index fde63b1..4cd779a 100644
--- a/OpenSim/Framework/UndoStack.cs
+++ b/OpenSim/Framework/UndoStack.cs
@@ -26,6 +26,7 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections.Generic;
29 30
30namespace OpenSim.Framework 31namespace OpenSim.Framework
31{ 32{
@@ -36,33 +37,30 @@ namespace OpenSim.Framework
36 [Serializable] 37 [Serializable]
37 public class UndoStack<T> 38 public class UndoStack<T>
38 { 39 {
39 private int m_new = 1; 40 private List<T> m_undolist;
40 private int m_old = 0; 41 private int m_max;
41 private T[] m_Undos;
42 42
43 public UndoStack(int capacity) 43 public UndoStack(int capacity)
44 { 44 {
45 m_Undos = new T[capacity + 1]; 45 m_undolist = new List<T>();
46 m_max = capacity;
46 } 47 }
47 48
48 public bool IsFull 49 public bool IsFull
49 { 50 {
50 get { return m_new == m_old; } 51 get { return m_undolist.Count >= m_max; }
51 } 52 }
52 53
53 public int Capacity 54 public int Capacity
54 { 55 {
55 get { return m_Undos.Length - 1; } 56 get { return m_max; }
56 } 57 }
57 58
58 public int Count 59 public int Count
59 { 60 {
60 get 61 get
61 { 62 {
62 int count = m_new - m_old - 1; 63 return m_undolist.Count;
63 if (count < 0)
64 count += m_Undos.Length;
65 return count;
66 } 64 }
67 } 65 }
68 66
@@ -70,24 +68,19 @@ namespace OpenSim.Framework
70 { 68 {
71 if (IsFull) 69 if (IsFull)
72 { 70 {
73 m_old++; 71 m_undolist.RemoveAt(0);
74 if (m_old >= m_Undos.Length)
75 m_old -= m_Undos.Length;
76 } 72 }
77 if (++m_new >= m_Undos.Length) 73 m_undolist.Add(item);
78 m_new -= m_Undos.Length;
79 m_Undos[m_new] = item;
80 } 74 }
81 75
82 public T Pop() 76 public T Pop()
83 { 77 {
84 if (Count > 0) 78 if (m_undolist.Count > 0)
85 { 79 {
86 T deleted = m_Undos[m_new]; 80 int ind = m_undolist.Count - 1;
87 m_Undos[m_new--] = default(T); 81 T item = m_undolist[ind];
88 if (m_new < 0) 82 m_undolist.RemoveAt(ind);
89 m_new += m_Undos.Length; 83 return item;
90 return deleted;
91 } 84 }
92 else 85 else
93 throw new InvalidOperationException("Cannot pop from empty stack"); 86 throw new InvalidOperationException("Cannot pop from empty stack");
@@ -95,20 +88,19 @@ namespace OpenSim.Framework
95 88
96 public T Peek() 89 public T Peek()
97 { 90 {
98 return m_Undos[m_new]; 91 if (m_undolist.Count > 0)
92 {
93 return m_undolist[m_undolist.Count - 1];
94 }
95 else
96 {
97 return default(T);
98 }
99 } 99 }
100 100
101 public void Clear() 101 public void Clear()
102 { 102 {
103 if (Count > 0) 103 m_undolist.Clear();
104 {
105 for (int i = 0; i < m_Undos.Length; i++)
106 {
107 m_Undos[i] = default(T);
108 }
109 m_new = 1;
110 m_old = 0;
111 }
112 } 104 }
113 } 105 }
114} 106}
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 5a5046e..3f676f9 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -409,19 +409,25 @@ namespace OpenSim.Framework
409 /// </summary> 409 /// </summary>
410 /// <param name="data"></param> 410 /// <param name="data"></param>
411 /// <returns></returns> 411 /// <returns></returns>
412
412 public static string Md5Hash(string data) 413 public static string Md5Hash(string data)
413 { 414 {
414 byte[] dataMd5 = ComputeMD5Hash(data); 415 return Md5Hash(data, Encoding.Default);
416 }
417
418 public static string Md5Hash(string data, Encoding encoding)
419 {
420 byte[] dataMd5 = ComputeMD5Hash(data, encoding);
415 StringBuilder sb = new StringBuilder(); 421 StringBuilder sb = new StringBuilder();
416 for (int i = 0; i < dataMd5.Length; i++) 422 for (int i = 0; i < dataMd5.Length; i++)
417 sb.AppendFormat("{0:x2}", dataMd5[i]); 423 sb.AppendFormat("{0:x2}", dataMd5[i]);
418 return sb.ToString(); 424 return sb.ToString();
419 } 425 }
420 426
421 private static byte[] ComputeMD5Hash(string data) 427 private static byte[] ComputeMD5Hash(string data, Encoding encoding)
422 { 428 {
423 MD5 md5 = MD5.Create(); 429 MD5 md5 = MD5.Create();
424 return md5.ComputeHash(Encoding.Default.GetBytes(data)); 430 return md5.ComputeHash(encoding.GetBytes(data));
425 } 431 }
426 432
427 /// <summary> 433 /// <summary>
@@ -429,16 +435,22 @@ namespace OpenSim.Framework
429 /// </summary> 435 /// </summary>
430 /// <param name="data"></param> 436 /// <param name="data"></param>
431 /// <returns></returns> 437 /// <returns></returns>
438
432 public static string SHA1Hash(string data) 439 public static string SHA1Hash(string data)
433 { 440 {
434 byte[] hash = ComputeSHA1Hash(data); 441 return SHA1Hash(data, Encoding.Default);
442 }
443
444 public static string SHA1Hash(string data, Encoding encoding)
445 {
446 byte[] hash = ComputeSHA1Hash(data, encoding);
435 return BitConverter.ToString(hash).Replace("-", String.Empty); 447 return BitConverter.ToString(hash).Replace("-", String.Empty);
436 } 448 }
437 449
438 private static byte[] ComputeSHA1Hash(string src) 450 private static byte[] ComputeSHA1Hash(string src, Encoding encoding)
439 { 451 {
440 SHA1CryptoServiceProvider SHA1 = new SHA1CryptoServiceProvider(); 452 SHA1CryptoServiceProvider SHA1 = new SHA1CryptoServiceProvider();
441 return SHA1.ComputeHash(Encoding.Default.GetBytes(src)); 453 return SHA1.ComputeHash(encoding.GetBytes(src));
442 } 454 }
443 455
444 public static int fast_distance2d(int x, int y) 456 public static int fast_distance2d(int x, int y)
@@ -1023,19 +1035,19 @@ namespace OpenSim.Framework
1023 { 1035 {
1024 string os = String.Empty; 1036 string os = String.Empty;
1025 1037
1026 if (Environment.OSVersion.Platform != PlatformID.Unix) 1038// if (Environment.OSVersion.Platform != PlatformID.Unix)
1027 { 1039// {
1028 os = Environment.OSVersion.ToString(); 1040// os = Environment.OSVersion.ToString();
1029 } 1041// }
1030 else 1042// else
1031 { 1043// {
1032 os = ReadEtcIssue(); 1044// os = ReadEtcIssue();
1033 } 1045// }
1034 1046//
1035 if (os.Length > 45) 1047// if (os.Length > 45)
1036 { 1048// {
1037 os = os.Substring(0, 45); 1049// os = os.Substring(0, 45);
1038 } 1050// }
1039 1051
1040 return os; 1052 return os;
1041 } 1053 }
@@ -1168,7 +1180,7 @@ namespace OpenSim.Framework
1168 1180
1169 public static Guid GetHashGuid(string data, string salt) 1181 public static Guid GetHashGuid(string data, string salt)
1170 { 1182 {
1171 byte[] hash = ComputeMD5Hash(data + salt); 1183 byte[] hash = ComputeMD5Hash(data + salt, Encoding.Default);
1172 1184
1173 //string s = BitConverter.ToString(hash); 1185 //string s = BitConverter.ToString(hash);
1174 1186
diff --git a/OpenSim/Framework/Watchdog.cs b/OpenSim/Framework/Watchdog.cs
index 0f34e83..3389ecb 100644
--- a/OpenSim/Framework/Watchdog.cs
+++ b/OpenSim/Framework/Watchdog.cs
@@ -52,7 +52,7 @@ namespace OpenSim.Framework
52 public ThreadWatchdogInfo(Thread thread) 52 public ThreadWatchdogInfo(Thread thread)
53 { 53 {
54 Thread = thread; 54 Thread = thread;
55 LastTick = Environment.TickCount & Int32.MaxValue; 55 LastTick = Environment.TickCount;
56 } 56 }
57 } 57 }
58 58
@@ -127,7 +127,7 @@ namespace OpenSim.Framework
127 m_threads.Add(threadInfo.Thread.ManagedThreadId, threadInfo); 127 m_threads.Add(threadInfo.Thread.ManagedThreadId, threadInfo);
128 } 128 }
129 129
130 private static bool RemoveThread(int threadID) 130 public static bool RemoveThread(int threadID)
131 { 131 {
132 lock (m_threads) 132 lock (m_threads)
133 return m_threads.Remove(threadID); 133 return m_threads.Remove(threadID);
@@ -144,7 +144,7 @@ namespace OpenSim.Framework
144 try 144 try
145 { 145 {
146 if (m_threads.TryGetValue(threadID, out threadInfo)) 146 if (m_threads.TryGetValue(threadID, out threadInfo))
147 threadInfo.LastTick = Environment.TickCount & Int32.MaxValue; 147 threadInfo.LastTick = Environment.TickCount;
148 else 148 else
149 AddThread(new ThreadWatchdogInfo(Thread.CurrentThread)); 149 AddThread(new ThreadWatchdogInfo(Thread.CurrentThread));
150 } 150 }
@@ -170,7 +170,7 @@ namespace OpenSim.Framework
170 170
171 lock (m_threads) 171 lock (m_threads)
172 { 172 {
173 int now = Environment.TickCount & Int32.MaxValue; 173 int now = Environment.TickCount;
174 174
175 foreach (ThreadWatchdogInfo threadInfo in m_threads.Values) 175 foreach (ThreadWatchdogInfo threadInfo in m_threads.Values)
176 { 176 {
diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs
index 1feeeb3..f59c8f8 100644
--- a/OpenSim/Framework/WebUtil.cs
+++ b/OpenSim/Framework/WebUtil.cs
@@ -139,17 +139,22 @@ namespace OpenSim.Framework
139 /// </summary> 139 /// </summary>
140 public static OSDMap PutToService(string url, OSDMap data) 140 public static OSDMap PutToService(string url, OSDMap data)
141 { 141 {
142 return ServiceOSDRequest(url,data,"PUT",10000); 142 return ServiceOSDRequest(url,data,"PUT", 20000);
143 } 143 }
144 144
145 public static OSDMap PostToService(string url, OSDMap data) 145 public static OSDMap PostToService(string url, OSDMap data)
146 { 146 {
147 return ServiceOSDRequest(url,data,"POST",10000); 147 return PostToService(url, data, 20000);
148 }
149
150 public static OSDMap PostToService(string url, OSDMap data, int timeout)
151 {
152 return ServiceOSDRequest(url,data,"POST", timeout);
148 } 153 }
149 154
150 public static OSDMap GetFromService(string url) 155 public static OSDMap GetFromService(string url)
151 { 156 {
152 return ServiceOSDRequest(url,null,"GET",10000); 157 return ServiceOSDRequest(url,null,"GET", 20000);
153 } 158 }
154 159
155 public static OSDMap ServiceOSDRequest(string url, OSDMap data, string method, int timeout) 160 public static OSDMap ServiceOSDRequest(string url, OSDMap data, string method, int timeout)
@@ -276,7 +281,7 @@ namespace OpenSim.Framework
276 /// </summary> 281 /// </summary>
277 public static OSDMap PostToService(string url, NameValueCollection data) 282 public static OSDMap PostToService(string url, NameValueCollection data)
278 { 283 {
279 return ServiceFormRequest(url,data,10000); 284 return ServiceFormRequest(url,data, 20000);
280 } 285 }
281 286
282 public static OSDMap ServiceFormRequest(string url, NameValueCollection data, int timeout) 287 public static OSDMap ServiceFormRequest(string url, NameValueCollection data, int timeout)