diff options
Diffstat (limited to 'OpenSim/Region/CoreModules')
13 files changed, 450 insertions, 178 deletions
diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs index 48ee277..2b3f7f5 100644 --- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs | |||
@@ -86,6 +86,8 @@ namespace Flotsam.RegionModules.AssetCache | |||
86 | private List<string> m_CurrentlyWriting = new List<string>(); | 86 | private List<string> m_CurrentlyWriting = new List<string>(); |
87 | #endif | 87 | #endif |
88 | 88 | ||
89 | private bool m_FileCacheEnabled = true; | ||
90 | |||
89 | private ExpiringCache<string, AssetBase> m_MemoryCache; | 91 | private ExpiringCache<string, AssetBase> m_MemoryCache; |
90 | private bool m_MemoryCacheEnabled = false; | 92 | private bool m_MemoryCacheEnabled = false; |
91 | 93 | ||
@@ -146,6 +148,7 @@ namespace Flotsam.RegionModules.AssetCache | |||
146 | } | 148 | } |
147 | else | 149 | else |
148 | { | 150 | { |
151 | m_FileCacheEnabled = assetConfig.GetBoolean("FileCacheEnabled", m_FileCacheEnabled); | ||
149 | m_CacheDirectory = assetConfig.GetString("CacheDirectory", m_DefaultCacheDirectory); | 152 | m_CacheDirectory = assetConfig.GetString("CacheDirectory", m_DefaultCacheDirectory); |
150 | 153 | ||
151 | m_MemoryCacheEnabled = assetConfig.GetBoolean("MemoryCacheEnabled", m_MemoryCacheEnabled); | 154 | m_MemoryCacheEnabled = assetConfig.GetBoolean("MemoryCacheEnabled", m_MemoryCacheEnabled); |
@@ -173,7 +176,7 @@ namespace Flotsam.RegionModules.AssetCache | |||
173 | 176 | ||
174 | m_log.InfoFormat("[FLOTSAM ASSET CACHE]: Cache Directory {0}", m_CacheDirectory); | 177 | m_log.InfoFormat("[FLOTSAM ASSET CACHE]: Cache Directory {0}", m_CacheDirectory); |
175 | 178 | ||
176 | if ((m_FileExpiration > TimeSpan.Zero) && (m_FileExpirationCleanupTimer > TimeSpan.Zero)) | 179 | if (m_FileCacheEnabled && (m_FileExpiration > TimeSpan.Zero) && (m_FileExpirationCleanupTimer > TimeSpan.Zero)) |
177 | { | 180 | { |
178 | m_CacheCleanTimer = new System.Timers.Timer(m_FileExpirationCleanupTimer.TotalMilliseconds); | 181 | m_CacheCleanTimer = new System.Timers.Timer(m_FileExpirationCleanupTimer.TotalMilliseconds); |
179 | m_CacheCleanTimer.AutoReset = true; | 182 | m_CacheCleanTimer.AutoReset = true; |
@@ -226,7 +229,6 @@ namespace Flotsam.RegionModules.AssetCache | |||
226 | if (m_AssetService == null) | 229 | if (m_AssetService == null) |
227 | { | 230 | { |
228 | m_AssetService = scene.RequestModuleInterface<IAssetService>(); | 231 | m_AssetService = scene.RequestModuleInterface<IAssetService>(); |
229 | |||
230 | } | 232 | } |
231 | } | 233 | } |
232 | } | 234 | } |
@@ -250,138 +252,171 @@ namespace Flotsam.RegionModules.AssetCache | |||
250 | 252 | ||
251 | private void UpdateMemoryCache(string key, AssetBase asset) | 253 | private void UpdateMemoryCache(string key, AssetBase asset) |
252 | { | 254 | { |
253 | if (m_MemoryCacheEnabled) | 255 | m_MemoryCache.AddOrUpdate(key, asset, m_MemoryExpiration); |
254 | m_MemoryCache.AddOrUpdate(key, asset, m_MemoryExpiration); | ||
255 | } | 256 | } |
256 | 257 | ||
257 | public void Cache(AssetBase asset) | 258 | private void UpdateFileCache(string key, AssetBase asset) |
258 | { | 259 | { |
259 | // TODO: Spawn this off to some seperate thread to do the actual writing | 260 | string filename = GetFileName(asset.ID); |
260 | if (asset != null) | ||
261 | { | ||
262 | UpdateMemoryCache(asset.ID, asset); | ||
263 | |||
264 | string filename = GetFileName(asset.ID); | ||
265 | 261 | ||
266 | try | 262 | try |
263 | { | ||
264 | // If the file is already cached, don't cache it, just touch it so access time is updated | ||
265 | if (File.Exists(filename)) | ||
267 | { | 266 | { |
268 | // If the file is already cached, don't cache it, just touch it so access time is updated | 267 | File.SetLastAccessTime(filename, DateTime.Now); |
269 | if (File.Exists(filename)) | 268 | } |
269 | else | ||
270 | { | ||
271 | // Once we start writing, make sure we flag that we're writing | ||
272 | // that object to the cache so that we don't try to write the | ||
273 | // same file multiple times. | ||
274 | lock (m_CurrentlyWriting) | ||
270 | { | 275 | { |
271 | File.SetLastAccessTime(filename, DateTime.Now); | ||
272 | } else { | ||
273 | |||
274 | // Once we start writing, make sure we flag that we're writing | ||
275 | // that object to the cache so that we don't try to write the | ||
276 | // same file multiple times. | ||
277 | lock (m_CurrentlyWriting) | ||
278 | { | ||
279 | #if WAIT_ON_INPROGRESS_REQUESTS | 276 | #if WAIT_ON_INPROGRESS_REQUESTS |
280 | if (m_CurrentlyWriting.ContainsKey(filename)) | 277 | if (m_CurrentlyWriting.ContainsKey(filename)) |
281 | { | 278 | { |
282 | return; | 279 | return; |
283 | } | 280 | } |
284 | else | 281 | else |
285 | { | 282 | { |
286 | m_CurrentlyWriting.Add(filename, new ManualResetEvent(false)); | 283 | m_CurrentlyWriting.Add(filename, new ManualResetEvent(false)); |
287 | } | 284 | } |
288 | 285 | ||
289 | #else | 286 | #else |
290 | if (m_CurrentlyWriting.Contains(filename)) | 287 | if (m_CurrentlyWriting.Contains(filename)) |
291 | { | 288 | { |
292 | return; | 289 | return; |
293 | } | ||
294 | else | ||
295 | { | ||
296 | m_CurrentlyWriting.Add(filename); | ||
297 | } | ||
298 | #endif | ||
299 | |||
300 | } | 290 | } |
301 | 291 | else | |
302 | Util.FireAndForget( | 292 | { |
303 | delegate { WriteFileCache(filename, asset); }); | 293 | m_CurrentlyWriting.Add(filename); |
294 | } | ||
295 | #endif | ||
304 | } | 296 | } |
305 | } | 297 | |
306 | catch (Exception e) | 298 | Util.FireAndForget( |
307 | { | 299 | delegate { WriteFileCache(filename, asset); }); |
308 | LogException(e); | ||
309 | } | 300 | } |
310 | } | 301 | } |
302 | catch (Exception e) | ||
303 | { | ||
304 | LogException(e); | ||
305 | } | ||
311 | } | 306 | } |
312 | 307 | ||
313 | public AssetBase Get(string id) | 308 | public void Cache(AssetBase asset) |
314 | { | 309 | { |
315 | m_Requests++; | 310 | // TODO: Spawn this off to some seperate thread to do the actual writing |
311 | if (asset != null) | ||
312 | { | ||
313 | //m_log.DebugFormat("[FLOTSAM ASSET CACHE]: Caching asset with id {0}", asset.ID); | ||
314 | |||
315 | if (m_MemoryCacheEnabled) | ||
316 | UpdateMemoryCache(asset.ID, asset); | ||
317 | |||
318 | if (m_FileCacheEnabled) | ||
319 | UpdateFileCache(asset.ID, asset); | ||
320 | } | ||
321 | } | ||
316 | 322 | ||
323 | /// <summary> | ||
324 | /// Try to get an asset from the in-memory cache. | ||
325 | /// </summary> | ||
326 | /// <param name="id"></param> | ||
327 | /// <returns></returns> | ||
328 | private AssetBase GetFromMemoryCache(string id) | ||
329 | { | ||
317 | AssetBase asset = null; | 330 | AssetBase asset = null; |
318 | 331 | ||
319 | if (m_MemoryCacheEnabled && m_MemoryCache.TryGetValue(id, out asset)) | 332 | if (m_MemoryCache.TryGetValue(id, out asset)) |
320 | { | ||
321 | m_MemoryHits++; | 333 | m_MemoryHits++; |
322 | } | 334 | |
323 | else | 335 | return asset; |
336 | } | ||
337 | |||
338 | /// <summary> | ||
339 | /// Try to get an asset from the file cache. | ||
340 | /// </summary> | ||
341 | /// <param name="id"></param> | ||
342 | /// <returns></returns> | ||
343 | private AssetBase GetFromFileCache(string id) | ||
344 | { | ||
345 | AssetBase asset = null; | ||
346 | |||
347 | string filename = GetFileName(id); | ||
348 | if (File.Exists(filename)) | ||
324 | { | 349 | { |
325 | string filename = GetFileName(id); | 350 | FileStream stream = null; |
326 | if (File.Exists(filename)) | 351 | try |
327 | { | 352 | { |
328 | FileStream stream = null; | 353 | stream = File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.Read); |
329 | try | 354 | BinaryFormatter bformatter = new BinaryFormatter(); |
330 | { | ||
331 | stream = File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.Read); | ||
332 | BinaryFormatter bformatter = new BinaryFormatter(); | ||
333 | 355 | ||
334 | asset = (AssetBase)bformatter.Deserialize(stream); | 356 | asset = (AssetBase)bformatter.Deserialize(stream); |
335 | 357 | ||
336 | UpdateMemoryCache(id, asset); | 358 | UpdateMemoryCache(id, asset); |
337 | 359 | ||
338 | m_DiskHits++; | 360 | m_DiskHits++; |
339 | } | 361 | } |
340 | catch (System.Runtime.Serialization.SerializationException e) | 362 | catch (System.Runtime.Serialization.SerializationException e) |
341 | { | 363 | { |
342 | LogException(e); | 364 | LogException(e); |
343 | 365 | ||
344 | // If there was a problem deserializing the asset, the asset may | 366 | // If there was a problem deserializing the asset, the asset may |
345 | // either be corrupted OR was serialized under an old format | 367 | // either be corrupted OR was serialized under an old format |
346 | // {different version of AssetBase} -- we should attempt to | 368 | // {different version of AssetBase} -- we should attempt to |
347 | // delete it and re-cache | 369 | // delete it and re-cache |
348 | File.Delete(filename); | 370 | File.Delete(filename); |
349 | } | 371 | } |
350 | catch (Exception e) | 372 | catch (Exception e) |
351 | { | 373 | { |
352 | LogException(e); | 374 | LogException(e); |
353 | } | 375 | } |
354 | finally | 376 | finally |
355 | { | 377 | { |
356 | if (stream != null) | 378 | if (stream != null) |
357 | stream.Close(); | 379 | stream.Close(); |
358 | } | ||
359 | } | 380 | } |
381 | } | ||
360 | 382 | ||
361 | 383 | ||
362 | #if WAIT_ON_INPROGRESS_REQUESTS | 384 | #if WAIT_ON_INPROGRESS_REQUESTS |
363 | // Check if we're already downloading this asset. If so, try to wait for it to | 385 | // Check if we're already downloading this asset. If so, try to wait for it to |
364 | // download. | 386 | // download. |
365 | if (m_WaitOnInprogressTimeout > 0) | 387 | if (m_WaitOnInprogressTimeout > 0) |
366 | { | 388 | { |
367 | m_RequestsForInprogress++; | 389 | m_RequestsForInprogress++; |
368 | 390 | ||
369 | ManualResetEvent waitEvent; | 391 | ManualResetEvent waitEvent; |
370 | if (m_CurrentlyWriting.TryGetValue(filename, out waitEvent)) | 392 | if (m_CurrentlyWriting.TryGetValue(filename, out waitEvent)) |
371 | { | ||
372 | waitEvent.WaitOne(m_WaitOnInprogressTimeout); | ||
373 | return Get(id); | ||
374 | } | ||
375 | } | ||
376 | #else | ||
377 | // Track how often we have the problem that an asset is requested while | ||
378 | // it is still being downloaded by a previous request. | ||
379 | if (m_CurrentlyWriting.Contains(filename)) | ||
380 | { | 393 | { |
381 | m_RequestsForInprogress++; | 394 | waitEvent.WaitOne(m_WaitOnInprogressTimeout); |
395 | return Get(id); | ||
382 | } | 396 | } |
383 | #endif | ||
384 | } | 397 | } |
398 | #else | ||
399 | // Track how often we have the problem that an asset is requested while | ||
400 | // it is still being downloaded by a previous request. | ||
401 | if (m_CurrentlyWriting.Contains(filename)) | ||
402 | { | ||
403 | m_RequestsForInprogress++; | ||
404 | } | ||
405 | #endif | ||
406 | |||
407 | return asset; | ||
408 | } | ||
409 | |||
410 | public AssetBase Get(string id) | ||
411 | { | ||
412 | m_Requests++; | ||
413 | |||
414 | AssetBase asset = null; | ||
415 | |||
416 | if (m_MemoryCacheEnabled) | ||
417 | asset = GetFromMemoryCache(id); | ||
418 | else if (m_FileCacheEnabled) | ||
419 | asset = GetFromFileCache(id); | ||
385 | 420 | ||
386 | if (((m_LogLevel >= 1)) && (m_HitRateDisplay != 0) && (m_Requests % m_HitRateDisplay == 0)) | 421 | if (((m_LogLevel >= 1)) && (m_HitRateDisplay != 0) && (m_Requests % m_HitRateDisplay == 0)) |
387 | { | 422 | { |
@@ -415,10 +450,13 @@ namespace Flotsam.RegionModules.AssetCache | |||
415 | 450 | ||
416 | try | 451 | try |
417 | { | 452 | { |
418 | string filename = GetFileName(id); | 453 | if (m_FileCacheEnabled) |
419 | if (File.Exists(filename)) | ||
420 | { | 454 | { |
421 | File.Delete(filename); | 455 | string filename = GetFileName(id); |
456 | if (File.Exists(filename)) | ||
457 | { | ||
458 | File.Delete(filename); | ||
459 | } | ||
422 | } | 460 | } |
423 | 461 | ||
424 | if (m_MemoryCacheEnabled) | 462 | if (m_MemoryCacheEnabled) |
@@ -433,11 +471,14 @@ namespace Flotsam.RegionModules.AssetCache | |||
433 | public void Clear() | 471 | public void Clear() |
434 | { | 472 | { |
435 | if (m_LogLevel >= 2) | 473 | if (m_LogLevel >= 2) |
436 | m_log.Debug("[FLOTSAM ASSET CACHE]: Clearing Cache."); | 474 | m_log.Debug("[FLOTSAM ASSET CACHE]: Clearing caches."); |
437 | 475 | ||
438 | foreach (string dir in Directory.GetDirectories(m_CacheDirectory)) | 476 | if (m_FileCacheEnabled) |
439 | { | 477 | { |
440 | Directory.Delete(dir); | 478 | foreach (string dir in Directory.GetDirectories(m_CacheDirectory)) |
479 | { | ||
480 | Directory.Delete(dir); | ||
481 | } | ||
441 | } | 482 | } |
442 | 483 | ||
443 | if (m_MemoryCacheEnabled) | 484 | if (m_MemoryCacheEnabled) |
@@ -472,9 +513,9 @@ namespace Flotsam.RegionModules.AssetCache | |||
472 | /// removes empty tier directories. | 513 | /// removes empty tier directories. |
473 | /// </summary> | 514 | /// </summary> |
474 | /// <param name="dir"></param> | 515 | /// <param name="dir"></param> |
516 | /// <param name="purgeLine"></param> | ||
475 | private void CleanExpiredFiles(string dir, DateTime purgeLine) | 517 | private void CleanExpiredFiles(string dir, DateTime purgeLine) |
476 | { | 518 | { |
477 | |||
478 | foreach (string file in Directory.GetFiles(dir)) | 519 | foreach (string file in Directory.GetFiles(dir)) |
479 | { | 520 | { |
480 | if (File.GetLastAccessTime(file) < purgeLine) | 521 | if (File.GetLastAccessTime(file) < purgeLine) |
@@ -712,18 +753,28 @@ namespace Flotsam.RegionModules.AssetCache | |||
712 | switch (cmd) | 753 | switch (cmd) |
713 | { | 754 | { |
714 | case "status": | 755 | case "status": |
715 | m_log.InfoFormat("[FLOTSAM ASSET CACHE] Memory Cache : {0} assets", m_MemoryCache.Count); | 756 | if (m_MemoryCacheEnabled) |
716 | 757 | m_log.InfoFormat("[FLOTSAM ASSET CACHE]: Memory Cache : {0} assets", m_MemoryCache.Count); | |
717 | int fileCount = GetFileCacheCount(m_CacheDirectory); | 758 | else |
718 | m_log.InfoFormat("[FLOTSAM ASSET CACHE] File Cache : {0} assets", fileCount); | 759 | m_log.InfoFormat("[FLOTSAM ASSET CACHE]: Memory cache disabled"); |
719 | 760 | ||
720 | foreach (string s in Directory.GetFiles(m_CacheDirectory, "*.fac")) | 761 | if (m_FileCacheEnabled) |
721 | { | 762 | { |
722 | m_log.Info("[FLOTSAM ASSET CACHE] Deep Scans were performed on the following regions:"); | 763 | int fileCount = GetFileCacheCount(m_CacheDirectory); |
723 | 764 | m_log.InfoFormat("[FLOTSAM ASSET CACHE]: File Cache : {0} assets", fileCount); | |
724 | string RegionID = s.Remove(0,s.IndexOf("_")).Replace(".fac",""); | 765 | |
725 | DateTime RegionDeepScanTMStamp = File.GetLastWriteTime(s); | 766 | foreach (string s in Directory.GetFiles(m_CacheDirectory, "*.fac")) |
726 | m_log.InfoFormat("[FLOTSAM ASSET CACHE] Region: {0}, {1}", RegionID, RegionDeepScanTMStamp.ToString("MM/dd/yyyy hh:mm:ss")); | 767 | { |
768 | m_log.Info("[FLOTSAM ASSET CACHE]: Deep Scans were performed on the following regions:"); | ||
769 | |||
770 | string RegionID = s.Remove(0,s.IndexOf("_")).Replace(".fac",""); | ||
771 | DateTime RegionDeepScanTMStamp = File.GetLastWriteTime(s); | ||
772 | m_log.InfoFormat("[FLOTSAM ASSET CACHE]: Region: {0}, {1}", RegionID, RegionDeepScanTMStamp.ToString("MM/dd/yyyy hh:mm:ss")); | ||
773 | } | ||
774 | } | ||
775 | else | ||
776 | { | ||
777 | m_log.InfoFormat("[FLOTSAM ASSET CACHE]: File cache disabled"); | ||
727 | } | 778 | } |
728 | 779 | ||
729 | break; | 780 | break; |
@@ -731,7 +782,7 @@ namespace Flotsam.RegionModules.AssetCache | |||
731 | case "clear": | 782 | case "clear": |
732 | if (cmdparams.Length < 2) | 783 | if (cmdparams.Length < 2) |
733 | { | 784 | { |
734 | m_log.Warn("[FLOTSAM ASSET CACHE] Usage is fcache clear [file] [memory]"); | 785 | m_log.Warn("[FLOTSAM ASSET CACHE]: Usage is fcache clear [file] [memory]"); |
735 | break; | 786 | break; |
736 | } | 787 | } |
737 | 788 | ||
@@ -752,36 +803,48 @@ namespace Flotsam.RegionModules.AssetCache | |||
752 | 803 | ||
753 | if (clearMemory) | 804 | if (clearMemory) |
754 | { | 805 | { |
755 | m_MemoryCache.Clear(); | 806 | if (m_MemoryCacheEnabled) |
756 | m_log.Info("[FLOTSAM ASSET CACHE] Memory cache cleared."); | 807 | { |
808 | m_MemoryCache.Clear(); | ||
809 | m_log.Info("[FLOTSAM ASSET CACHE]: Memory cache cleared."); | ||
810 | } | ||
811 | else | ||
812 | { | ||
813 | m_log.Info("[FLOTSAM ASSET CACHE]: Memory cache not enabled."); | ||
814 | } | ||
757 | } | 815 | } |
758 | 816 | ||
759 | if (clearFile) | 817 | if (clearFile) |
760 | { | 818 | { |
761 | ClearFileCache(); | 819 | if (m_FileCacheEnabled) |
762 | m_log.Info("[FLOTSAM ASSET CACHE] File cache cleared."); | 820 | { |
821 | ClearFileCache(); | ||
822 | m_log.Info("[FLOTSAM ASSET CACHE]: File cache cleared."); | ||
823 | } | ||
824 | else | ||
825 | { | ||
826 | m_log.Info("[FLOTSAM ASSET CACHE]: File cache not enabled."); | ||
827 | } | ||
763 | } | 828 | } |
764 | 829 | ||
765 | break; | 830 | break; |
766 | 831 | ||
767 | 832 | ||
768 | case "assets": | 833 | case "assets": |
769 | m_log.Info("[FLOTSAM ASSET CACHE] Caching all assets, in all scenes."); | 834 | m_log.Info("[FLOTSAM ASSET CACHE]: Caching all assets, in all scenes."); |
770 | 835 | ||
771 | Util.FireAndForget(delegate { | 836 | Util.FireAndForget(delegate { |
772 | int assetsCached = CacheScenes(); | 837 | int assetsCached = CacheScenes(); |
773 | m_log.InfoFormat("[FLOTSAM ASSET CACHE] Completed Scene Caching, {0} assets found.", assetsCached); | 838 | m_log.InfoFormat("[FLOTSAM ASSET CACHE]: Completed Scene Caching, {0} assets found.", assetsCached); |
774 | 839 | ||
775 | }); | 840 | }); |
776 | 841 | ||
777 | break; | 842 | break; |
778 | 843 | ||
779 | case "expire": | 844 | case "expire": |
780 | |||
781 | |||
782 | if (cmdparams.Length < 3) | 845 | if (cmdparams.Length < 3) |
783 | { | 846 | { |
784 | m_log.InfoFormat("[FLOTSAM ASSET CACHE] Invalid parameters for Expire, please specify a valid date & time", cmd); | 847 | m_log.InfoFormat("[FLOTSAM ASSET CACHE]: Invalid parameters for Expire, please specify a valid date & time", cmd); |
785 | break; | 848 | break; |
786 | } | 849 | } |
787 | 850 | ||
@@ -799,26 +862,28 @@ namespace Flotsam.RegionModules.AssetCache | |||
799 | 862 | ||
800 | if (!DateTime.TryParse(s_expirationDate, out expirationDate)) | 863 | if (!DateTime.TryParse(s_expirationDate, out expirationDate)) |
801 | { | 864 | { |
802 | m_log.InfoFormat("[FLOTSAM ASSET CACHE] {0} is not a valid date & time", cmd); | 865 | m_log.InfoFormat("[FLOTSAM ASSET CACHE]: {0} is not a valid date & time", cmd); |
803 | break; | 866 | break; |
804 | } | 867 | } |
805 | 868 | ||
806 | CleanExpiredFiles(m_CacheDirectory, expirationDate); | 869 | if (m_FileCacheEnabled) |
870 | CleanExpiredFiles(m_CacheDirectory, expirationDate); | ||
871 | else | ||
872 | m_log.InfoFormat("[FLOTSAM ASSET CACHE]: File cache not active, not clearing."); | ||
807 | 873 | ||
808 | break; | 874 | break; |
809 | default: | 875 | default: |
810 | m_log.InfoFormat("[FLOTSAM ASSET CACHE] Unknown command {0}", cmd); | 876 | m_log.InfoFormat("[FLOTSAM ASSET CACHE]: Unknown command {0}", cmd); |
811 | break; | 877 | break; |
812 | } | 878 | } |
813 | } | 879 | } |
814 | else if (cmdparams.Length == 1) | 880 | else if (cmdparams.Length == 1) |
815 | { | 881 | { |
816 | m_log.InfoFormat("[FLOTSAM ASSET CACHE] flotsamcache status - Display cache status"); | 882 | m_log.InfoFormat("[FLOTSAM ASSET CACHE]: fcache status - Display cache status"); |
817 | m_log.InfoFormat("[FLOTSAM ASSET CACHE] flotsamcache clearmem - Remove all assets cached in memory"); | 883 | m_log.InfoFormat("[FLOTSAM ASSET CACHE]: fcache clearmem - Remove all assets cached in memory"); |
818 | m_log.InfoFormat("[FLOTSAM ASSET CACHE] flotsamcache clearfile - Remove all assets cached on disk"); | 884 | m_log.InfoFormat("[FLOTSAM ASSET CACHE]: fcache clearfile - Remove all assets cached on disk"); |
819 | m_log.InfoFormat("[FLOTSAM ASSET CACHE] flotsamcache cachescenes - Attempt a deep cache of all assets in all scenes"); | 885 | m_log.InfoFormat("[FLOTSAM ASSET CACHE]: fcache cachescenes - Attempt a deep cache of all assets in all scenes"); |
820 | m_log.InfoFormat("[FLOTSAM ASSET CACHE] flotsamcache <datetime> - Purge assets older then the specified date & time"); | 886 | m_log.InfoFormat("[FLOTSAM ASSET CACHE]: fcache <datetime> - Purge assets older then the specified date & time"); |
821 | |||
822 | } | 887 | } |
823 | } | 888 | } |
824 | 889 | ||
diff --git a/OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs b/OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs new file mode 100644 index 0000000..63b0c31 --- /dev/null +++ b/OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs | |||
@@ -0,0 +1,127 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.IO; | ||
31 | using System.Reflection; | ||
32 | using System.Threading; | ||
33 | using log4net.Config; | ||
34 | using Nini.Config; | ||
35 | using NUnit.Framework; | ||
36 | using OpenMetaverse; | ||
37 | using OpenMetaverse.Assets; | ||
38 | using Flotsam.RegionModules.AssetCache; | ||
39 | using OpenSim.Framework; | ||
40 | using OpenSim.Region.Framework.Scenes; | ||
41 | using OpenSim.Region.Framework.Scenes.Serialization; | ||
42 | using OpenSim.Tests.Common; | ||
43 | using OpenSim.Tests.Common.Mock; | ||
44 | |||
45 | namespace OpenSim.Region.CoreModules.Asset.Tests | ||
46 | { | ||
47 | /// <summary> | ||
48 | /// At the moment we're only test the in-memory part of the FlotsamAssetCache. This is a considerable weakness. | ||
49 | /// </summary> | ||
50 | [TestFixture] | ||
51 | public class FlotsamAssetCacheTests | ||
52 | { | ||
53 | protected TestScene m_scene; | ||
54 | protected FlotsamAssetCache m_cache; | ||
55 | |||
56 | [SetUp] | ||
57 | public void SetUp() | ||
58 | { | ||
59 | IConfigSource config = new IniConfigSource(); | ||
60 | |||
61 | config.AddConfig("Modules"); | ||
62 | config.Configs["Modules"].Set("AssetCaching", "FlotsamAssetCache"); | ||
63 | config.AddConfig("AssetCache"); | ||
64 | config.Configs["AssetCache"].Set("FileCacheEnabled", "false"); | ||
65 | config.Configs["AssetCache"].Set("MemoryCacheEnabled", "true"); | ||
66 | |||
67 | m_cache = new FlotsamAssetCache(); | ||
68 | m_scene = SceneSetupHelpers.SetupScene(); | ||
69 | SceneSetupHelpers.SetupSceneModules(m_scene, config, m_cache); | ||
70 | } | ||
71 | |||
72 | [Test] | ||
73 | public void TestCacheAsset() | ||
74 | { | ||
75 | TestHelper.InMethod(); | ||
76 | // log4net.Config.XmlConfigurator.Configure(); | ||
77 | |||
78 | AssetBase asset = AssetHelpers.CreateAsset(); | ||
79 | asset.ID = TestHelper.ParseTail(0x1).ToString(); | ||
80 | |||
81 | // Check we don't get anything before the asset is put in the cache | ||
82 | AssetBase retrievedAsset = m_cache.Get(asset.ID.ToString()); | ||
83 | Assert.That(retrievedAsset, Is.Null); | ||
84 | |||
85 | m_cache.Store(asset); | ||
86 | |||
87 | // Check that asset is now in cache | ||
88 | retrievedAsset = m_cache.Get(asset.ID.ToString()); | ||
89 | Assert.That(retrievedAsset, Is.Not.Null); | ||
90 | Assert.That(retrievedAsset.ID, Is.EqualTo(asset.ID)); | ||
91 | } | ||
92 | |||
93 | [Test] | ||
94 | public void TestExpireAsset() | ||
95 | { | ||
96 | TestHelper.InMethod(); | ||
97 | // log4net.Config.XmlConfigurator.Configure(); | ||
98 | |||
99 | AssetBase asset = AssetHelpers.CreateAsset(); | ||
100 | asset.ID = TestHelper.ParseTail(0x2).ToString(); | ||
101 | |||
102 | m_cache.Store(asset); | ||
103 | |||
104 | m_cache.Expire(asset.ID); | ||
105 | |||
106 | AssetBase retrievedAsset = m_cache.Get(asset.ID.ToString()); | ||
107 | Assert.That(retrievedAsset, Is.Null); | ||
108 | } | ||
109 | |||
110 | [Test] | ||
111 | public void TestClearCache() | ||
112 | { | ||
113 | TestHelper.InMethod(); | ||
114 | // log4net.Config.XmlConfigurator.Configure(); | ||
115 | |||
116 | AssetBase asset = AssetHelpers.CreateAsset(); | ||
117 | asset.ID = TestHelper.ParseTail(0x2).ToString(); | ||
118 | |||
119 | m_cache.Store(asset); | ||
120 | |||
121 | m_cache.Clear(); | ||
122 | |||
123 | AssetBase retrievedAsset = m_cache.Get(asset.ID.ToString()); | ||
124 | Assert.That(retrievedAsset, Is.Null); | ||
125 | } | ||
126 | } | ||
127 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index e92f072..1955e5b 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | |||
@@ -116,16 +116,20 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
116 | #endregion | 116 | #endregion |
117 | 117 | ||
118 | /// <summary> | 118 | /// <summary> |
119 | /// Check for the existence of the baked texture assets. Request a rebake | 119 | /// Check for the existence of the baked texture assets. |
120 | /// unless checkonly is true. | ||
121 | /// </summary> | 120 | /// </summary> |
122 | /// <param name="client"></param> | 121 | /// <param name="client"></param> |
123 | /// <param name="checkonly"></param> | ||
124 | public bool ValidateBakedTextureCache(IClientAPI client) | 122 | public bool ValidateBakedTextureCache(IClientAPI client) |
125 | { | 123 | { |
126 | return ValidateBakedTextureCache(client, true); | 124 | return ValidateBakedTextureCache(client, true); |
127 | } | 125 | } |
128 | 126 | ||
127 | /// <summary> | ||
128 | /// Check for the existence of the baked texture assets. Request a rebake | ||
129 | /// unless checkonly is true. | ||
130 | /// </summary> | ||
131 | /// <param name="client"></param> | ||
132 | /// <param name="checkonly"></param> | ||
129 | private bool ValidateBakedTextureCache(IClientAPI client, bool checkonly) | 133 | private bool ValidateBakedTextureCache(IClientAPI client, bool checkonly) |
130 | { | 134 | { |
131 | ScenePresence sp = m_scene.GetScenePresence(client.AgentId); | 135 | ScenePresence sp = m_scene.GetScenePresence(client.AgentId); |
@@ -156,18 +160,20 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
156 | 160 | ||
157 | defonly = false; // found a non-default texture reference | 161 | defonly = false; // found a non-default texture reference |
158 | 162 | ||
159 | if (! CheckBakedTextureAsset(client,face.TextureID,idx)) | 163 | if (!CheckBakedTextureAsset(client, face.TextureID, idx)) |
160 | { | 164 | { |
161 | // the asset didn't exist if we are only checking, then we found a bad | 165 | // the asset didn't exist if we are only checking, then we found a bad |
162 | // one and we're done otherwise, ask for a rebake | 166 | // one and we're done otherwise, ask for a rebake |
163 | if (checkonly) return false; | 167 | if (checkonly) |
168 | return false; | ||
164 | 169 | ||
165 | m_log.InfoFormat("[AVFACTORY]: missing baked texture {0}, requesting rebake",face.TextureID); | 170 | m_log.InfoFormat("[AVFACTORY]: missing baked texture {0}, requesting rebake", face.TextureID); |
171 | |||
166 | client.SendRebakeAvatarTextures(face.TextureID); | 172 | client.SendRebakeAvatarTextures(face.TextureID); |
167 | } | 173 | } |
168 | } | 174 | } |
169 | 175 | ||
170 | m_log.DebugFormat("[AVFACTORY]: completed texture check for {0}", client.AgentId); | 176 | m_log.DebugFormat("[AVFACTORY]: Completed texture check for {0}", client.AgentId); |
171 | 177 | ||
172 | // If we only found default textures, then the appearance is not cached | 178 | // If we only found default textures, then the appearance is not cached |
173 | return (defonly ? false : true); | 179 | return (defonly ? false : true); |
@@ -183,7 +189,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
183 | ScenePresence sp = m_scene.GetScenePresence(client.AgentId); | 189 | ScenePresence sp = m_scene.GetScenePresence(client.AgentId); |
184 | if (sp == null) | 190 | if (sp == null) |
185 | { | 191 | { |
186 | m_log.WarnFormat("[AVFACTORY]: SetAppearance unable to find presence for {0}",client.AgentId); | 192 | m_log.WarnFormat("[AVFACTORY]: SetAppearance unable to find presence for {0}", client.AgentId); |
187 | return; | 193 | return; |
188 | } | 194 | } |
189 | 195 | ||
@@ -211,7 +217,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
211 | changed = sp.Appearance.SetTextureEntries(textureEntry) || changed; | 217 | changed = sp.Appearance.SetTextureEntries(textureEntry) || changed; |
212 | 218 | ||
213 | m_log.InfoFormat("[AVFACTORY]: received texture update for {0}", client.AgentId); | 219 | m_log.InfoFormat("[AVFACTORY]: received texture update for {0}", client.AgentId); |
214 | Util.FireAndForget(delegate(object o) { ValidateBakedTextureCache(client,false); }); | 220 | Util.FireAndForget(delegate(object o) { ValidateBakedTextureCache(client, false); }); |
215 | 221 | ||
216 | // This appears to be set only in the final stage of the appearance | 222 | // This appears to be set only in the final stage of the appearance |
217 | // update transaction. In theory, we should be able to do an immediate | 223 | // update transaction. In theory, we should be able to do an immediate |
@@ -220,9 +226,9 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
220 | // save only if there were changes, send no matter what (doesn't hurt to send twice) | 226 | // save only if there were changes, send no matter what (doesn't hurt to send twice) |
221 | if (changed) | 227 | if (changed) |
222 | QueueAppearanceSave(client.AgentId); | 228 | QueueAppearanceSave(client.AgentId); |
229 | |||
223 | QueueAppearanceSend(client.AgentId); | 230 | QueueAppearanceSend(client.AgentId); |
224 | } | 231 | } |
225 | |||
226 | } | 232 | } |
227 | 233 | ||
228 | // m_log.WarnFormat("[AVFACTORY]: complete SetAppearance for {0}:\n{1}",client.AgentId,sp.Appearance.ToString()); | 234 | // m_log.WarnFormat("[AVFACTORY]: complete SetAppearance for {0}:\n{1}",client.AgentId,sp.Appearance.ToString()); |
diff --git a/OpenSim/Region/CoreModules/Avatar/NPC/INPCModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs index cd2fe4f..07de908 100644 --- a/OpenSim/Region/CoreModules/Avatar/NPC/INPCModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs | |||
@@ -25,16 +25,45 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | ||
29 | using NUnit.Framework; | ||
28 | using OpenMetaverse; | 30 | using OpenMetaverse; |
31 | using OpenSim.Framework; | ||
29 | using OpenSim.Region.Framework.Scenes; | 32 | using OpenSim.Region.Framework.Scenes; |
33 | using OpenSim.Tests.Common; | ||
34 | using OpenSim.Tests.Common.Mock; | ||
30 | 35 | ||
31 | namespace OpenSim.Region.CoreModules.Avatar.NPC | 36 | namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory |
32 | { | 37 | { |
33 | public interface INPCModule | 38 | [TestFixture] |
39 | public class AvatarFactoryModuleTests | ||
34 | { | 40 | { |
35 | UUID CreateNPC(string firstname, string lastname, Vector3 position, Scene scene, UUID cloneAppearanceFrom); | 41 | /// <summary> |
36 | void Autopilot(UUID agentID, Scene scene, Vector3 pos); | 42 | /// Only partial right now since we don't yet test that it's ended up in the avatar appearance service. |
37 | void Say(UUID agentID, Scene scene, string text); | 43 | /// </summary> |
38 | void DeleteNPC(UUID agentID, Scene scene); | 44 | [Test] |
45 | public void TestSetAppearance() | ||
46 | { | ||
47 | TestHelper.InMethod(); | ||
48 | // log4net.Config.XmlConfigurator.Configure(); | ||
49 | |||
50 | UUID userId = TestHelper.ParseTail(0x1); | ||
51 | |||
52 | AvatarFactoryModule afm = new AvatarFactoryModule(); | ||
53 | TestScene scene = SceneSetupHelpers.SetupScene(); | ||
54 | SceneSetupHelpers.SetupSceneModules(scene, afm); | ||
55 | TestClient tc = SceneSetupHelpers.AddClient(scene, userId); | ||
56 | |||
57 | byte[] visualParams = new byte[AvatarAppearance.VISUALPARAM_COUNT]; | ||
58 | for (byte i = 0; i < visualParams.Length; i++) | ||
59 | visualParams[i] = i; | ||
60 | |||
61 | afm.SetAppearance(tc, new Primitive.TextureEntry(TestHelper.ParseTail(0x10)), visualParams); | ||
62 | |||
63 | ScenePresence sp = scene.GetScenePresence(userId); | ||
64 | |||
65 | // TODO: Check baked texture | ||
66 | Assert.AreEqual(visualParams, sp.Appearance.VisualParams); | ||
67 | } | ||
39 | } | 68 | } |
40 | } \ No newline at end of file | 69 | } \ No newline at end of file |
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index daee4ca..3a7178c 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs | |||
@@ -830,7 +830,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
830 | 830 | ||
831 | public bool LocalStatusNotification(UUID userID, UUID friendID, bool online) | 831 | public bool LocalStatusNotification(UUID userID, UUID friendID, bool online) |
832 | { | 832 | { |
833 | m_log.DebugFormat("[FRIENDS]: Local Status Notify {0} that user {1} is {2}", friendID, userID, online); | 833 | // m_log.DebugFormat("[FRIENDS]: Local Status Notify {0} that user {1} is {2}", friendID, userID, online); |
834 | IClientAPI friendClient = LocateClientObject(friendID); | 834 | IClientAPI friendClient = LocateClientObject(friendID); |
835 | if (friendClient != null) | 835 | if (friendClient != null) |
836 | { | 836 | { |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 1341533..457ee33 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -50,6 +50,17 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
50 | { | 50 | { |
51 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 51 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
52 | 52 | ||
53 | /// <summary> | ||
54 | /// The maximum distance, in standard region units (256m) that an agent is allowed to transfer. | ||
55 | /// </summary> | ||
56 | private int m_MaxTransferDistance = 4095; | ||
57 | public int MaxTransferDistance | ||
58 | { | ||
59 | get { return m_MaxTransferDistance; } | ||
60 | set { m_MaxTransferDistance = value; } | ||
61 | } | ||
62 | |||
63 | |||
53 | protected bool m_Enabled = false; | 64 | protected bool m_Enabled = false; |
54 | protected Scene m_aScene; | 65 | protected Scene m_aScene; |
55 | protected List<Scene> m_Scenes = new List<Scene>(); | 66 | protected List<Scene> m_Scenes = new List<Scene>(); |
@@ -78,13 +89,26 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
78 | string name = moduleConfig.GetString("EntityTransferModule", ""); | 89 | string name = moduleConfig.GetString("EntityTransferModule", ""); |
79 | if (name == Name) | 90 | if (name == Name) |
80 | { | 91 | { |
81 | m_agentsInTransit = new List<UUID>(); | 92 | InitialiseCommon(source); |
82 | m_Enabled = true; | 93 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: {0} enabled.", Name); |
83 | m_log.InfoFormat("[ENTITY TRANSFER MODULE]: {0} enabled.", Name); | ||
84 | } | 94 | } |
85 | } | 95 | } |
86 | } | 96 | } |
87 | 97 | ||
98 | /// <summary> | ||
99 | /// Initialize config common for this module and any descendents. | ||
100 | /// </summary> | ||
101 | /// <param name="source"></param> | ||
102 | protected virtual void InitialiseCommon(IConfigSource source) | ||
103 | { | ||
104 | IConfig transferConfig = source.Configs["EntityTransfer"]; | ||
105 | if (transferConfig != null) | ||
106 | MaxTransferDistance = transferConfig.GetInt("max_distance", 4095); | ||
107 | |||
108 | m_agentsInTransit = new List<UUID>(); | ||
109 | m_Enabled = true; | ||
110 | } | ||
111 | |||
88 | public virtual void PostInitialise() | 112 | public virtual void PostInitialise() |
89 | { | 113 | { |
90 | } | 114 | } |
@@ -114,7 +138,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
114 | return; | 138 | return; |
115 | } | 139 | } |
116 | 140 | ||
117 | |||
118 | public virtual void RemoveRegion(Scene scene) | 141 | public virtual void RemoveRegion(Scene scene) |
119 | { | 142 | { |
120 | if (!m_Enabled) | 143 | if (!m_Enabled) |
@@ -129,7 +152,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
129 | { | 152 | { |
130 | if (!m_Enabled) | 153 | if (!m_Enabled) |
131 | return; | 154 | return; |
132 | |||
133 | } | 155 | } |
134 | 156 | ||
135 | #endregion | 157 | #endregion |
@@ -204,8 +226,18 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
204 | sp.ControllingClient.SendTeleportFailed("Problem at destination"); | 226 | sp.ControllingClient.SendTeleportFailed("Problem at destination"); |
205 | return; | 227 | return; |
206 | } | 228 | } |
207 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Final destination is x={0} y={1} {2}@{3}", | 229 | |
208 | finalDestination.RegionLocX / Constants.RegionSize, finalDestination.RegionLocY / Constants.RegionSize, finalDestination.RegionID, finalDestination.ServerURI); | 230 | uint curX = 0, curY = 0; |
231 | Utils.LongToUInts(sp.Scene.RegionInfo.RegionHandle, out curX, out curY); | ||
232 | int curCellX = (int)(curX / Constants.RegionSize); | ||
233 | int curCellY = (int)(curY / Constants.RegionSize); | ||
234 | int destCellX = (int)(finalDestination.RegionLocX / Constants.RegionSize); | ||
235 | int destCellY = (int)(finalDestination.RegionLocY / Constants.RegionSize); | ||
236 | |||
237 | // m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Source co-ords are x={0} y={1}", curRegionX, curRegionY); | ||
238 | // | ||
239 | // m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Final dest is x={0} y={1} {2}@{3}", | ||
240 | // destRegionX, destRegionY, finalDestination.RegionID, finalDestination.ServerURI); | ||
209 | 241 | ||
210 | // Check that these are not the same coordinates | 242 | // Check that these are not the same coordinates |
211 | if (finalDestination.RegionLocX == sp.Scene.RegionInfo.RegionLocX && | 243 | if (finalDestination.RegionLocX == sp.Scene.RegionInfo.RegionLocX && |
@@ -216,6 +248,18 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
216 | return; | 248 | return; |
217 | } | 249 | } |
218 | 250 | ||
251 | if (Math.Abs(curCellX - destCellX) > MaxTransferDistance || Math.Abs(curCellY - destCellY) > MaxTransferDistance) | ||
252 | { | ||
253 | sp.ControllingClient.SendTeleportFailed( | ||
254 | string.Format( | ||
255 | "Can't teleport to {0} ({1},{2}) from {3} ({4},{5}), destination is more than {6} regions way", | ||
256 | finalDestination.RegionName, destCellX, destCellY, | ||
257 | sp.Scene.RegionInfo.RegionName, curCellX, curCellY, | ||
258 | MaxTransferDistance)); | ||
259 | |||
260 | return; | ||
261 | } | ||
262 | |||
219 | // | 263 | // |
220 | // This is it | 264 | // This is it |
221 | // | 265 | // |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index 4d77ef4..a87279a 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | |||
@@ -67,10 +67,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
67 | string name = moduleConfig.GetString("EntityTransferModule", ""); | 67 | string name = moduleConfig.GetString("EntityTransferModule", ""); |
68 | if (name == Name) | 68 | if (name == Name) |
69 | { | 69 | { |
70 | m_agentsInTransit = new List<UUID>(); | 70 | InitialiseCommon(source); |
71 | 71 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: {0} enabled.", Name); | |
72 | m_Enabled = true; | ||
73 | m_log.InfoFormat("[HG ENTITY TRANSFER MODULE]: {0} enabled.", Name); | ||
74 | } | 72 | } |
75 | } | 73 | } |
76 | } | 74 | } |
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 2930303..66fbcb9 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | |||
@@ -978,7 +978,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
978 | { | 978 | { |
979 | } | 979 | } |
980 | 980 | ||
981 | public virtual bool GetAgentInventoryItem(IClientAPI remoteClient, UUID itemID, UUID requestID) | 981 | public virtual bool CanGetAgentInventoryItem(IClientAPI remoteClient, UUID itemID, UUID requestID) |
982 | { | 982 | { |
983 | InventoryItemBase assetRequestItem = GetItem(remoteClient.AgentId, itemID); | 983 | InventoryItemBase assetRequestItem = GetItem(remoteClient.AgentId, itemID); |
984 | if (assetRequestItem == null) | 984 | if (assetRequestItem == null) |
@@ -1057,7 +1057,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
1057 | InventoryItemBase item = new InventoryItemBase(itemID, agentID); | 1057 | InventoryItemBase item = new InventoryItemBase(itemID, agentID); |
1058 | item = invService.GetItem(item); | 1058 | item = invService.GetItem(item); |
1059 | 1059 | ||
1060 | if (item.CreatorData != null && item.CreatorData != string.Empty) | 1060 | if (item != null && item.CreatorData != null && item.CreatorData != string.Empty) |
1061 | UserManagementModule.AddUser(item.CreatorIdAsUuid, item.CreatorData); | 1061 | UserManagementModule.AddUser(item.CreatorIdAsUuid, item.CreatorData); |
1062 | 1062 | ||
1063 | return item; | 1063 | return item; |
@@ -1065,4 +1065,4 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
1065 | 1065 | ||
1066 | #endregion | 1066 | #endregion |
1067 | } | 1067 | } |
1068 | } | 1068 | } \ No newline at end of file |
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs index accd094..a4861ec 100644 --- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs +++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs | |||
@@ -297,9 +297,10 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
297 | if (m_UserCache.ContainsKey(id)) | 297 | if (m_UserCache.ContainsKey(id)) |
298 | return; | 298 | return; |
299 | 299 | ||
300 | // m_log.DebugFormat("[USER MANAGEMENT MODULE]: Adding user with id {0}, craetorData {1}", id, creatorData); | ||
301 | |||
300 | UserData user = new UserData(); | 302 | UserData user = new UserData(); |
301 | user.Id = id; | 303 | user.Id = id; |
302 | |||
303 | UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, id); | 304 | UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, id); |
304 | 305 | ||
305 | if (account != null) | 306 | if (account != null) |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs index 6dd871f..0c57618 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs | |||
@@ -284,9 +284,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
284 | 284 | ||
285 | item = m_InventoryService.GetItem(item); | 285 | item = m_InventoryService.GetItem(item); |
286 | 286 | ||
287 | if (null == item) | 287 | // if (null == item) |
288 | m_log.ErrorFormat( | 288 | // m_log.ErrorFormat( |
289 | "[LOCAL INVENTORY SERVICES CONNECTOR]: Could not find item with id {0}", requestedItemId); | 289 | // "[LOCAL INVENTORY SERVICES CONNECTOR]: Could not find item with id {0}", requestedItemId); |
290 | 290 | ||
291 | return item; | 291 | return item; |
292 | } | 292 | } |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index 560b862..8c40171 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs | |||
@@ -418,7 +418,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
418 | 418 | ||
419 | public bool IsBannedFromLand(UUID avatar) | 419 | public bool IsBannedFromLand(UUID avatar) |
420 | { | 420 | { |
421 | if (m_scene.Permissions.IsAdministrator(avatar)) | 421 | if (m_scene.Permissions.CanEditParcelProperties(avatar, this, 0)) |
422 | return false; | 422 | return false; |
423 | 423 | ||
424 | if ((LandData.Flags & (uint) ParcelFlags.UseBanList) > 0) | 424 | if ((LandData.Flags & (uint) ParcelFlags.UseBanList) > 0) |
@@ -429,7 +429,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
429 | if (e.AgentID == avatar && e.Flags == AccessList.Ban) | 429 | if (e.AgentID == avatar && e.Flags == AccessList.Ban) |
430 | return true; | 430 | return true; |
431 | return false; | 431 | return false; |
432 | }) != -1 && LandData.OwnerID != avatar) | 432 | }) != -1) |
433 | { | 433 | { |
434 | return true; | 434 | return true; |
435 | } | 435 | } |
@@ -439,7 +439,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
439 | 439 | ||
440 | public bool IsRestrictedFromLand(UUID avatar) | 440 | public bool IsRestrictedFromLand(UUID avatar) |
441 | { | 441 | { |
442 | if (m_scene.Permissions.IsAdministrator(avatar)) | 442 | if (m_scene.Permissions.CanEditParcelProperties(avatar, this, 0)) |
443 | return false; | 443 | return false; |
444 | 444 | ||
445 | if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) > 0) | 445 | if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) > 0) |
@@ -450,7 +450,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
450 | if (e.AgentID == avatar && e.Flags == AccessList.Access) | 450 | if (e.AgentID == avatar && e.Flags == AccessList.Access) |
451 | return true; | 451 | return true; |
452 | return false; | 452 | return false; |
453 | }) == -1 && LandData.OwnerID != avatar) | 453 | }) == -1) |
454 | { | 454 | { |
455 | return true; | 455 | return true; |
456 | } | 456 | } |
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index d7324c6..a40517c 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs | |||
@@ -134,7 +134,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
134 | return; | 134 | return; |
135 | 135 | ||
136 | m_allowGridGods = myConfig.GetBoolean("allow_grid_gods", false); | 136 | m_allowGridGods = myConfig.GetBoolean("allow_grid_gods", false); |
137 | m_bypassPermissions = !myConfig.GetBoolean("serverside_object_permissions", false); | 137 | m_bypassPermissions = !myConfig.GetBoolean("serverside_object_permissions", true); |
138 | m_propagatePermissions = myConfig.GetBoolean("propagate_permissions", true); | 138 | m_propagatePermissions = myConfig.GetBoolean("propagate_permissions", true); |
139 | m_RegionOwnerIsGod = myConfig.GetBoolean("region_owner_is_god", true); | 139 | m_RegionOwnerIsGod = myConfig.GetBoolean("region_owner_is_god", true); |
140 | m_RegionManagerIsGod = myConfig.GetBoolean("region_manager_is_god", false); | 140 | m_RegionManagerIsGod = myConfig.GetBoolean("region_manager_is_god", false); |
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs index 00959b0..2e3b21f 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs | |||
@@ -91,6 +91,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
91 | remoteClient.SendAlertMessage("Use a search string with at least 3 characters"); | 91 | remoteClient.SendAlertMessage("Use a search string with at least 3 characters"); |
92 | return; | 92 | return; |
93 | } | 93 | } |
94 | |||
95 | m_log.DebugFormat("MAP NAME=({0})", mapName); | ||
94 | 96 | ||
95 | // try to fetch from GridServer | 97 | // try to fetch from GridServer |
96 | List<GridRegion> regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20); | 98 | List<GridRegion> regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20); |
@@ -103,7 +105,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
103 | if (info != null) | 105 | if (info != null) |
104 | regionInfos.Add(info); | 106 | regionInfos.Add(info); |
105 | } | 107 | } |
106 | else if (regionInfos.Count == 0 && mapName.StartsWith("http://")) | 108 | else if (regionInfos.Count == 0) |
107 | remoteClient.SendAlertMessage("Hyperlink could not be established."); | 109 | remoteClient.SendAlertMessage("Hyperlink could not be established."); |
108 | 110 | ||
109 | m_log.DebugFormat("[MAPSEARCHMODULE]: search {0} returned {1} regions. Flags={2}", mapName, regionInfos.Count, flags); | 111 | m_log.DebugFormat("[MAPSEARCHMODULE]: search {0} returned {1} regions. Flags={2}", mapName, regionInfos.Count, flags); |