aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
authorRobert Adams2014-01-19 07:38:53 -0800
committerRobert Adams2014-01-19 07:38:53 -0800
commitf127e4b4ee916a429ef1d9922432869d4138e214 (patch)
treebe90e6cea8d61088e8380e7027881a8d13f67849 /OpenSim/Region/CoreModules
parentvarregion: Update Warp3D to properly handle varregions. (diff)
parentFix casting error for float type INI file parameter parsing. (diff)
downloadopensim-SC-f127e4b4ee916a429ef1d9922432869d4138e214.zip
opensim-SC-f127e4b4ee916a429ef1d9922432869d4138e214.tar.gz
opensim-SC-f127e4b4ee916a429ef1d9922432869d4138e214.tar.bz2
opensim-SC-f127e4b4ee916a429ef1d9922432869d4138e214.tar.xz
Merge branch 'master' into varregion
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs6
-rw-r--r--OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs3
-rw-r--r--OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs157
-rw-r--r--OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs2
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs4
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs4
7 files changed, 70 insertions, 108 deletions
diff --git a/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs b/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs
index f43305f..9b0e1f4 100644
--- a/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs
@@ -194,10 +194,12 @@ namespace OpenSim.Region.CoreModules.Asset
194 194
195 #region IImprovedAssetCache Members 195 #region IImprovedAssetCache Members
196 196
197
198 public bool Check(string id) 197 public bool Check(string id)
199 { 198 {
200 return false; 199 AssetBase asset;
200
201 // XXX:This is probably not an efficient implementation.
202 return m_cache.TryGetValue(id, out asset);
201 } 203 }
202 204
203 /// <summary> 205 /// <summary>
diff --git a/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs b/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs
index 58ce61a..f720748 100644
--- a/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs
@@ -114,7 +114,8 @@ namespace OpenSim.Region.CoreModules.Asset
114 // 114 //
115 public bool Check(string id) 115 public bool Check(string id)
116 { 116 {
117 return false; 117 // XXX This is probably not an efficient implementation.
118 return Get(id) != null;
118 } 119 }
119 120
120 public void Cache(AssetBase asset) 121 public void Cache(AssetBase asset)
diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
index f1fee63..6a5f8f3 100644
--- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
@@ -248,71 +248,68 @@ namespace OpenSim.Region.CoreModules.Asset
248 248
249 private void UpdateFileCache(string key, AssetBase asset) 249 private void UpdateFileCache(string key, AssetBase asset)
250 { 250 {
251 // TODO: Spawn this off to some seperate thread to do the actual writing 251 string filename = GetFileName(key);
252 if (asset != null)
253 {
254 string filename = GetFileName(key);
255 252
256 try 253 try
254 {
255 // If the file is already cached, don't cache it, just touch it so access time is updated
256 if (File.Exists(filename))
257 { 257 {
258 // If the file is already cached, don't cache it, just touch it so access time is updated 258 // We don't really want to know about sharing
259 if (File.Exists(filename)) 259 // violations here. If the file is locked, then
260 // the other thread has updated the time for us.
261 try
260 { 262 {
261 // We don't really want to know about sharing 263 lock (m_CurrentlyWriting)
262 // violations here. If the file is locked, then
263 // the other thread has updated the time for us.
264 try
265 { 264 {
266 lock (m_CurrentlyWriting) 265 if (!m_CurrentlyWriting.Contains(filename))
267 { 266 File.SetLastAccessTime(filename, DateTime.Now);
268 if (!m_CurrentlyWriting.Contains(filename))
269 File.SetLastAccessTime(filename, DateTime.Now);
270 }
271 } 267 }
272 catch 268 }
269 catch
270 {
271 }
272 }
273 else
274 {
275 // Once we start writing, make sure we flag that we're writing
276 // that object to the cache so that we don't try to write the
277 // same file multiple times.
278 lock (m_CurrentlyWriting)
279 {
280#if WAIT_ON_INPROGRESS_REQUESTS
281 if (m_CurrentlyWriting.ContainsKey(filename))
273 { 282 {
283 return;
274 } 284 }
275 } else { 285 else
276
277 // Once we start writing, make sure we flag that we're writing
278 // that object to the cache so that we don't try to write the
279 // same file multiple times.
280 lock (m_CurrentlyWriting)
281 { 286 {
282#if WAIT_ON_INPROGRESS_REQUESTS 287 m_CurrentlyWriting.Add(filename, new ManualResetEvent(false));
283 if (m_CurrentlyWriting.ContainsKey(filename)) 288 }
284 {
285 return;
286 }
287 else
288 {
289 m_CurrentlyWriting.Add(filename, new ManualResetEvent(false));
290 }
291 289
292#else 290#else
293 if (m_CurrentlyWriting.Contains(filename)) 291 if (m_CurrentlyWriting.Contains(filename))
294 { 292 {
295 return; 293 return;
296 }
297 else
298 {
299 m_CurrentlyWriting.Add(filename);
300 }
301#endif
302
303 } 294 }
295 else
296 {
297 m_CurrentlyWriting.Add(filename);
298 }
299#endif
304 300
305 Util.FireAndForget(
306 delegate { WriteFileCache(filename, asset); });
307 } 301 }
308 } 302
309 catch (Exception e) 303 Util.FireAndForget(
310 { 304 delegate { WriteFileCache(filename, asset); });
311 m_log.ErrorFormat(
312 "[FLOTSAM ASSET CACHE]: Failed to update cache for asset {0}. Exception {1} {2}",
313 asset.ID, e.Message, e.StackTrace);
314 } 305 }
315 } 306 }
307 catch (Exception e)
308 {
309 m_log.ErrorFormat(
310 "[FLOTSAM ASSET CACHE]: Failed to update cache for asset {0}. Exception {1} {2}",
311 asset.ID, e.Message, e.StackTrace);
312 }
316 } 313 }
317 314
318 public void Cache(AssetBase asset) 315 public void Cache(AssetBase asset)
@@ -347,15 +344,9 @@ namespace OpenSim.Region.CoreModules.Asset
347 344
348 private bool CheckFromMemoryCache(string id) 345 private bool CheckFromMemoryCache(string id)
349 { 346 {
350 AssetBase asset = null; 347 return m_MemoryCache.Contains(id);
351
352 if (m_MemoryCache.TryGetValue(id, out asset))
353 return true;
354
355 return false;
356 } 348 }
357 349
358
359 /// <summary> 350 /// <summary>
360 /// Try to get an asset from the file cache. 351 /// Try to get an asset from the file cache.
361 /// </summary> 352 /// </summary>
@@ -393,15 +384,16 @@ namespace OpenSim.Region.CoreModules.Asset
393 384
394 if (File.Exists(filename)) 385 if (File.Exists(filename))
395 { 386 {
396 FileStream stream = null;
397 try 387 try
398 { 388 {
399 stream = File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.Read); 389 using (FileStream stream = File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.Read))
400 BinaryFormatter bformatter = new BinaryFormatter(); 390 {
391 BinaryFormatter bformatter = new BinaryFormatter();
401 392
402 asset = (AssetBase)bformatter.Deserialize(stream); 393 asset = (AssetBase)bformatter.Deserialize(stream);
403 394
404 m_DiskHits++; 395 m_DiskHits++;
396 }
405 } 397 }
406 catch (System.Runtime.Serialization.SerializationException e) 398 catch (System.Runtime.Serialization.SerializationException e)
407 { 399 {
@@ -420,12 +412,6 @@ namespace OpenSim.Region.CoreModules.Asset
420 m_log.WarnFormat( 412 m_log.WarnFormat(
421 "[FLOTSAM ASSET CACHE]: Failed to get file {0} for asset {1}. Exception {2} {3}", 413 "[FLOTSAM ASSET CACHE]: Failed to get file {0} for asset {1}. Exception {2} {3}",
422 filename, id, e.Message, e.StackTrace); 414 filename, id, e.Message, e.StackTrace);
423
424 }
425 finally
426 {
427 if (stream != null)
428 stream.Close();
429 } 415 }
430 } 416 }
431 417
@@ -437,36 +423,19 @@ namespace OpenSim.Region.CoreModules.Asset
437 bool found = false; 423 bool found = false;
438 424
439 string filename = GetFileName(id); 425 string filename = GetFileName(id);
426
440 if (File.Exists(filename)) 427 if (File.Exists(filename))
441 { 428 {
442 // actually check if we can open it, and so update expire
443 FileStream stream = null;
444 try 429 try
445 { 430 {
446 stream = File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.Read); 431 using (FileStream stream = File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.Read))
447 if (stream != null)
448 { 432 {
449 found = true; 433 if (stream != null)
450 stream.Close(); 434 found = true;
451 } 435 }
452
453 }
454 catch (System.Runtime.Serialization.SerializationException e)
455 {
456 found = false;
457 m_log.ErrorFormat(
458 "[FLOTSAM ASSET CACHE]: Failed to check file {0} for asset {1}. Exception {2} {3}",
459 filename, id, e.Message, e.StackTrace);
460
461 // If there was a problem deserializing the asset, the asset may
462 // either be corrupted OR was serialized under an old format
463 // {different version of AssetBase} -- we should attempt to
464 // delete it and re-cache
465 File.Delete(filename);
466 } 436 }
467 catch (Exception e) 437 catch (Exception e)
468 { 438 {
469 found = false;
470 m_log.ErrorFormat( 439 m_log.ErrorFormat(
471 "[FLOTSAM ASSET CACHE]: Failed to check file {0} for asset {1}. Exception {2} {3}", 440 "[FLOTSAM ASSET CACHE]: Failed to check file {0} for asset {1}. Exception {2} {3}",
472 filename, id, e.Message, e.StackTrace); 441 filename, id, e.Message, e.StackTrace);
@@ -518,11 +487,6 @@ namespace OpenSim.Region.CoreModules.Asset
518 return Get(id); 487 return Get(id);
519 } 488 }
520 489
521 public AssetBase CheckCached(string id)
522 {
523 return Get(id);
524 }
525
526 public void Expire(string id) 490 public void Expire(string id)
527 { 491 {
528 if (m_LogLevel >= 2) 492 if (m_LogLevel >= 2)
@@ -1067,11 +1031,6 @@ namespace OpenSim.Region.CoreModules.Asset
1067 return asset.Data; 1031 return asset.Data;
1068 } 1032 }
1069 1033
1070 public bool CheckData(string id)
1071 {
1072 return Check(id); ;
1073 }
1074
1075 public bool Get(string id, object sender, AssetRetrieved handler) 1034 public bool Get(string id, object sender, AssetRetrieved handler)
1076 { 1035 {
1077 AssetBase asset = Get(id); 1036 AssetBase asset = Get(id);
diff --git a/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs b/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs
index ce9b546..5f76ac2 100644
--- a/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs
@@ -117,7 +117,7 @@ namespace OpenSim.Region.CoreModules.Asset
117 117
118 public bool Check(string id) 118 public bool Check(string id)
119 { 119 {
120 return false; 120 return m_Cache.Contains(id);
121 } 121 }
122 122
123 public void Cache(AssetBase asset) 123 public void Cache(AssetBase asset)
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 4ab36a5..85e8159 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -1433,7 +1433,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1433 public GridRegion GetDestination(Scene scene, UUID agentID, Vector3 pos, out string version, out Vector3 newpos) 1433 public GridRegion GetDestination(Scene scene, UUID agentID, Vector3 pos, out string version, out Vector3 newpos)
1434 { 1434 {
1435 version = String.Empty; 1435 version = String.Empty;
1436 newpos = new Vector3(pos.X, pos.Y, pos.Z); 1436 newpos = pos;
1437 1437
1438// m_log.DebugFormat( 1438// m_log.DebugFormat(
1439// "[ENTITY TRANSFER MODULE]: Crossing agent {0} at pos {1} in {2}", agent.Name, pos, scene.Name); 1439// "[ENTITY TRANSFER MODULE]: Crossing agent {0} at pos {1} in {2}", agent.Name, pos, scene.Name);
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
index 678f3dc..4dcb99f 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
@@ -174,7 +174,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
174 174
175 #endregion 175 #endregion
176 176
177 #region ISimulation 177 #region ISimulationService
178 178
179 public IScene GetScene(UUID regionId) 179 public IScene GetScene(UUID regionId)
180 { 180 {
@@ -353,7 +353,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
353 return false; 353 return false;
354 } 354 }
355 355
356 #endregion /* IInterregionComms */ 356 #endregion
357 357
358 #region Misc 358 #region Misc
359 359
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
index f45f560..cc01430 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
@@ -146,7 +146,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
146 146
147 #endregion 147 #endregion
148 148
149 #region IInterregionComms 149 #region ISimulationService
150 150
151 public IScene GetScene(UUID regionId) 151 public IScene GetScene(UUID regionId)
152 { 152 {
@@ -279,6 +279,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
279 return false; 279 return false;
280 } 280 }
281 281
282 #endregion /* IInterregionComms */ 282 #endregion
283 } 283 }
284} 284}