aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/IClientAPI.cs2
-rw-r--r--OpenSim/Framework/RegionInfo.cs298
-rw-r--r--OpenSim/Framework/Servers/VersionInfo.cs3
-rw-r--r--OpenSim/Framework/TaskInventoryDictionary.cs117
-rw-r--r--OpenSim/Framework/Util.cs26
5 files changed, 425 insertions, 21 deletions
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index 04ba9c6..cb136e2 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -1077,7 +1077,7 @@ namespace OpenSim.Framework
1077 1077
1078 void SendInstantMessage(GridInstantMessage im); 1078 void SendInstantMessage(GridInstantMessage im);
1079 1079
1080 void SendGenericMessage(string method, List<string> message); 1080 void SendGenericMessage(string method, List<byte[]> message);
1081 1081
1082 void SendLayerData(float[] map); 1082 void SendLayerData(float[] map);
1083 void SendLayerData(int px, int py, float[] map); 1083 void SendLayerData(int px, int py, float[] map);
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs
index 88b62e0..9e00528 100644
--- a/OpenSim/Framework/RegionInfo.cs
+++ b/OpenSim/Framework/RegionInfo.cs
@@ -36,8 +36,290 @@ using OpenMetaverse;
36using OpenMetaverse.StructuredData; 36using OpenMetaverse.StructuredData;
37using OpenSim.Framework.Console; 37using OpenSim.Framework.Console;
38 38
39
39namespace OpenSim.Framework 40namespace OpenSim.Framework
40{ 41{
42 public class RegionMeta7WindlightData
43 {
44 public UUID regionID = UUID.Zero;
45 public Vector3 waterColor = new Vector3(4.0f,38.0f,64.0f);
46 public float waterFogDensityExponent = 4.0f;
47 public float underwaterFogModifier = 0.25f;
48 public Vector3 reflectionWaveletScale = new Vector3(2.0f,2.0f,2.0f);
49 public float fresnelScale = 0.40f;
50 public float fresnelOffset = 0.50f;
51 public float refractScaleAbove = 0.03f;
52 public float refractScaleBelow = 0.20f;
53 public float blurMultiplier = 0.040f;
54 public Vector2 bigWaveDirection = new Vector2(1.05f,-0.42f);
55 public Vector2 littleWaveDirection = new Vector2(1.11f,-1.16f);
56 public UUID normalMapTexture = new UUID("822ded49-9a6c-f61c-cb89-6df54f42cdf4");
57 public Vector4 horizon = new Vector4(0.26f, 0.24f, 0.34f, 0.33f);
58 public float hazeHorizon = 0.19f;
59 public Vector4 blueDensity = new Vector4(0.10f, 0.93f, 0.02f, 0.93f);
60 public float hazeDensity = 0.70f;
61 public float densityMultiplier = 0.18f;
62 public float distanceMultiplier = 0.8f;
63 public UInt16 maxAltitude = 1605;
64 public Vector4 sunMoonColor = new Vector4(0.24f, 0.26f, 0.30f, 0.30f);
65 public float sunMoonPosition = 0.335f;
66 public Vector4 ambient = new Vector4(0.35f,0.35f,0.35f,0.35f);
67 public float eastAngle = 0.0f;
68 public float sunGlowFocus = 0.10f;
69 public float sunGlowSize = 0.10f;
70 public float sceneGamma = 1.0f;
71 public float starBrightness = 0.0f;
72 public Vector4 cloudColor = new Vector4(0.41f, 0.41f, 0.41f, 0.41f);
73 public Vector3 cloudXYDensity = new Vector3(1.00f, 0.53f, 1.00f);
74 public float cloudCoverage = 0.27f;
75 public float cloudScale = 0.42f;
76 public Vector3 cloudDetailXYDensity = new Vector3(1.00f, 0.53f, 0.12f);
77 public float cloudScrollX = 0.20f;
78 public bool cloudScrollXLock = false;
79 public float cloudScrollY = 0.01f;
80 public bool cloudScrollYLock = false;
81 public bool drawClassicClouds = false;
82
83 public delegate void SaveDelegate(RegionMeta7WindlightData wl);
84 public event SaveDelegate OnSave;
85 public void Save()
86 {
87 if (OnSave != null)
88 OnSave(this);
89 }
90 }
91
92 [Serializable]
93 public class SimpleRegionInfo
94 {
95 // private static readonly log4net.ILog m_log
96 // = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
97
98 /// <summary>
99 /// The port by which http communication occurs with the region (most noticeably, CAPS communication)
100 /// </summary>
101 public uint HttpPort
102 {
103 get { return m_httpPort; }
104 set { m_httpPort = value; }
105 }
106 protected uint m_httpPort;
107
108 /// <summary>
109 /// A well-formed URI for the host region server (namely "http://" + ExternalHostName)
110 /// </summary>
111 public string ServerURI
112 {
113 get { return m_serverURI; }
114 set { m_serverURI = value; }
115 }
116 protected string m_serverURI;
117
118 public string RegionName
119 {
120 get { return m_regionName; }
121 set { m_regionName = value; }
122 }
123 protected string m_regionName = String.Empty;
124
125 protected bool Allow_Alternate_Ports;
126 public bool m_allow_alternate_ports;
127 protected string m_externalHostName;
128
129 protected IPEndPoint m_internalEndPoint;
130 protected uint? m_regionLocX;
131 protected uint? m_regionLocY;
132 protected uint m_remotingPort;
133 public UUID RegionID = UUID.Zero;
134 public string RemotingAddress;
135 public UUID ScopeID = UUID.Zero;
136
137 public SimpleRegionInfo()
138 {
139 }
140
141 public SimpleRegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri)
142 {
143 m_regionLocX = regionLocX;
144 m_regionLocY = regionLocY;
145
146 m_internalEndPoint = internalEndPoint;
147 m_externalHostName = externalUri;
148 }
149
150 public SimpleRegionInfo(uint regionLocX, uint regionLocY, string externalUri, uint port)
151 {
152 m_regionLocX = regionLocX;
153 m_regionLocY = regionLocY;
154
155 m_externalHostName = externalUri;
156
157 m_internalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int) port);
158 }
159
160 public SimpleRegionInfo(RegionInfo ConvertFrom)
161 {
162 m_regionName = ConvertFrom.RegionName;
163 m_regionLocX = ConvertFrom.RegionLocX;
164 m_regionLocY = ConvertFrom.RegionLocY;
165 m_internalEndPoint = ConvertFrom.InternalEndPoint;
166 m_externalHostName = ConvertFrom.ExternalHostName;
167 m_remotingPort = ConvertFrom.RemotingPort;
168 m_httpPort = ConvertFrom.HttpPort;
169 m_allow_alternate_ports = ConvertFrom.m_allow_alternate_ports;
170 RemotingAddress = ConvertFrom.RemotingAddress;
171 RegionID = UUID.Zero;
172 ServerURI = ConvertFrom.ServerURI;
173 }
174
175 public uint RemotingPort
176 {
177 get { return m_remotingPort; }
178 set { m_remotingPort = value; }
179 }
180
181 /// <value>
182 /// This accessor can throw all the exceptions that Dns.GetHostAddresses can throw.
183 ///
184 /// XXX Isn't this really doing too much to be a simple getter, rather than an explict method?
185 /// </value>
186 public IPEndPoint ExternalEndPoint
187 {
188 get
189 {
190 // Old one defaults to IPv6
191 //return new IPEndPoint(Dns.GetHostAddresses(m_externalHostName)[0], m_internalEndPoint.Port);
192
193 IPAddress ia = null;
194 // If it is already an IP, don't resolve it - just return directly
195 if (IPAddress.TryParse(m_externalHostName, out ia))
196 return new IPEndPoint(ia, m_internalEndPoint.Port);
197
198 // Reset for next check
199 ia = null;
200 try
201 {
202 foreach (IPAddress Adr in Dns.GetHostAddresses(m_externalHostName))
203 {
204 if (ia == null)
205 ia = Adr;
206
207 if (Adr.AddressFamily == AddressFamily.InterNetwork)
208 {
209 ia = Adr;
210 break;
211 }
212 }
213 }
214 catch (SocketException e)
215 {
216 throw new Exception(
217 "Unable to resolve local hostname " + m_externalHostName + " innerException of type '" +
218 e + "' attached to this exception", e);
219 }
220
221 return new IPEndPoint(ia, m_internalEndPoint.Port);
222 }
223
224 set { m_externalHostName = value.ToString(); }
225 }
226
227 public string ExternalHostName
228 {
229 get { return m_externalHostName; }
230 set { m_externalHostName = value; }
231 }
232
233 public IPEndPoint InternalEndPoint
234 {
235 get { return m_internalEndPoint; }
236 set { m_internalEndPoint = value; }
237 }
238
239 public uint RegionLocX
240 {
241 get { return m_regionLocX.Value; }
242 set { m_regionLocX = value; }
243 }
244
245 public uint RegionLocY
246 {
247 get { return m_regionLocY.Value; }
248 set { m_regionLocY = value; }
249 }
250
251 public ulong RegionHandle
252 {
253 get { return Util.UIntsToLong((RegionLocX * (uint) Constants.RegionSize), (RegionLocY * (uint) Constants.RegionSize)); }
254 }
255
256 public int getInternalEndPointPort()
257 {
258 return m_internalEndPoint.Port;
259 }
260
261 public Dictionary<string, object> ToKeyValuePairs()
262 {
263 Dictionary<string, object> kvp = new Dictionary<string, object>();
264 kvp["uuid"] = RegionID.ToString();
265 kvp["locX"] = RegionLocX.ToString();
266 kvp["locY"] = RegionLocY.ToString();
267 kvp["external_ip_address"] = ExternalEndPoint.Address.ToString();
268 kvp["external_port"] = ExternalEndPoint.Port.ToString();
269 kvp["external_host_name"] = ExternalHostName;
270 kvp["http_port"] = HttpPort.ToString();
271 kvp["internal_ip_address"] = InternalEndPoint.Address.ToString();
272 kvp["internal_port"] = InternalEndPoint.Port.ToString();
273 kvp["alternate_ports"] = m_allow_alternate_ports.ToString();
274 kvp["server_uri"] = ServerURI;
275
276 return kvp;
277 }
278
279 public SimpleRegionInfo(Dictionary<string, object> kvp)
280 {
281 if ((kvp["external_ip_address"] != null) && (kvp["external_port"] != null))
282 {
283 int port = 0;
284 Int32.TryParse((string)kvp["external_port"], out port);
285 IPEndPoint ep = new IPEndPoint(IPAddress.Parse((string)kvp["external_ip_address"]), port);
286 ExternalEndPoint = ep;
287 }
288 else
289 ExternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0);
290
291 if (kvp["external_host_name"] != null)
292 ExternalHostName = (string)kvp["external_host_name"];
293
294 if (kvp["http_port"] != null)
295 {
296 UInt32 port = 0;
297 UInt32.TryParse((string)kvp["http_port"], out port);
298 HttpPort = port;
299 }
300
301 if ((kvp["internal_ip_address"] != null) && (kvp["internal_port"] != null))
302 {
303 int port = 0;
304 Int32.TryParse((string)kvp["internal_port"], out port);
305 IPEndPoint ep = new IPEndPoint(IPAddress.Parse((string)kvp["internal_ip_address"]), port);
306 InternalEndPoint = ep;
307 }
308 else
309 InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0);
310
311 if (kvp["alternate_ports"] != null)
312 {
313 bool alts = false;
314 Boolean.TryParse((string)kvp["alternate_ports"], out alts);
315 m_allow_alternate_ports = alts;
316 }
317
318 if (kvp["server_uri"] != null)
319 ServerURI = (string)kvp["server_uri"];
320 }
321 }
322
41 public class RegionInfo 323 public class RegionInfo
42 { 324 {
43 // private static readonly log4net.ILog m_log 325 // private static readonly log4net.ILog m_log
@@ -73,6 +355,7 @@ namespace OpenSim.Framework
73 private bool m_clampPrimSize = false; 355 private bool m_clampPrimSize = false;
74 private int m_objectCapacity = 0; 356 private int m_objectCapacity = 0;
75 private string m_regionType = String.Empty; 357 private string m_regionType = String.Empty;
358 private RegionMeta7WindlightData m_windlight = new RegionMeta7WindlightData();
76 protected uint m_httpPort; 359 protected uint m_httpPort;
77 protected string m_serverURI; 360 protected string m_serverURI;
78 protected string m_regionName = String.Empty; 361 protected string m_regionName = String.Empty;
@@ -211,6 +494,21 @@ namespace OpenSim.Framework
211 set { m_regionSettings = value; } 494 set { m_regionSettings = value; }
212 } 495 }
213 496
497 public RegionMeta7WindlightData WindlightSettings
498 {
499 get
500 {
501 if (m_windlight == null)
502 {
503 m_windlight = new RegionMeta7WindlightData();
504 }
505
506 return m_windlight;
507 }
508
509 set { m_windlight = value; }
510 }
511
214 public int NonphysPrimMax 512 public int NonphysPrimMax
215 { 513 {
216 get { return m_nonphysPrimMax; } 514 get { return m_nonphysPrimMax; }
diff --git a/OpenSim/Framework/Servers/VersionInfo.cs b/OpenSim/Framework/Servers/VersionInfo.cs
index ec94b2d..d348c90 100644
--- a/OpenSim/Framework/Servers/VersionInfo.cs
+++ b/OpenSim/Framework/Servers/VersionInfo.cs
@@ -29,9 +29,8 @@ namespace OpenSim
29{ 29{
30 public class VersionInfo 30 public class VersionInfo
31 { 31 {
32 private const string VERSION_NUMBER = "0.6.9"; 32 private const string VERSION_NUMBER = "0.6.9CM";
33 private const Flavour VERSION_FLAVOUR = Flavour.Dev; 33 private const Flavour VERSION_FLAVOUR = Flavour.Dev;
34
35 public enum Flavour 34 public enum Flavour
36 { 35 {
37 Unknown, 36 Unknown,
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/Util.cs b/OpenSim/Framework/Util.cs
index 7215086..58a0d77 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 }