aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorMelanie2009-10-06 17:44:59 +0100
committerMelanie2009-10-06 17:44:59 +0100
commit0374f1b144f3faf35da39e3925e8abd4b2a8bd04 (patch)
tree456d3d532c70d32564d35fc3cb9bbc81bdf08b2e /OpenSim/Region
parentMake sure that keys exist in arrays before trying to access them. (diff)
parentCorrected words in error message. (diff)
downloadopensim-SC-0374f1b144f3faf35da39e3925e8abd4b2a8bd04.zip
opensim-SC-0374f1b144f3faf35da39e3925e8abd4b2a8bd04.tar.gz
opensim-SC-0374f1b144f3faf35da39e3925e8abd4b2a8bd04.tar.bz2
opensim-SC-0374f1b144f3faf35da39e3925e8abd4b2a8bd04.tar.xz
Merge branch 'master' into vehicles
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs26
-rw-r--r--OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs12
-rw-r--r--OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs2
-rw-r--r--OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs5
-rw-r--r--OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs2
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs14
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionCache.cs14
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs16
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs7
9 files changed, 70 insertions, 28 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs b/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs
index 2120d33..cc290ed 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs
@@ -88,7 +88,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
88 J2KImage imgrequest; 88 J2KImage imgrequest;
89 89
90 // Do a linear search for this texture download 90 // Do a linear search for this texture download
91 lock (m_priorityQueue) 91 lock (m_syncRoot)
92 m_priorityQueue.Find(delegate(J2KImage img) { return img.TextureID == newRequest.RequestedAssetID; }, out imgrequest); 92 m_priorityQueue.Find(delegate(J2KImage img) { return img.TextureID == newRequest.RequestedAssetID; }, out imgrequest);
93 93
94 if (imgrequest != null) 94 if (imgrequest != null)
@@ -99,7 +99,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
99 99
100 try 100 try
101 { 101 {
102 lock (m_priorityQueue) 102 lock (m_syncRoot)
103 m_priorityQueue.Delete(imgrequest.PriorityQueueHandle); 103 m_priorityQueue.Delete(imgrequest.PriorityQueueHandle);
104 } 104 }
105 catch (Exception) { } 105 catch (Exception) { }
@@ -211,7 +211,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
211 { 211 {
212 J2KImage image = null; 212 J2KImage image = null;
213 213
214 lock (m_priorityQueue) 214 lock (m_syncRoot)
215 { 215 {
216 216
217 if (m_priorityQueue.Count > 0) 217 if (m_priorityQueue.Count > 0)
@@ -230,23 +230,27 @@ namespace OpenSim.Region.ClientStack.LindenUDP
230 { 230 {
231 image.PriorityQueueHandle = null; 231 image.PriorityQueueHandle = null;
232 232
233 lock (m_priorityQueue) 233 lock (m_syncRoot)
234 m_priorityQueue.Add(ref image.PriorityQueueHandle, image); 234 try
235 {
236 m_priorityQueue.Add(ref image.PriorityQueueHandle, image);
237 }
238 catch (Exception) { }
235 } 239 }
236 240
237 void RemoveImageFromQueue(J2KImage image) 241 void RemoveImageFromQueue(J2KImage image)
238 { 242 {
239 try 243 lock (m_syncRoot)
240 { 244 try
241 lock (m_priorityQueue) 245 {
242 m_priorityQueue.Delete(image.PriorityQueueHandle); 246 m_priorityQueue.Delete(image.PriorityQueueHandle);
243 } 247 }
244 catch (Exception) { } 248 catch (Exception) { }
245 } 249 }
246 250
247 void UpdateImageInQueue(J2KImage image) 251 void UpdateImageInQueue(J2KImage image)
248 { 252 {
249 lock (m_priorityQueue) 253 lock (m_syncRoot)
250 { 254 {
251 try { m_priorityQueue.Replace(image.PriorityQueueHandle, image); } 255 try { m_priorityQueue.Replace(image.PriorityQueueHandle, image); }
252 catch (Exception) 256 catch (Exception)
diff --git a/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs b/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs
index 5a5ad7e..66ca7c2 100644
--- a/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs
@@ -178,7 +178,7 @@ namespace OpenSim.Region.CoreModules.Asset
178 { 178 {
179 if (maximalSize <= 0 || maximalCount <= 0) 179 if (maximalSize <= 0 || maximalCount <= 0)
180 { 180 {
181 Log.Info("[ASSET CACHE]: Cenome asset cache is not enabled."); 181 //Log.Debug("[ASSET CACHE]: Cenome asset cache is not enabled.");
182 m_enabled = false; 182 m_enabled = false;
183 return; 183 return;
184 } 184 }
@@ -194,7 +194,7 @@ namespace OpenSim.Region.CoreModules.Asset
194 CnmSynchronizedCache<string, AssetBase>.Synchronized(new CnmMemoryCache<string, AssetBase>( 194 CnmSynchronizedCache<string, AssetBase>.Synchronized(new CnmMemoryCache<string, AssetBase>(
195 maximalSize, maximalCount, expirationTime)); 195 maximalSize, maximalCount, expirationTime));
196 m_enabled = true; 196 m_enabled = true;
197 Log.InfoFormat( 197 Log.DebugFormat(
198 "[ASSET CACHE]: Cenome asset cache enabled (MaxSize = {0} bytes, MaxCount = {1}, ExpirationTime = {2})", 198 "[ASSET CACHE]: Cenome asset cache enabled (MaxSize = {0} bytes, MaxCount = {1}, ExpirationTime = {2})",
199 maximalSize, 199 maximalSize,
200 maximalCount, 200 maximalCount,
@@ -263,7 +263,7 @@ namespace OpenSim.Region.CoreModules.Asset
263 263
264 if (m_getCount == m_debugEpoch) 264 if (m_getCount == m_debugEpoch)
265 { 265 {
266 Log.InfoFormat( 266 Log.DebugFormat(
267 "[ASSET CACHE]: Cached = {0}, Get = {1}, Hits = {2}%, Size = {3} bytes, Avg. A. Size = {4} bytes", 267 "[ASSET CACHE]: Cached = {0}, Get = {1}, Hits = {2}%, Size = {3} bytes, Avg. A. Size = {4} bytes",
268 m_cachedCount, 268 m_cachedCount,
269 m_getCount, 269 m_getCount,
@@ -333,7 +333,7 @@ namespace OpenSim.Region.CoreModules.Asset
333 return; 333 return;
334 334
335 string name = moduleConfig.GetString("AssetCaching"); 335 string name = moduleConfig.GetString("AssetCaching");
336 Log.DebugFormat("[XXX] name = {0} (this module's name: {1}", name, Name); 336 //Log.DebugFormat("[XXX] name = {0} (this module's name: {1}", name, Name);
337 337
338 if (name != Name) 338 if (name != Name)
339 return; 339 return;
@@ -343,14 +343,14 @@ namespace OpenSim.Region.CoreModules.Asset
343 int maxCount = DefaultMaxCount; 343 int maxCount = DefaultMaxCount;
344 TimeSpan expirationTime = DefaultExpirationTime; 344 TimeSpan expirationTime = DefaultExpirationTime;
345 345
346 IConfig assetConfig = source.Configs[ "AssetCache" ]; 346 IConfig assetConfig = source.Configs["AssetCache"];
347 if (assetConfig != null) 347 if (assetConfig != null)
348 { 348 {
349 // Get optional configurations 349 // Get optional configurations
350 maxSize = assetConfig.GetLong("MaxSize", DefaultMaxSize); 350 maxSize = assetConfig.GetLong("MaxSize", DefaultMaxSize);
351 maxCount = assetConfig.GetInt("MaxCount", DefaultMaxCount); 351 maxCount = assetConfig.GetInt("MaxCount", DefaultMaxCount);
352 expirationTime = 352 expirationTime =
353 TimeSpan.FromMinutes(assetConfig.GetInt("ExpirationTime", (int) DefaultExpirationTime.TotalMinutes)); 353 TimeSpan.FromMinutes(assetConfig.GetInt("ExpirationTime", (int)DefaultExpirationTime.TotalMinutes));
354 354
355 // Debugging purposes only 355 // Debugging purposes only
356 m_debugEpoch = assetConfig.GetInt("DebugEpoch", 0); 356 m_debugEpoch = assetConfig.GetInt("DebugEpoch", 0);
diff --git a/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs b/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs
index 2de40d2..0a7e736 100644
--- a/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs
@@ -66,7 +66,7 @@ namespace OpenSim.Region.CoreModules.Asset
66 if (moduleConfig != null) 66 if (moduleConfig != null)
67 { 67 {
68 string name = moduleConfig.GetString("AssetCaching"); 68 string name = moduleConfig.GetString("AssetCaching");
69 m_log.DebugFormat("[XXX] name = {0} (this module's name: {1}", name, Name); 69 //m_log.DebugFormat("[XXX] name = {0} (this module's name: {1}", name, Name);
70 70
71 if (name == Name) 71 if (name == Name)
72 { 72 {
diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
index c0bb70c..b81ab41 100644
--- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
@@ -636,11 +636,8 @@ namespace Flotsam.RegionModules.AssetCache
636 m_log.InfoFormat("[FLOTSAM ASSET CACHE] flotsamcache clearfile - Remove all assets cached on disk"); 636 m_log.InfoFormat("[FLOTSAM ASSET CACHE] flotsamcache clearfile - Remove all assets cached on disk");
637 637
638 } 638 }
639
640
641 } 639 }
642 640
643 #endregion 641 #endregion
644
645 } 642 }
646} 643} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs b/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs
index 8d8e0fe..4869f5d 100644
--- a/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs
@@ -68,7 +68,7 @@ namespace OpenSim.Region.CoreModules.Asset
68 if (moduleConfig != null) 68 if (moduleConfig != null)
69 { 69 {
70 string name = moduleConfig.GetString("AssetCaching"); 70 string name = moduleConfig.GetString("AssetCaching");
71 m_log.DebugFormat("[ASSET CACHE] name = {0} (this module's name: {1}). Sync? ", name, Name, m_Cache.IsSynchronized); 71 //m_log.DebugFormat("[ASSET CACHE] name = {0} (this module's name: {1}). Sync? ", name, Name, m_Cache.IsSynchronized);
72 72
73 if (name == Name) 73 if (name == Name)
74 { 74 {
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs
index 3ca4882..1c72488 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs
@@ -206,6 +206,20 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
206 206
207 public GridRegion GetRegionByPosition(UUID scopeID, int x, int y) 207 public GridRegion GetRegionByPosition(UUID scopeID, int x, int y)
208 { 208 {
209 GridRegion region = null;
210
211 // First see if it's a neighbour, even if it isn't on this sim.
212 // Neighbour data is cached in memory, so this is fast
213 foreach (RegionCache rcache in m_LocalCache.Values)
214 {
215 region = rcache.GetRegionByPosition(x, y);
216 if (region != null)
217 {
218 return region;
219 }
220 }
221
222 // Then try on this sim (may be a lookup in DB if this is using MySql).
209 return m_GridService.GetRegionByPosition(scopeID, x, y); 223 return m_GridService.GetRegionByPosition(scopeID, x, y);
210 } 224 }
211 225
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionCache.cs
index 2b336bb..44e850b 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionCache.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionCache.cs
@@ -29,10 +29,12 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Reflection; 30using System.Reflection;
31 31
32using OpenSim.Framework;
32using OpenSim.Region.Framework.Scenes; 33using OpenSim.Region.Framework.Scenes;
33using OpenSim.Services.Interfaces; 34using OpenSim.Services.Interfaces;
34using GridRegion = OpenSim.Services.Interfaces.GridRegion; 35using GridRegion = OpenSim.Services.Interfaces.GridRegion;
35 36
37using OpenMetaverse;
36using log4net; 38using log4net;
37 39
38namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid 40namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
@@ -75,5 +77,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
75 { 77 {
76 return new List<GridRegion>(m_neighbours.Values); 78 return new List<GridRegion>(m_neighbours.Values);
77 } 79 }
80
81 public GridRegion GetRegionByPosition(int x, int y)
82 {
83 uint xsnap = (uint)(x / Constants.RegionSize) * Constants.RegionSize;
84 uint ysnap = (uint)(y / Constants.RegionSize) * Constants.RegionSize;
85 ulong handle = Utils.UIntsToLong(xsnap, ysnap);
86
87 if (m_neighbours.ContainsKey(handle))
88 return m_neighbours[handle];
89
90 return null;
91 }
78 } 92 }
79} 93}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index c06a58f..9418e3d 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -137,6 +137,8 @@ namespace OpenSim.Region.Framework.Scenes
137 protected IAssetService m_AssetService = null; 137 protected IAssetService m_AssetService = null;
138 protected IAuthorizationService m_AuthorizationService = null; 138 protected IAuthorizationService m_AuthorizationService = null;
139 139
140 private Object m_heartbeatLock = new Object();
141
140 public IAssetService AssetService 142 public IAssetService AssetService
141 { 143 {
142 get 144 get
@@ -942,6 +944,9 @@ namespace OpenSim.Region.Framework.Scenes
942 /// <param name="e"></param> 944 /// <param name="e"></param>
943 private void Heartbeat(object sender) 945 private void Heartbeat(object sender)
944 { 946 {
947 if (!Monitor.TryEnter(m_heartbeatLock))
948 return;
949
945 try 950 try
946 { 951 {
947 Update(); 952 Update();
@@ -952,6 +957,11 @@ namespace OpenSim.Region.Framework.Scenes
952 catch (ThreadAbortException) 957 catch (ThreadAbortException)
953 { 958 {
954 } 959 }
960 finally
961 {
962 Monitor.Pulse(m_heartbeatLock);
963 Monitor.Exit(m_heartbeatLock);
964 }
955 } 965 }
956 966
957 /// <summary> 967 /// <summary>
@@ -962,6 +972,12 @@ namespace OpenSim.Region.Framework.Scenes
962 int maintc = 0; 972 int maintc = 0;
963 while (!shuttingdown) 973 while (!shuttingdown)
964 { 974 {
975//#if DEBUG
976// int w = 0, io = 0;
977// ThreadPool.GetAvailableThreads(out w, out io);
978// if ((w < 10) || (io < 10))
979// m_log.DebugFormat("[WARNING]: ThreadPool reaching exhaustion. workers = {0}; io = {1}", w, io);
980//#endif
965 maintc = Environment.TickCount; 981 maintc = Environment.TickCount;
966 982
967 TimeSpan SinceLastFrame = DateTime.Now - m_lastupdate; 983 TimeSpan SinceLastFrame = DateTime.Now - m_lastupdate;
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index 06bae5a..c02b123 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -3488,7 +3488,7 @@ namespace OpenSim.Region.Physics.OdePlugin
3488 public override void UnCombine(PhysicsScene pScene) 3488 public override void UnCombine(PhysicsScene pScene)
3489 { 3489 {
3490 IntPtr localGround = IntPtr.Zero; 3490 IntPtr localGround = IntPtr.Zero;
3491 float[] localHeightfield; 3491 //float[] localHeightfield;
3492 bool proceed = false; 3492 bool proceed = false;
3493 List<IntPtr> geomDestroyList = new List<IntPtr>(); 3493 List<IntPtr> geomDestroyList = new List<IntPtr>();
3494 3494
@@ -3785,16 +3785,13 @@ namespace OpenSim.Region.Physics.OdePlugin
3785 sides.Z = 0.5f; 3785 sides.Z = 0.5f;
3786 3786
3787 ds.DrawBox(ref pos, ref R, ref sides); 3787 ds.DrawBox(ref pos, ref R, ref sides);
3788
3789
3790 } 3788 }
3791 } 3789 }
3792 } 3790 }
3793 } 3791 }
3794 3792
3795 public void start(int unused) 3793 public void start(int unused)
3796 { 3794 {
3797
3798 ds.SetViewpoint(ref xyz, ref hpr); 3795 ds.SetViewpoint(ref xyz, ref hpr);
3799 } 3796 }
3800#endif 3797#endif