aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
authorroot2009-11-26 20:41:38 +0100
committerroot2009-11-26 20:41:38 +0100
commit2c3f6aaa878b5458eeeab8544226ff53b7172f5a (patch)
tree48941505962693508016fafb479c2baaf1b3568f /OpenSim/Framework
parentFirst attempt at mult-sit on large single prims. (diff)
parentRemove OS version crap from about dialog (diff)
downloadopensim-SC-2c3f6aaa878b5458eeeab8544226ff53b7172f5a.zip
opensim-SC-2c3f6aaa878b5458eeeab8544226ff53b7172f5a.tar.gz
opensim-SC-2c3f6aaa878b5458eeeab8544226ff53b7172f5a.tar.bz2
opensim-SC-2c3f6aaa878b5458eeeab8544226ff53b7172f5a.tar.xz
Merge branch 'careminster' into tests
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/IRegionCommsListener.cs2
-rw-r--r--OpenSim/Framework/ISceneObject.cs2
-rw-r--r--OpenSim/Framework/RegionCommsListener.cs25
-rw-r--r--OpenSim/Framework/Servers/VersionInfo.cs2
-rw-r--r--OpenSim/Framework/TaskInventoryDictionary.cs111
-rw-r--r--OpenSim/Framework/Tests/CacheTests.cs8
-rw-r--r--OpenSim/Framework/Util.cs26
7 files changed, 126 insertions, 50 deletions
diff --git a/OpenSim/Framework/IRegionCommsListener.cs b/OpenSim/Framework/IRegionCommsListener.cs
index 307c6bc..cd59c63 100644
--- a/OpenSim/Framework/IRegionCommsListener.cs
+++ b/OpenSim/Framework/IRegionCommsListener.cs
@@ -32,7 +32,6 @@ namespace OpenSim.Framework
32{ 32{
33 public delegate void ExpectUserDelegate(AgentCircuitData agent); 33 public delegate void ExpectUserDelegate(AgentCircuitData agent);
34 34
35 public delegate bool ExpectPrimDelegate(UUID primID, string objData, int XMLMethod);
36 35
37 public delegate void UpdateNeighbours(List<RegionInfo> neighbours); 36 public delegate void UpdateNeighbours(List<RegionInfo> neighbours);
38 37
@@ -55,7 +54,6 @@ namespace OpenSim.Framework
55 public interface IRegionCommsListener 54 public interface IRegionCommsListener
56 { 55 {
57 event ExpectUserDelegate OnExpectUser; 56 event ExpectUserDelegate OnExpectUser;
58 event ExpectPrimDelegate OnExpectPrim;
59 event GenericCall2 OnExpectChildAgent; 57 event GenericCall2 OnExpectChildAgent;
60 event AgentCrossing OnAvatarCrossingIntoRegion; 58 event AgentCrossing OnAvatarCrossingIntoRegion;
61 event PrimCrossing OnPrimCrossingIntoRegion; 59 event PrimCrossing OnPrimCrossingIntoRegion;
diff --git a/OpenSim/Framework/ISceneObject.cs b/OpenSim/Framework/ISceneObject.cs
index 4fc3e01..5147901 100644
--- a/OpenSim/Framework/ISceneObject.cs
+++ b/OpenSim/Framework/ISceneObject.cs
@@ -38,6 +38,6 @@ namespace OpenSim.Framework
38 string ExtraToXmlString(); 38 string ExtraToXmlString();
39 void ExtraFromXmlString(string xmlstr); 39 void ExtraFromXmlString(string xmlstr);
40 string GetStateSnapshot(); 40 string GetStateSnapshot();
41 void SetState(string xmlstr, UUID regionID); 41 void SetState(string xmlstr, IScene s);
42 } 42 }
43} 43}
diff --git a/OpenSim/Framework/RegionCommsListener.cs b/OpenSim/Framework/RegionCommsListener.cs
index 90200d6..718a556 100644
--- a/OpenSim/Framework/RegionCommsListener.cs
+++ b/OpenSim/Framework/RegionCommsListener.cs
@@ -43,7 +43,6 @@ namespace OpenSim.Framework
43 private ChildAgentUpdate handlerChildAgentUpdate = null; // OnChildAgentUpdate; 43 private ChildAgentUpdate handlerChildAgentUpdate = null; // OnChildAgentUpdate;
44 private CloseAgentConnection handlerCloseAgentConnection = null; // OnCloseAgentConnection; 44 private CloseAgentConnection handlerCloseAgentConnection = null; // OnCloseAgentConnection;
45 private GenericCall2 handlerExpectChildAgent = null; // OnExpectChildAgent; 45 private GenericCall2 handlerExpectChildAgent = null; // OnExpectChildAgent;
46 private ExpectPrimDelegate handlerExpectPrim = null; // OnExpectPrim;
47 private ExpectUserDelegate handlerExpectUser = null; // OnExpectUser 46 private ExpectUserDelegate handlerExpectUser = null; // OnExpectUser
48 private UpdateNeighbours handlerNeighboursUpdate = null; // OnNeighboursUpdate; 47 private UpdateNeighbours handlerNeighboursUpdate = null; // OnNeighboursUpdate;
49 private PrimCrossing handlerPrimCrossingIntoRegion = null; // OnPrimCrossingIntoRegion; 48 private PrimCrossing handlerPrimCrossingIntoRegion = null; // OnPrimCrossingIntoRegion;
@@ -53,7 +52,6 @@ namespace OpenSim.Framework
53 #region IRegionCommsListener Members 52 #region IRegionCommsListener Members
54 53
55 public event ExpectUserDelegate OnExpectUser; 54 public event ExpectUserDelegate OnExpectUser;
56 public event ExpectPrimDelegate OnExpectPrim;
57 public event GenericCall2 OnExpectChildAgent; 55 public event GenericCall2 OnExpectChildAgent;
58 public event AgentCrossing OnAvatarCrossingIntoRegion; 56 public event AgentCrossing OnAvatarCrossingIntoRegion;
59 public event PrimCrossing OnPrimCrossingIntoRegion; 57 public event PrimCrossing OnPrimCrossingIntoRegion;
@@ -95,17 +93,6 @@ namespace OpenSim.Framework
95 93
96 } 94 }
97 95
98 public virtual bool TriggerExpectPrim(UUID primID, string objData, int XMLMethod)
99 {
100 handlerExpectPrim = OnExpectPrim;
101 if (handlerExpectPrim != null)
102 {
103 handlerExpectPrim(primID, objData, XMLMethod);
104 return true;
105 }
106 return false;
107 }
108
109 public virtual bool TriggerChildAgentUpdate(ChildAgentDataUpdate cAgentData) 96 public virtual bool TriggerChildAgentUpdate(ChildAgentDataUpdate cAgentData)
110 { 97 {
111 handlerChildAgentUpdate = OnChildAgentUpdate; 98 handlerChildAgentUpdate = OnChildAgentUpdate;
@@ -128,18 +115,6 @@ namespace OpenSim.Framework
128 return false; 115 return false;
129 } 116 }
130 117
131 public virtual bool TriggerExpectPrimCrossing(UUID primID, Vector3 position,
132 bool isPhysical)
133 {
134 handlerPrimCrossingIntoRegion = OnPrimCrossingIntoRegion;
135 if (handlerPrimCrossingIntoRegion != null)
136 {
137 handlerPrimCrossingIntoRegion(primID, position, isPhysical);
138 return true;
139 }
140 return false;
141 }
142
143 public virtual bool TriggerAcknowledgeAgentCrossed(UUID agentID) 118 public virtual bool TriggerAcknowledgeAgentCrossed(UUID agentID)
144 { 119 {
145 handlerAcknowledgeAgentCrossed = OnAcknowledgeAgentCrossed; 120 handlerAcknowledgeAgentCrossed = OnAcknowledgeAgentCrossed;
diff --git a/OpenSim/Framework/Servers/VersionInfo.cs b/OpenSim/Framework/Servers/VersionInfo.cs
index 9f98310..0d4215b 100644
--- a/OpenSim/Framework/Servers/VersionInfo.cs
+++ b/OpenSim/Framework/Servers/VersionInfo.cs
@@ -29,7 +29,7 @@ namespace OpenSim
29{ 29{
30 public class VersionInfo 30 public class VersionInfo
31 { 31 {
32 private const string VERSION_NUMBER = "0.6.8"; 32 private const string VERSION_NUMBER = "0.6.9-CM";
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
diff --git a/OpenSim/Framework/TaskInventoryDictionary.cs b/OpenSim/Framework/TaskInventoryDictionary.cs
index 25ae6b0..efe5f0c 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,105 @@ 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 m_itemLock.ExitReadLock();
113 }
114 }
115
116 /// <summary>
117 /// Lock our inventory list for writing (many can read, one can write)
118 /// </summary>
119 public void LockItemsForWrite(bool locked)
120 {
121 if (locked)
122 {
123 //Enter a write lock, wait indefinately for one to open.
124 if (m_itemLock.RecursiveReadCount > 0)
125 {
126 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.");
127 m_itemLock.ExitReadLock();
128 }
129 if (m_itemLock.RecursiveWriteCount > 0)
130 {
131 m_log.Error("[TaskInventoryDictionary] Recursive write lock requested. This should not happen and means something needs to be fixed.");
132 m_itemLock.ExitWriteLock();
133 }
134 while (!m_itemLock.TryEnterWriteLock(60000))
135 {
136 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.");
137 if (m_itemLock.IsWriteLockHeld)
138 {
139 m_itemLock = new System.Threading.ReaderWriterLockSlim();
140 }
141 }
142
143 LockedByThread = Thread.CurrentThread;
144 }
145 else
146 {
147 m_itemLock.ExitWriteLock();
148 }
149 }
48 150
49 #region ICloneable Members 151 #region ICloneable Members
50 152
@@ -52,13 +154,12 @@ namespace OpenSim.Framework
52 { 154 {
53 TaskInventoryDictionary clone = new TaskInventoryDictionary(); 155 TaskInventoryDictionary clone = new TaskInventoryDictionary();
54 156
55 lock (this) 157 m_itemLock.EnterReadLock();
158 foreach (UUID uuid in Keys)
56 { 159 {
57 foreach (UUID uuid in Keys) 160 clone.Add(uuid, (TaskInventoryItem) this[uuid].Clone());
58 {
59 clone.Add(uuid, (TaskInventoryItem) this[uuid].Clone());
60 }
61 } 161 }
162 m_itemLock.ExitReadLock();
62 163
63 return clone; 164 return clone;
64 } 165 }
diff --git a/OpenSim/Framework/Tests/CacheTests.cs b/OpenSim/Framework/Tests/CacheTests.cs
index e2afd2a..32c0c95 100644
--- a/OpenSim/Framework/Tests/CacheTests.cs
+++ b/OpenSim/Framework/Tests/CacheTests.cs
@@ -78,8 +78,9 @@ namespace OpenSim.Framework.Tests
78 foo[0] = 1; 78 foo[0] = 1;
79 cachedItem.Store(foo); 79 cachedItem.Store(foo);
80 cache.Store(cacheItemUUID.ToString(), cachedItem); 80 cache.Store(cacheItemUUID.ToString(), cachedItem);
81 81
82 object citem = cache.Get(cacheItemUUID.ToString()); 82 cache.Get(cacheItemUUID.ToString());
83 //object citem = cache.Get(cacheItemUUID.ToString());
83 //Assert.That(citem == null, "Item should not be in Cache because the expiry time was before now"); 84 //Assert.That(citem == null, "Item should not be in Cache because the expiry time was before now");
84 } 85 }
85 86
@@ -94,7 +95,8 @@ namespace OpenSim.Framework.Tests
94 cachedItem.Store(foo); 95 cachedItem.Store(foo);
95 cache.Store(cacheItemUUID.ToString(), cachedItem); 96 cache.Store(cacheItemUUID.ToString(), cachedItem);
96 cache.Invalidate(ImmediateExpiryUUID.ToString()); 97 cache.Invalidate(ImmediateExpiryUUID.ToString());
97 object citem = cache.Get(cacheItemUUID.ToString()); 98 cache.Get(cacheItemUUID.ToString());
99 //object citem = cache.Get(cacheItemUUID.ToString());
98 //Assert.That(citem == null, "Item should not be in Cache because we manually invalidated it"); 100 //Assert.That(citem == null, "Item should not be in Cache because we manually invalidated it");
99 } 101 }
100 102
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 87ba5a8..c052745 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -990,19 +990,19 @@ namespace OpenSim.Framework
990 { 990 {
991 string os = String.Empty; 991 string os = String.Empty;
992 992
993 if (Environment.OSVersion.Platform != PlatformID.Unix) 993// if (Environment.OSVersion.Platform != PlatformID.Unix)
994 { 994// {
995 os = Environment.OSVersion.ToString(); 995// os = Environment.OSVersion.ToString();
996 } 996// }
997 else 997// else
998 { 998// {
999 os = ReadEtcIssue(); 999// os = ReadEtcIssue();
1000 } 1000// }
1001 1001//
1002 if (os.Length > 45) 1002// if (os.Length > 45)
1003 { 1003// {
1004 os = os.Substring(0, 45); 1004// os = os.Substring(0, 45);
1005 } 1005// }
1006 1006
1007 return os; 1007 return os;
1008 } 1008 }