diff options
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r-- | OpenSim/Framework/AssetBase.cs | 8 | ||||
-rw-r--r-- | OpenSim/Framework/Communications/RestClient.cs | 2 | ||||
-rw-r--r-- | OpenSim/Framework/IClientAPI.cs | 8 | ||||
-rw-r--r-- | OpenSim/Framework/LandData.cs | 2 | ||||
-rw-r--r-- | OpenSim/Framework/ParcelMediaCommandEnum.cs | 2 | ||||
-rw-r--r-- | OpenSim/Framework/PluginLoader.cs | 17 | ||||
-rw-r--r-- | OpenSim/Framework/PrimitiveBaseShape.cs | 2 | ||||
-rw-r--r-- | OpenSim/Framework/RegionInfo.cs | 1 | ||||
-rw-r--r-- | OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs | 65 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs | 19 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/VersionInfo.cs | 4 | ||||
-rw-r--r-- | OpenSim/Framework/TaskInventoryDictionary.cs | 131 | ||||
-rw-r--r-- | OpenSim/Framework/TaskInventoryItem.cs | 5 | ||||
-rw-r--r-- | OpenSim/Framework/UndoStack.cs | 58 | ||||
-rw-r--r-- | OpenSim/Framework/Util.cs | 26 | ||||
-rw-r--r-- | OpenSim/Framework/Watchdog.cs | 6 |
16 files changed, 262 insertions, 94 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/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/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 94815cd..51482a1 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs | |||
@@ -264,6 +264,9 @@ namespace OpenSim.Framework | |||
264 | public delegate void MoveInventoryItem( | 264 | public delegate void MoveInventoryItem( |
265 | IClientAPI remoteClient, List<InventoryItemBase> items); | 265 | IClientAPI remoteClient, List<InventoryItemBase> items); |
266 | 266 | ||
267 | public delegate void MoveItemsAndLeaveCopy( | ||
268 | IClientAPI remoteClient, List<InventoryItemBase> items, UUID destFolder); | ||
269 | |||
267 | public delegate void RemoveInventoryItem( | 270 | public delegate void RemoveInventoryItem( |
268 | IClientAPI remoteClient, List<UUID> itemIDs); | 271 | IClientAPI remoteClient, List<UUID> itemIDs); |
269 | 272 | ||
@@ -772,6 +775,7 @@ namespace OpenSim.Framework | |||
772 | event RequestTaskInventory OnRequestTaskInventory; | 775 | event RequestTaskInventory OnRequestTaskInventory; |
773 | event UpdateInventoryItem OnUpdateInventoryItem; | 776 | event UpdateInventoryItem OnUpdateInventoryItem; |
774 | event CopyInventoryItem OnCopyInventoryItem; | 777 | event CopyInventoryItem OnCopyInventoryItem; |
778 | event MoveItemsAndLeaveCopy OnMoveItemsAndLeaveCopy; | ||
775 | event MoveInventoryItem OnMoveInventoryItem; | 779 | event MoveInventoryItem OnMoveInventoryItem; |
776 | event RemoveInventoryFolder OnRemoveInventoryFolder; | 780 | event RemoveInventoryFolder OnRemoveInventoryFolder; |
777 | event RemoveInventoryItem OnRemoveInventoryItem; | 781 | event RemoveInventoryItem OnRemoveInventoryItem; |
@@ -940,8 +944,10 @@ namespace OpenSim.Framework | |||
940 | void SetDebugPacketLevel(int newDebug); | 944 | void SetDebugPacketLevel(int newDebug); |
941 | 945 | ||
942 | void InPacket(object NewPack); | 946 | void InPacket(object NewPack); |
947 | void ProcessPendingPackets(); | ||
943 | void ProcessInPacket(Packet NewPack); | 948 | void ProcessInPacket(Packet NewPack); |
944 | void Close(); | 949 | void Close(); |
950 | void Close(bool sendStop); | ||
945 | void Kick(string message); | 951 | void Kick(string message); |
946 | 952 | ||
947 | /// <summary> | 953 | /// <summary> |
@@ -973,7 +979,7 @@ namespace OpenSim.Framework | |||
973 | /// </summary> | 979 | /// </summary> |
974 | /// <param name="regionHandle"></param> | 980 | /// <param name="regionHandle"></param> |
975 | /// <param name="localID"></param> | 981 | /// <param name="localID"></param> |
976 | void SendKillObject(ulong regionHandle, uint localID); | 982 | void SendKillObject(ulong regionHandle, List<uint> localID); |
977 | 983 | ||
978 | void SendAnimations(UUID[] animID, int[] seqs, UUID sourceAgentId, UUID[] objectIDs); | 984 | void SendAnimations(UUID[] animID, int[] seqs, UUID sourceAgentId, UUID[] objectIDs); |
979 | void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args); | 985 | void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args); |
diff --git a/OpenSim/Framework/LandData.cs b/OpenSim/Framework/LandData.cs index accf52e..3fb2fd6 100644 --- a/OpenSim/Framework/LandData.cs +++ b/OpenSim/Framework/LandData.cs | |||
@@ -62,7 +62,7 @@ namespace OpenSim.Framework | |||
62 | 62 | ||
63 | private uint _flags = (uint) ParcelFlags.AllowFly | (uint) ParcelFlags.AllowLandmark | | 63 | private uint _flags = (uint) ParcelFlags.AllowFly | (uint) ParcelFlags.AllowLandmark | |
64 | (uint) ParcelFlags.AllowAPrimitiveEntry | | 64 | (uint) ParcelFlags.AllowAPrimitiveEntry | |
65 | (uint) ParcelFlags.AllowDeedToGroup | (uint) ParcelFlags.AllowTerraform | | 65 | (uint) ParcelFlags.AllowDeedToGroup | |
66 | (uint) ParcelFlags.CreateObjects | (uint) ParcelFlags.AllowOtherScripts | | 66 | (uint) ParcelFlags.CreateObjects | (uint) ParcelFlags.AllowOtherScripts | |
67 | (uint) ParcelFlags.SoundLocal; | 67 | (uint) ParcelFlags.SoundLocal; |
68 | 68 | ||
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 | ||
28 | namespace OpenSim.Framework | 28 | namespace 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 ff7eaef..4d11754 100644 --- a/OpenSim/Framework/PrimitiveBaseShape.cs +++ b/OpenSim/Framework/PrimitiveBaseShape.cs | |||
@@ -1288,7 +1288,7 @@ namespace OpenSim.Framework | |||
1288 | prim.Textures = this.Textures; | 1288 | prim.Textures = this.Textures; |
1289 | 1289 | ||
1290 | prim.Properties = new Primitive.ObjectProperties(); | 1290 | prim.Properties = new Primitive.ObjectProperties(); |
1291 | prim.Properties.Name = "Primitive"; | 1291 | prim.Properties.Name = "Object"; |
1292 | prim.Properties.Description = ""; | 1292 | prim.Properties.Description = ""; |
1293 | prim.Properties.CreatorID = UUID.Zero; | 1293 | prim.Properties.CreatorID = UUID.Zero; |
1294 | prim.Properties.GroupID = UUID.Zero; | 1294 | prim.Properties.GroupID = UUID.Zero; |
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index 08d5398..a006f3e 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs | |||
@@ -40,6 +40,7 @@ using OpenSim.Framework.Console; | |||
40 | 40 | ||
41 | namespace OpenSim.Framework | 41 | namespace OpenSim.Framework |
42 | { | 42 | { |
43 | [Serializable] | ||
43 | public class RegionLightShareData : ICloneable | 44 | public class RegionLightShareData : ICloneable |
44 | { | 45 | { |
45 | public UUID regionID = UUID.Zero; | 46 | public UUID regionID = UUID.Zero; |
diff --git a/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs b/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs index 0ec4af5..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.Debug("[WEBLOADER]: Sending Download Request..."); | ||
70 | HttpWebResponse webResponse = (HttpWebResponse) webRequest.GetResponse(); | ||
71 | m_log.Debug("[WEBLOADER]: Downloading Region Information From Remote Server..."); | ||
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/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 c88e0d1..4ae370b 100644 --- a/OpenSim/Framework/Servers/VersionInfo.cs +++ b/OpenSim/Framework/Servers/VersionInfo.cs | |||
@@ -29,11 +29,11 @@ namespace OpenSim | |||
29 | { | 29 | { |
30 | public class VersionInfo | 30 | public class VersionInfo |
31 | { | 31 | { |
32 | private const string VERSION_NUMBER = "0.7.1"; | 32 | private const string VERSION_NUMBER = "0.7.1CM"; |
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, |
diff --git a/OpenSim/Framework/TaskInventoryDictionary.cs b/OpenSim/Framework/TaskInventoryDictionary.cs index 25ae6b0..a8a53f2 100644 --- a/OpenSim/Framework/TaskInventoryDictionary.cs +++ b/OpenSim/Framework/TaskInventoryDictionary.cs | |||
@@ -27,9 +27,13 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Threading; | ||
31 | using System.Reflection; | ||
30 | using System.Xml; | 32 | using System.Xml; |
33 | using System.Diagnostics; | ||
31 | using System.Xml.Schema; | 34 | using System.Xml.Schema; |
32 | using System.Xml.Serialization; | 35 | using System.Xml.Serialization; |
36 | using log4net; | ||
33 | using OpenMetaverse; | 37 | using OpenMetaverse; |
34 | 38 | ||
35 | namespace OpenSim.Framework | 39 | namespace OpenSim.Framework |
@@ -45,6 +49,124 @@ 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 | /// <value> | ||
56 | /// An advanced lock for inventory data | ||
57 | /// </value> | ||
58 | private System.Threading.ReaderWriterLockSlim m_itemLock = new System.Threading.ReaderWriterLockSlim(); | ||
59 | |||
60 | /// <summary> | ||
61 | /// Are we readlocked by the calling thread? | ||
62 | /// </summary> | ||
63 | public bool IsReadLockedByMe() | ||
64 | { | ||
65 | if (m_itemLock.RecursiveReadCount > 0) | ||
66 | { | ||
67 | return true; | ||
68 | } | ||
69 | else | ||
70 | { | ||
71 | return false; | ||
72 | } | ||
73 | } | ||
74 | |||
75 | /// <summary> | ||
76 | /// Lock our inventory list for reading (many can read, one can write) | ||
77 | /// </summary> | ||
78 | public void LockItemsForRead(bool locked) | ||
79 | { | ||
80 | if (locked) | ||
81 | { | ||
82 | if (m_itemLock.IsWriteLockHeld && LockedByThread != null) | ||
83 | { | ||
84 | if (!LockedByThread.IsAlive) | ||
85 | { | ||
86 | //Locked by dead thread, reset. | ||
87 | m_itemLock = new System.Threading.ReaderWriterLockSlim(); | ||
88 | } | ||
89 | } | ||
90 | |||
91 | if (m_itemLock.RecursiveReadCount > 0) | ||
92 | { | ||
93 | 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."); | ||
94 | try | ||
95 | { | ||
96 | StackTrace stackTrace = new StackTrace(); // get call stack | ||
97 | StackFrame[] stackFrames = stackTrace.GetFrames(); // get method calls (frames) | ||
98 | |||
99 | // write call stack method names | ||
100 | foreach (StackFrame stackFrame in stackFrames) | ||
101 | { | ||
102 | m_log.Error("[SceneObjectGroup.m_parts] "+(stackFrame.GetMethod().Name)); // write method name | ||
103 | } | ||
104 | } | ||
105 | catch | ||
106 | {} | ||
107 | m_itemLock.ExitReadLock(); | ||
108 | } | ||
109 | if (m_itemLock.RecursiveWriteCount > 0) | ||
110 | { | ||
111 | m_log.Error("[TaskInventoryDictionary] Recursive write lock requested. This should not happen and means something needs to be fixed."); | ||
112 | m_itemLock.ExitWriteLock(); | ||
113 | } | ||
114 | |||
115 | while (!m_itemLock.TryEnterReadLock(60000)) | ||
116 | { | ||
117 | 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."); | ||
118 | if (m_itemLock.IsWriteLockHeld) | ||
119 | { | ||
120 | m_itemLock = new System.Threading.ReaderWriterLockSlim(); | ||
121 | } | ||
122 | } | ||
123 | } | ||
124 | else | ||
125 | { | ||
126 | if (m_itemLock.RecursiveReadCount>0) | ||
127 | { | ||
128 | m_itemLock.ExitReadLock(); | ||
129 | } | ||
130 | } | ||
131 | } | ||
132 | |||
133 | /// <summary> | ||
134 | /// Lock our inventory list for writing (many can read, one can write) | ||
135 | /// </summary> | ||
136 | public void LockItemsForWrite(bool locked) | ||
137 | { | ||
138 | if (locked) | ||
139 | { | ||
140 | //Enter a write lock, wait indefinately for one to open. | ||
141 | if (m_itemLock.RecursiveReadCount > 0) | ||
142 | { | ||
143 | 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."); | ||
144 | m_itemLock.ExitReadLock(); | ||
145 | } | ||
146 | if (m_itemLock.RecursiveWriteCount > 0) | ||
147 | { | ||
148 | m_log.Error("[TaskInventoryDictionary] Recursive write lock requested. This should not happen and means something needs to be fixed."); | ||
149 | m_itemLock.ExitWriteLock(); | ||
150 | } | ||
151 | while (!m_itemLock.TryEnterWriteLock(60000)) | ||
152 | { | ||
153 | 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."); | ||
154 | if (m_itemLock.IsWriteLockHeld) | ||
155 | { | ||
156 | m_itemLock = new System.Threading.ReaderWriterLockSlim(); | ||
157 | } | ||
158 | } | ||
159 | |||
160 | LockedByThread = Thread.CurrentThread; | ||
161 | } | ||
162 | else | ||
163 | { | ||
164 | if (m_itemLock.RecursiveWriteCount > 0) | ||
165 | { | ||
166 | m_itemLock.ExitWriteLock(); | ||
167 | } | ||
168 | } | ||
169 | } | ||
48 | 170 | ||
49 | #region ICloneable Members | 171 | #region ICloneable Members |
50 | 172 | ||
@@ -52,13 +174,12 @@ namespace OpenSim.Framework | |||
52 | { | 174 | { |
53 | TaskInventoryDictionary clone = new TaskInventoryDictionary(); | 175 | TaskInventoryDictionary clone = new TaskInventoryDictionary(); |
54 | 176 | ||
55 | lock (this) | 177 | m_itemLock.EnterReadLock(); |
178 | foreach (UUID uuid in Keys) | ||
56 | { | 179 | { |
57 | foreach (UUID uuid in Keys) | 180 | clone.Add(uuid, (TaskInventoryItem) this[uuid].Clone()); |
58 | { | ||
59 | clone.Add(uuid, (TaskInventoryItem) this[uuid].Clone()); | ||
60 | } | ||
61 | } | 181 | } |
182 | m_itemLock.ExitReadLock(); | ||
62 | 183 | ||
63 | return clone; | 184 | return clone; |
64 | } | 185 | } |
diff --git a/OpenSim/Framework/TaskInventoryItem.cs b/OpenSim/Framework/TaskInventoryItem.cs index df5b936..53237fc 100644 --- a/OpenSim/Framework/TaskInventoryItem.cs +++ b/OpenSim/Framework/TaskInventoryItem.cs | |||
@@ -120,7 +120,7 @@ namespace OpenSim.Framework | |||
120 | private UUID _permsGranter; | 120 | private UUID _permsGranter; |
121 | private int _permsMask; | 121 | private int _permsMask; |
122 | private int _type = 0; | 122 | private int _type = 0; |
123 | private UUID _oldID; | 123 | private UUID _oldID = UUID.Zero; |
124 | 124 | ||
125 | private bool _ownerChanged = false; | 125 | private bool _ownerChanged = false; |
126 | 126 | ||
@@ -348,7 +348,8 @@ namespace OpenSim.Framework | |||
348 | /// <param name="partID">The new part ID to which this item belongs</param> | 348 | /// <param name="partID">The new part ID to which this item belongs</param> |
349 | public void ResetIDs(UUID partID) | 349 | public void ResetIDs(UUID partID) |
350 | { | 350 | { |
351 | OldItemID = ItemID; | 351 | if (_oldID == UUID.Zero) |
352 | _oldID = ItemID; | ||
352 | ItemID = UUID.Random(); | 353 | ItemID = UUID.Random(); |
353 | ParentPartID = partID; | 354 | ParentPartID = partID; |
354 | ParentID = partID; | 355 | ParentID = partID; |
diff --git a/OpenSim/Framework/UndoStack.cs b/OpenSim/Framework/UndoStack.cs index 4d800ae..4cd779a 100644 --- a/OpenSim/Framework/UndoStack.cs +++ b/OpenSim/Framework/UndoStack.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | ||
29 | 30 | ||
30 | namespace OpenSim.Framework | 31 | namespace 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,45 +68,39 @@ 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 emtpy stack"); | 86 | throw new InvalidOperationException("Cannot pop from empty stack"); |
94 | } | 87 | } |
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 addfe5d..f1d622e 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs | |||
@@ -1008,19 +1008,19 @@ namespace OpenSim.Framework | |||
1008 | { | 1008 | { |
1009 | string os = String.Empty; | 1009 | string os = String.Empty; |
1010 | 1010 | ||
1011 | if (Environment.OSVersion.Platform != PlatformID.Unix) | 1011 | // if (Environment.OSVersion.Platform != PlatformID.Unix) |
1012 | { | 1012 | // { |
1013 | os = Environment.OSVersion.ToString(); | 1013 | // os = Environment.OSVersion.ToString(); |
1014 | } | 1014 | // } |
1015 | else | 1015 | // else |
1016 | { | 1016 | // { |
1017 | os = ReadEtcIssue(); | 1017 | // os = ReadEtcIssue(); |
1018 | } | 1018 | // } |
1019 | 1019 | // | |
1020 | if (os.Length > 45) | 1020 | // if (os.Length > 45) |
1021 | { | 1021 | // { |
1022 | os = os.Substring(0, 45); | 1022 | // os = os.Substring(0, 45); |
1023 | } | 1023 | // } |
1024 | 1024 | ||
1025 | return os; | 1025 | return os; |
1026 | } | 1026 | } |
diff --git a/OpenSim/Framework/Watchdog.cs b/OpenSim/Framework/Watchdog.cs index 0f34e83..9baf3a0 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 | ||
@@ -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 | { |