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/IClientAPI.cs2
-rw-r--r--OpenSim/Framework/LandData.cs2
-rw-r--r--OpenSim/Framework/ParcelMediaCommandEnum.cs2
-rw-r--r--OpenSim/Framework/PrimitiveBaseShape.cs2
-rw-r--r--OpenSim/Framework/RegionInfo.cs1
-rw-r--r--OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs17
-rw-r--r--OpenSim/Framework/Servers/VersionInfo.cs4
-rw-r--r--OpenSim/Framework/TaskInventoryDictionary.cs117
-rw-r--r--OpenSim/Framework/UndoStack.cs58
-rw-r--r--OpenSim/Framework/Util.cs26
11 files changed, 182 insertions, 57 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/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index 556a532..d85b101 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -940,8 +940,10 @@ namespace OpenSim.Framework
940 void SetDebugPacketLevel(int newDebug); 940 void SetDebugPacketLevel(int newDebug);
941 941
942 void InPacket(object NewPack); 942 void InPacket(object NewPack);
943 void ProcessPendingPackets();
943 void ProcessInPacket(Packet NewPack); 944 void ProcessInPacket(Packet NewPack);
944 void Close(); 945 void Close();
946 void Close(bool sendStop);
945 void Kick(string message); 947 void Kick(string message);
946 948
947 /// <summary> 949 /// <summary>
diff --git a/OpenSim/Framework/LandData.cs b/OpenSim/Framework/LandData.cs
index 060e886..ef07438 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
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/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs
index 4d1de22..990c859 100644
--- a/OpenSim/Framework/PrimitiveBaseShape.cs
+++ b/OpenSim/Framework/PrimitiveBaseShape.cs
@@ -1196,7 +1196,7 @@ namespace OpenSim.Framework
1196 prim.Textures = this.Textures; 1196 prim.Textures = this.Textures;
1197 1197
1198 prim.Properties = new Primitive.ObjectProperties(); 1198 prim.Properties = new Primitive.ObjectProperties();
1199 prim.Properties.Name = "Primitive"; 1199 prim.Properties.Name = "Object";
1200 prim.Properties.Description = ""; 1200 prim.Properties.Description = "";
1201 prim.Properties.CreatorID = UUID.Zero; 1201 prim.Properties.CreatorID = UUID.Zero;
1202 prim.Properties.GroupID = UUID.Zero; 1202 prim.Properties.GroupID = UUID.Zero;
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs
index afc4060..2a74e79 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 UUID regionID = UUID.Zero; 46 public UUID regionID = UUID.Zero;
diff --git a/OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs b/OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs
index eab463c..f07f7ab 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 {
diff --git a/OpenSim/Framework/Servers/VersionInfo.cs b/OpenSim/Framework/Servers/VersionInfo.cs
index 100bf1f..f3ac191 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..4b9a509 100644
--- a/OpenSim/Framework/TaskInventoryDictionary.cs
+++ b/OpenSim/Framework/TaskInventoryDictionary.cs
@@ -27,9 +27,12 @@
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;
31using System.Xml.Schema; 33using System.Xml.Schema;
32using System.Xml.Serialization; 34using System.Xml.Serialization;
35using log4net;
33using OpenMetaverse; 36using OpenMetaverse;
34 37
35namespace OpenSim.Framework 38namespace OpenSim.Framework
@@ -45,6 +48,111 @@ namespace OpenSim.Framework
45 // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 48 // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
46 49
47 private static XmlSerializer tiiSerializer = new XmlSerializer(typeof (TaskInventoryItem)); 50 private static XmlSerializer tiiSerializer = new XmlSerializer(typeof (TaskInventoryItem));
51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
52
53 private Thread LockedByThread;
54 /// <value>
55 /// An advanced lock for inventory data
56 /// </value>
57 private System.Threading.ReaderWriterLockSlim m_itemLock = new System.Threading.ReaderWriterLockSlim();
58
59 /// <summary>
60 /// Are we readlocked by the calling thread?
61 /// </summary>
62 public bool IsReadLockedByMe()
63 {
64 if (m_itemLock.RecursiveReadCount > 0)
65 {
66 return true;
67 }
68 else
69 {
70 return false;
71 }
72 }
73
74 /// <summary>
75 /// Lock our inventory list for reading (many can read, one can write)
76 /// </summary>
77 public void LockItemsForRead(bool locked)
78 {
79 if (locked)
80 {
81 if (m_itemLock.IsWriteLockHeld && LockedByThread != null)
82 {
83 if (!LockedByThread.IsAlive)
84 {
85 //Locked by dead thread, reset.
86 m_itemLock = new System.Threading.ReaderWriterLockSlim();
87 }
88 }
89
90 if (m_itemLock.RecursiveReadCount > 0)
91 {
92 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.");
93 m_itemLock.ExitReadLock();
94 }
95 if (m_itemLock.RecursiveWriteCount > 0)
96 {
97 m_log.Error("[TaskInventoryDictionary] Recursive write lock requested. This should not happen and means something needs to be fixed.");
98 m_itemLock.ExitWriteLock();
99 }
100
101 while (!m_itemLock.TryEnterReadLock(60000))
102 {
103 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.");
104 if (m_itemLock.IsWriteLockHeld)
105 {
106 m_itemLock = new System.Threading.ReaderWriterLockSlim();
107 }
108 }
109 }
110 else
111 {
112 if (m_itemLock.RecursiveReadCount>0)
113 {
114 m_itemLock.ExitReadLock();
115 }
116 }
117 }
118
119 /// <summary>
120 /// Lock our inventory list for writing (many can read, one can write)
121 /// </summary>
122 public void LockItemsForWrite(bool locked)
123 {
124 if (locked)
125 {
126 //Enter a write lock, wait indefinately for one to open.
127 if (m_itemLock.RecursiveReadCount > 0)
128 {
129 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.");
130 m_itemLock.ExitReadLock();
131 }
132 if (m_itemLock.RecursiveWriteCount > 0)
133 {
134 m_log.Error("[TaskInventoryDictionary] Recursive write lock requested. This should not happen and means something needs to be fixed.");
135 m_itemLock.ExitWriteLock();
136 }
137 while (!m_itemLock.TryEnterWriteLock(60000))
138 {
139 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.");
140 if (m_itemLock.IsWriteLockHeld)
141 {
142 m_itemLock = new System.Threading.ReaderWriterLockSlim();
143 }
144 }
145
146 LockedByThread = Thread.CurrentThread;
147 }
148 else
149 {
150 if (m_itemLock.RecursiveWriteCount > 0)
151 {
152 m_itemLock.ExitWriteLock();
153 }
154 }
155 }
48 156
49 #region ICloneable Members 157 #region ICloneable Members
50 158
@@ -52,13 +160,12 @@ namespace OpenSim.Framework
52 { 160 {
53 TaskInventoryDictionary clone = new TaskInventoryDictionary(); 161 TaskInventoryDictionary clone = new TaskInventoryDictionary();
54 162
55 lock (this) 163 m_itemLock.EnterReadLock();
164 foreach (UUID uuid in Keys)
56 { 165 {
57 foreach (UUID uuid in Keys) 166 clone.Add(uuid, (TaskInventoryItem) this[uuid].Clone());
58 {
59 clone.Add(uuid, (TaskInventoryItem) this[uuid].Clone());
60 }
61 } 167 }
168 m_itemLock.ExitReadLock();
62 169
63 return clone; 170 return clone;
64 } 171 }
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
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,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 802cb37..c39fb6f 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -997,19 +997,19 @@ namespace OpenSim.Framework
997 { 997 {
998 string os = String.Empty; 998 string os = String.Empty;
999 999
1000 if (Environment.OSVersion.Platform != PlatformID.Unix) 1000// if (Environment.OSVersion.Platform != PlatformID.Unix)
1001 { 1001// {
1002 os = Environment.OSVersion.ToString(); 1002// os = Environment.OSVersion.ToString();
1003 } 1003// }
1004 else 1004// else
1005 { 1005// {
1006 os = ReadEtcIssue(); 1006// os = ReadEtcIssue();
1007 } 1007// }
1008 1008//
1009 if (os.Length > 45) 1009// if (os.Length > 45)
1010 { 1010// {
1011 os = os.Substring(0, 45); 1011// os = os.Substring(0, 45);
1012 } 1012// }
1013 1013
1014 return os; 1014 return os;
1015 } 1015 }