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.cs73
-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/PriorityQueue.cs258
-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/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.cs69
-rw-r--r--OpenSim/Framework/Watchdog.cs8
-rw-r--r--OpenSim/Framework/WebUtil.cs20
23 files changed, 836 insertions, 165 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 f573c32..f187468 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
@@ -438,6 +441,7 @@ namespace OpenSim.Framework
438 public delegate void ClassifiedInfoRequest(UUID classifiedID, IClientAPI client); 441 public delegate void ClassifiedInfoRequest(UUID classifiedID, IClientAPI client);
439 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); 442 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);
440 public delegate void ClassifiedDelete(UUID classifiedID, IClientAPI client); 443 public delegate void ClassifiedDelete(UUID classifiedID, IClientAPI client);
444 public delegate void ClassifiedGodDelete(UUID classifiedID, UUID queryID, IClientAPI client);
441 445
442 public delegate void EventNotificationAddRequest(uint EventID, IClientAPI client); 446 public delegate void EventNotificationAddRequest(uint EventID, IClientAPI client);
443 public delegate void EventNotificationRemoveRequest(uint EventID, IClientAPI client); 447 public delegate void EventNotificationRemoveRequest(uint EventID, IClientAPI client);
@@ -460,9 +464,9 @@ namespace OpenSim.Framework
460 464
461 public delegate void AgentFOV(IClientAPI client, float verticalAngle); 465 public delegate void AgentFOV(IClientAPI client, float verticalAngle);
462 466
463 public delegate void MuteListEntryUpdate(IClientAPI client, UUID MuteID, string Name, int Flags,UUID AgentID); 467 public delegate void MuteListEntryUpdate(IClientAPI client, UUID MuteID, string Name, int type, uint flags);
464 468
465 public delegate void MuteListEntryRemove(IClientAPI client, UUID MuteID, string Name, UUID AgentID); 469 public delegate void MuteListEntryRemove(IClientAPI client, UUID MuteID, string Name);
466 470
467 public delegate void AvatarInterestReply(IClientAPI client,UUID target, uint wantmask, string wanttext, uint skillsmask, string skillstext, string languages); 471 public delegate void AvatarInterestReply(IClientAPI client,UUID target, uint wantmask, string wanttext, uint skillsmask, string skillstext, string languages);
468 472
@@ -572,34 +576,69 @@ namespace OpenSim.Framework
572 576
573 public class IEntityUpdate 577 public class IEntityUpdate
574 { 578 {
575 public ISceneEntity Entity; 579 private ISceneEntity m_entity;
576 public uint Flags; 580 private uint m_flags;
581 private int m_updateTime;
582
583 public ISceneEntity Entity
584 {
585 get { return m_entity; }
586 }
587
588 public uint Flags
589 {
590 get { return m_flags; }
591 }
592
593 public int UpdateTime
594 {
595 get { return m_updateTime; }
596 }
577 597
578 public virtual void Update(IEntityUpdate update) 598 public virtual void Update(IEntityUpdate update)
579 { 599 {
580 this.Flags |= update.Flags; 600 m_flags |= update.Flags;
601
602 // Use the older of the updates as the updateTime
603 if (Util.EnvironmentTickCountCompare(UpdateTime, update.UpdateTime) > 0)
604 m_updateTime = update.UpdateTime;
581 } 605 }
582 606
583 public IEntityUpdate(ISceneEntity entity, uint flags) 607 public IEntityUpdate(ISceneEntity entity, uint flags)
584 { 608 {
585 Entity = entity; 609 m_entity = entity;
586 Flags = flags; 610 m_flags = flags;
611 m_updateTime = Util.EnvironmentTickCount();
612 }
613
614 public IEntityUpdate(ISceneEntity entity, uint flags, Int32 updateTime)
615 {
616 m_entity = entity;
617 m_flags = flags;
618 m_updateTime = updateTime;
587 } 619 }
588 } 620 }
589
590 621
591 public class EntityUpdate : IEntityUpdate 622 public class EntityUpdate : IEntityUpdate
592 { 623 {
593 // public ISceneEntity Entity; 624 private float m_timeDilation;
594 // public PrimUpdateFlags Flags; 625
595 public float TimeDilation; 626 public float TimeDilation
627 {
628 get { return m_timeDilation; }
629 }
596 630
597 public EntityUpdate(ISceneEntity entity, PrimUpdateFlags flags, float timedilation) 631 public EntityUpdate(ISceneEntity entity, PrimUpdateFlags flags, float timedilation)
598 : base(entity,(uint)flags) 632 : base(entity, (uint)flags)
599 { 633 {
600 //Entity = entity;
601 // Flags = flags; 634 // Flags = flags;
602 TimeDilation = timedilation; 635 m_timeDilation = timedilation;
636 }
637
638 public EntityUpdate(ISceneEntity entity, PrimUpdateFlags flags, float timedilation, Int32 updateTime)
639 : base(entity,(uint)flags,updateTime)
640 {
641 m_timeDilation = timedilation;
603 } 642 }
604 } 643 }
605 644
@@ -811,6 +850,7 @@ namespace OpenSim.Framework
811 event RequestTaskInventory OnRequestTaskInventory; 850 event RequestTaskInventory OnRequestTaskInventory;
812 event UpdateInventoryItem OnUpdateInventoryItem; 851 event UpdateInventoryItem OnUpdateInventoryItem;
813 event CopyInventoryItem OnCopyInventoryItem; 852 event CopyInventoryItem OnCopyInventoryItem;
853 event MoveItemsAndLeaveCopy OnMoveItemsAndLeaveCopy;
814 event MoveInventoryItem OnMoveInventoryItem; 854 event MoveInventoryItem OnMoveInventoryItem;
815 event RemoveInventoryFolder OnRemoveInventoryFolder; 855 event RemoveInventoryFolder OnRemoveInventoryFolder;
816 event RemoveInventoryItem OnRemoveInventoryItem; 856 event RemoveInventoryItem OnRemoveInventoryItem;
@@ -929,7 +969,7 @@ namespace OpenSim.Framework
929 event ClassifiedInfoRequest OnClassifiedInfoRequest; 969 event ClassifiedInfoRequest OnClassifiedInfoRequest;
930 event ClassifiedInfoUpdate OnClassifiedInfoUpdate; 970 event ClassifiedInfoUpdate OnClassifiedInfoUpdate;
931 event ClassifiedDelete OnClassifiedDelete; 971 event ClassifiedDelete OnClassifiedDelete;
932 event ClassifiedDelete OnClassifiedGodDelete; 972 event ClassifiedGodDelete OnClassifiedGodDelete;
933 973
934 event EventNotificationAddRequest OnEventNotificationAddRequest; 974 event EventNotificationAddRequest OnEventNotificationAddRequest;
935 event EventNotificationRemoveRequest OnEventNotificationRemoveRequest; 975 event EventNotificationRemoveRequest OnEventNotificationRemoveRequest;
@@ -981,6 +1021,7 @@ namespace OpenSim.Framework
981 void InPacket(object NewPack); 1021 void InPacket(object NewPack);
982 void ProcessInPacket(Packet NewPack); 1022 void ProcessInPacket(Packet NewPack);
983 void Close(); 1023 void Close();
1024 void Close(bool sendStop);
984 void Kick(string message); 1025 void Kick(string message);
985 1026
986 /// <summary> 1027 /// <summary>
@@ -1012,7 +1053,7 @@ namespace OpenSim.Framework
1012 /// </summary> 1053 /// </summary>
1013 /// <param name="regionHandle"></param> 1054 /// <param name="regionHandle"></param>
1014 /// <param name="localID"></param> 1055 /// <param name="localID"></param>
1015 void SendKillObject(ulong regionHandle, uint localID); 1056 void SendKillObject(ulong regionHandle, List<uint> localID);
1016 1057
1017 void SendAnimations(UUID[] animID, int[] seqs, UUID sourceAgentId, UUID[] objectIDs); 1058 void SendAnimations(UUID[] animID, int[] seqs, UUID sourceAgentId, UUID[] objectIDs);
1018 void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args); 1059 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/PriorityQueue.cs b/OpenSim/Framework/PriorityQueue.cs
new file mode 100644
index 0000000..eec2a92
--- /dev/null
+++ b/OpenSim/Framework/PriorityQueue.cs
@@ -0,0 +1,258 @@
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;
30using System.Collections.Generic;
31using System.Reflection;
32
33using OpenSim.Framework;
34using OpenSim.Framework.Client;
35using log4net;
36
37namespace OpenSim.Framework
38{
39 public class PriorityQueue
40 {
41 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
42
43 public delegate bool UpdatePriorityHandler(ref uint priority, ISceneEntity entity);
44
45 // Heap[0] for self updates
46 // Heap[1..12] for entity updates
47
48 public const uint NumberOfQueues = 12;
49 public const uint ImmediateQueue = 0;
50
51 private MinHeap<MinHeapItem>[] m_heaps = new MinHeap<MinHeapItem>[NumberOfQueues];
52 private Dictionary<uint, LookupItem> m_lookupTable;
53 private uint m_nextQueue = 0;
54 private UInt64 m_nextRequest = 0;
55
56 private object m_syncRoot = new object();
57 public object SyncRoot {
58 get { return this.m_syncRoot; }
59 }
60
61 public PriorityQueue() : this(MinHeap<MinHeapItem>.DEFAULT_CAPACITY) { }
62
63 public PriorityQueue(int capacity)
64 {
65 m_lookupTable = new Dictionary<uint, LookupItem>(capacity);
66
67 for (int i = 0; i < m_heaps.Length; ++i)
68 m_heaps[i] = new MinHeap<MinHeapItem>(capacity);
69 }
70
71 public int Count
72 {
73 get
74 {
75 int count = 0;
76 for (int i = 0; i < m_heaps.Length; ++i)
77 count += m_heaps[i].Count;
78 return count;
79 }
80 }
81
82 public bool Enqueue(uint pqueue, IEntityUpdate value)
83 {
84 LookupItem lookup;
85
86 uint localid = value.Entity.LocalId;
87 UInt64 entry = m_nextRequest++;
88 if (m_lookupTable.TryGetValue(localid, out lookup))
89 {
90 entry = lookup.Heap[lookup.Handle].EntryOrder;
91 value.Update(lookup.Heap[lookup.Handle].Value);
92 lookup.Heap.Remove(lookup.Handle);
93 }
94
95 pqueue = Util.Clamp<uint>(pqueue, 0, NumberOfQueues - 1);
96 lookup.Heap = m_heaps[pqueue];
97 lookup.Heap.Add(new MinHeapItem(pqueue, entry, value), ref lookup.Handle);
98 m_lookupTable[localid] = lookup;
99
100 return true;
101 }
102
103 public bool TryDequeue(out IEntityUpdate value, out Int32 timeinqueue)
104 {
105 // If there is anything in priority queue 0, return it first no
106 // matter what else. Breaks fairness. But very useful.
107 if (m_heaps[ImmediateQueue].Count > 0)
108 {
109 MinHeapItem item = m_heaps[ImmediateQueue].RemoveMin();
110 m_lookupTable.Remove(item.Value.Entity.LocalId);
111 timeinqueue = Util.EnvironmentTickCountSubtract(item.EntryTime);
112 value = item.Value;
113
114 return true;
115 }
116
117 for (int i = 0; i < NumberOfQueues; ++i)
118 {
119 // To get the fair queing, we cycle through each of the
120 // queues when finding an element to dequeue, this code
121 // assumes that the distribution of updates in the queues
122 // is polynomial, probably quadractic (eg distance of PI * R^2)
123 uint h = (uint)((m_nextQueue + i) % NumberOfQueues);
124 if (m_heaps[h].Count > 0)
125 {
126 m_nextQueue = (uint)((h + 1) % NumberOfQueues);
127
128 MinHeapItem item = m_heaps[h].RemoveMin();
129 m_lookupTable.Remove(item.Value.Entity.LocalId);
130 timeinqueue = Util.EnvironmentTickCountSubtract(item.EntryTime);
131 value = item.Value;
132
133 return true;
134 }
135 }
136
137 timeinqueue = 0;
138 value = default(IEntityUpdate);
139 return false;
140 }
141
142 public void Reprioritize(UpdatePriorityHandler handler)
143 {
144 MinHeapItem item;
145 foreach (LookupItem lookup in new List<LookupItem>(this.m_lookupTable.Values))
146 {
147 if (lookup.Heap.TryGetValue(lookup.Handle, out item))
148 {
149 uint pqueue = item.PriorityQueue;
150 uint localid = item.Value.Entity.LocalId;
151
152 if (handler(ref pqueue, item.Value.Entity))
153 {
154 // unless the priority queue has changed, there is no need to modify
155 // the entry
156 pqueue = Util.Clamp<uint>(pqueue, 0, NumberOfQueues - 1);
157 if (pqueue != item.PriorityQueue)
158 {
159 lookup.Heap.Remove(lookup.Handle);
160
161 LookupItem litem = lookup;
162 litem.Heap = m_heaps[pqueue];
163 litem.Heap.Add(new MinHeapItem(pqueue, item), ref litem.Handle);
164 m_lookupTable[localid] = litem;
165 }
166 }
167 else
168 {
169 // m_log.WarnFormat("[PQUEUE]: UpdatePriorityHandler returned false for {0}",item.Value.Entity.UUID);
170 lookup.Heap.Remove(lookup.Handle);
171 this.m_lookupTable.Remove(localid);
172 }
173 }
174 }
175 }
176
177 public override string ToString()
178 {
179 string s = "";
180 for (int i = 0; i < NumberOfQueues; i++)
181 {
182 if (s != "") s += ",";
183 s += m_heaps[i].Count.ToString();
184 }
185 return s;
186 }
187
188#region MinHeapItem
189 private struct MinHeapItem : IComparable<MinHeapItem>
190 {
191 private IEntityUpdate value;
192 internal IEntityUpdate Value {
193 get {
194 return this.value;
195 }
196 }
197
198 private uint pqueue;
199 internal uint PriorityQueue {
200 get {
201 return this.pqueue;
202 }
203 }
204
205 private Int32 entrytime;
206 internal Int32 EntryTime {
207 get {
208 return this.entrytime;
209 }
210 }
211
212 private UInt64 entryorder;
213 internal UInt64 EntryOrder
214 {
215 get {
216 return this.entryorder;
217 }
218 }
219
220 internal MinHeapItem(uint pqueue, MinHeapItem other)
221 {
222 this.entrytime = other.entrytime;
223 this.entryorder = other.entryorder;
224 this.value = other.value;
225 this.pqueue = pqueue;
226 }
227
228 internal MinHeapItem(uint pqueue, UInt64 entryorder, IEntityUpdate value)
229 {
230 this.entrytime = Util.EnvironmentTickCount();
231 this.entryorder = entryorder;
232 this.value = value;
233 this.pqueue = pqueue;
234 }
235
236 public override string ToString()
237 {
238 return String.Format("[{0},{1},{2}]",pqueue,entryorder,value.Entity.LocalId);
239 }
240
241 public int CompareTo(MinHeapItem other)
242 {
243 // I'm assuming that the root part of an SOG is added to the update queue
244 // before the component parts
245 return Comparer<UInt64>.Default.Compare(this.EntryOrder, other.EntryOrder);
246 }
247 }
248#endregion
249
250#region LookupItem
251 private struct LookupItem
252 {
253 internal MinHeap<MinHeapItem> Heap;
254 internal IHandle Handle;
255 }
256#endregion
257 }
258}
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/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..366a38f 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
@@ -1537,6 +1549,23 @@ namespace OpenSim.Framework
1537 return (diff >= 0) ? diff : (diff + EnvironmentTickCountMask + 1); 1549 return (diff >= 0) ? diff : (diff + EnvironmentTickCountMask + 1);
1538 } 1550 }
1539 1551
1552 // Returns value of Tick Count A - TickCount B accounting for wrapping of TickCount
1553 // Assumes both tcA and tcB came from previous calls to Util.EnvironmentTickCount().
1554 // A positive return value indicates A occured later than B
1555 public static Int32 EnvironmentTickCountCompare(Int32 tcA, Int32 tcB)
1556 {
1557 // A, B and TC are all between 0 and 0x3fffffff
1558 int tc = EnvironmentTickCount();
1559
1560 if (tc - tcA >= 0)
1561 tcA += EnvironmentTickCountMask + 1;
1562
1563 if (tc - tcB >= 0)
1564 tcB += EnvironmentTickCountMask + 1;
1565
1566 return tcA - tcB;
1567 }
1568
1540 /// <summary> 1569 /// <summary>
1541 /// Prints the call stack at any given point. Useful for debugging. 1570 /// Prints the call stack at any given point. Useful for debugging.
1542 /// </summary> 1571 /// </summary>
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 9d70f63..d04a3df 100644
--- a/OpenSim/Framework/WebUtil.cs
+++ b/OpenSim/Framework/WebUtil.cs
@@ -142,17 +142,22 @@ namespace OpenSim.Framework
142 /// </summary> 142 /// </summary>
143 public static OSDMap PutToService(string url, OSDMap data) 143 public static OSDMap PutToService(string url, OSDMap data)
144 { 144 {
145 return ServiceOSDRequest(url,data,"PUT",10000); 145 return ServiceOSDRequest(url,data,"PUT", 20000);
146 } 146 }
147 147
148 public static OSDMap PostToService(string url, OSDMap data) 148 public static OSDMap PostToService(string url, OSDMap data)
149 { 149 {
150 return ServiceOSDRequest(url,data,"POST",10000); 150 return PostToService(url, data, 20000);
151 }
152
153 public static OSDMap PostToService(string url, OSDMap data, int timeout)
154 {
155 return ServiceOSDRequest(url,data,"POST", timeout);
151 } 156 }
152 157
153 public static OSDMap GetFromService(string url) 158 public static OSDMap GetFromService(string url)
154 { 159 {
155 return ServiceOSDRequest(url,null,"GET",10000); 160 return ServiceOSDRequest(url,null,"GET", 20000);
156 } 161 }
157 162
158 public static OSDMap ServiceOSDRequest(string url, OSDMap data, string method, int timeout) 163 public static OSDMap ServiceOSDRequest(string url, OSDMap data, string method, int timeout)
@@ -279,7 +284,7 @@ namespace OpenSim.Framework
279 /// </summary> 284 /// </summary>
280 public static OSDMap PostToService(string url, NameValueCollection data) 285 public static OSDMap PostToService(string url, NameValueCollection data)
281 { 286 {
282 return ServiceFormRequest(url,data,10000); 287 return ServiceFormRequest(url,data, 20000);
283 } 288 }
284 289
285 public static OSDMap ServiceFormRequest(string url, NameValueCollection data, int timeout) 290 public static OSDMap ServiceFormRequest(string url, NameValueCollection data, int timeout)
@@ -898,11 +903,18 @@ namespace OpenSim.Framework
898 /// the request. You'll want to make sure you deal with this as they're not uncommon</exception> 903 /// the request. You'll want to make sure you deal with this as they're not uncommon</exception>
899 public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj) 904 public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj)
900 { 905 {
906 return MakeRequest<TRequest, TResponse>(verb, requestUrl, obj, 0);
907 }
908
909 public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj, int pTimeout)
910 {
901 Type type = typeof(TRequest); 911 Type type = typeof(TRequest);
902 TResponse deserial = default(TResponse); 912 TResponse deserial = default(TResponse);
903 913
904 WebRequest request = WebRequest.Create(requestUrl); 914 WebRequest request = WebRequest.Create(requestUrl);
905 request.Method = verb; 915 request.Method = verb;
916 if (pTimeout != 0)
917 request.Timeout = pTimeout * 1000;
906 918
907 if ((verb == "POST") || (verb == "PUT")) 919 if ((verb == "POST") || (verb == "PUT"))
908 { 920 {