aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Communications/Cache
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Communications/Cache')
-rw-r--r--OpenSim/Framework/Communications/Cache/AssetCache.cs46
-rw-r--r--OpenSim/Framework/Communications/Cache/CryptoGridAssetClient.cs18
-rw-r--r--OpenSim/Framework/Communications/Cache/FileAssetClient.cs4
-rw-r--r--OpenSim/Framework/Communications/Cache/GridAssetClient.cs2
4 files changed, 35 insertions, 35 deletions
diff --git a/OpenSim/Framework/Communications/Cache/AssetCache.cs b/OpenSim/Framework/Communications/Cache/AssetCache.cs
index 76c6045..0e1f948 100644
--- a/OpenSim/Framework/Communications/Cache/AssetCache.cs
+++ b/OpenSim/Framework/Communications/Cache/AssetCache.cs
@@ -341,11 +341,11 @@ namespace OpenSim.Framework.Communications.Cache
341 /// <param name="asset"></param> 341 /// <param name="asset"></param>
342 public void AddAsset(AssetBase asset) 342 public void AddAsset(AssetBase asset)
343 { 343 {
344 if (!m_memcache.Contains(asset.Metadata.FullID)) 344 if (!m_memcache.Contains(asset.FullID))
345 { 345 {
346 m_log.Info("[CACHE] Caching " + asset.Metadata.FullID + " for 24 hours from last access"); 346 m_log.Info("[CACHE] Caching " + asset.FullID + " for 24 hours from last access");
347 // Use 24 hour rolling asset cache. 347 // Use 24 hour rolling asset cache.
348 m_memcache.AddOrUpdate(asset.Metadata.FullID, asset, TimeSpan.FromHours(24)); 348 m_memcache.AddOrUpdate(asset.FullID, asset, TimeSpan.FromHours(24));
349 349
350 // According to http://wiki.secondlife.com/wiki/AssetUploadRequest, Local signifies that the 350 // According to http://wiki.secondlife.com/wiki/AssetUploadRequest, Local signifies that the
351 // information is stored locally. It could disappear, in which case we could send the 351 // information is stored locally. It could disappear, in which case we could send the
@@ -365,7 +365,7 @@ namespace OpenSim.Framework.Communications.Cache
365 // But for now, we're going to take the easy way out and store local assets globally. 365 // But for now, we're going to take the easy way out and store local assets globally.
366 // 366 //
367 // TODO: Also, Temporary is now deprecated. We should start ignoring it and not passing it out from LLClientView. 367 // TODO: Also, Temporary is now deprecated. We should start ignoring it and not passing it out from LLClientView.
368 if (!asset.Metadata.Temporary || asset.Metadata.Local) 368 if (!asset.Temporary || asset.Local)
369 { 369 {
370 m_assetServer.StoreAsset(asset); 370 m_assetServer.StoreAsset(asset);
371 } 371 }
@@ -396,25 +396,25 @@ namespace OpenSim.Framework.Communications.Cache
396 { 396 {
397 397
398 AssetInfo assetInf = new AssetInfo(asset); 398 AssetInfo assetInf = new AssetInfo(asset);
399 if (!m_memcache.Contains(assetInf.Metadata.FullID)) 399 if (!m_memcache.Contains(assetInf.FullID))
400 { 400 {
401 m_memcache.AddOrUpdate(assetInf.Metadata.FullID, assetInf, TimeSpan.FromHours(24)); 401 m_memcache.AddOrUpdate(assetInf.FullID, assetInf, TimeSpan.FromHours(24));
402 402
403 if (StatsManager.SimExtraStats != null) 403 if (StatsManager.SimExtraStats != null)
404 { 404 {
405 StatsManager.SimExtraStats.AddAsset(assetInf); 405 StatsManager.SimExtraStats.AddAsset(assetInf);
406 } 406 }
407 407
408 if (RequestedAssets.ContainsKey(assetInf.Metadata.FullID)) 408 if (RequestedAssets.ContainsKey(assetInf.FullID))
409 { 409 {
410 AssetRequest req = RequestedAssets[assetInf.Metadata.FullID]; 410 AssetRequest req = RequestedAssets[assetInf.FullID];
411 req.AssetInf = assetInf; 411 req.AssetInf = assetInf;
412 req.NumPackets = CalculateNumPackets(assetInf.Data); 412 req.NumPackets = CalculateNumPackets(assetInf.Data);
413 413
414 RequestedAssets.Remove(assetInf.Metadata.FullID); 414 RequestedAssets.Remove(assetInf.FullID);
415 // If it's a direct request for a script, drop it 415 // If it's a direct request for a script, drop it
416 // because it's a hacked client 416 // because it's a hacked client
417 if (req.AssetRequestSource != 2 || assetInf.Metadata.Type != 10) 417 if (req.AssetRequestSource != 2 || assetInf.Type != 10)
418 AssetRequests.Add(req); 418 AssetRequests.Add(req);
419 } 419 }
420 } 420 }
@@ -424,8 +424,8 @@ namespace OpenSim.Framework.Communications.Cache
424 424
425 lock (RequestLists) 425 lock (RequestLists)
426 { 426 {
427 if (RequestLists.TryGetValue(asset.Metadata.FullID, out reqList)) 427 if (RequestLists.TryGetValue(asset.FullID, out reqList))
428 RequestLists.Remove(asset.Metadata.FullID); 428 RequestLists.Remove(asset.FullID);
429 } 429 }
430 430
431 if (reqList != null) 431 if (reqList != null)
@@ -436,8 +436,8 @@ namespace OpenSim.Framework.Communications.Cache
436 foreach (NewAssetRequest req in reqList.Requests) 436 foreach (NewAssetRequest req in reqList.Requests)
437 { 437 {
438 // Xantor 20080526 are we really calling all the callbacks if multiple queued for 1 request? -- Yes, checked 438 // Xantor 20080526 are we really calling all the callbacks if multiple queued for 1 request? -- Yes, checked
439 // m_log.DebugFormat("[ASSET CACHE]: Callback for asset {0}", asset.Metadata.FullID); 439 // m_log.DebugFormat("[ASSET CACHE]: Callback for asset {0}", asset.FullID);
440 req.Callback(asset.Metadata.FullID, asset); 440 req.Callback(asset.FullID, asset);
441 } 441 }
442 } 442 }
443 } 443 }
@@ -545,7 +545,7 @@ namespace OpenSim.Framework.Communications.Cache
545 } 545 }
546 546
547 // Scripts cannot be retrieved by direct request 547 // Scripts cannot be retrieved by direct request
548 if (transferRequest.TransferInfo.SourceType == 2 && asset.Metadata.Type == 10) 548 if (transferRequest.TransferInfo.SourceType == 2 && asset.Type == 10)
549 return; 549 return;
550 550
551 // The asset is knosn to exist and is in our cache, so add it to the AssetRequests list 551 // The asset is knosn to exist and is in our cache, so add it to the AssetRequests list
@@ -631,10 +631,10 @@ namespace OpenSim.Framework.Communications.Cache
631 public AssetInfo(AssetBase aBase) 631 public AssetInfo(AssetBase aBase)
632 { 632 {
633 Data = aBase.Data; 633 Data = aBase.Data;
634 Metadata.FullID = aBase.Metadata.FullID; 634 FullID = aBase.FullID;
635 Metadata.Type = aBase.Metadata.Type; 635 Type = aBase.Type;
636 Metadata.Name = aBase.Metadata.Name; 636 Name = aBase.Name;
637 Metadata.Description = aBase.Metadata.Description; 637 Description = aBase.Description;
638 } 638 }
639 } 639 }
640 640
@@ -643,10 +643,10 @@ namespace OpenSim.Framework.Communications.Cache
643 public TextureImage(AssetBase aBase) 643 public TextureImage(AssetBase aBase)
644 { 644 {
645 Data = aBase.Data; 645 Data = aBase.Data;
646 Metadata.FullID = aBase.Metadata.FullID; 646 FullID = aBase.FullID;
647 Metadata.Type = aBase.Metadata.Type; 647 Type = aBase.Type;
648 Metadata.Name = aBase.Metadata.Name; 648 Name = aBase.Name;
649 Metadata.Description = aBase.Metadata.Description; 649 Description = aBase.Description;
650 } 650 }
651 } 651 }
652 652
diff --git a/OpenSim/Framework/Communications/Cache/CryptoGridAssetClient.cs b/OpenSim/Framework/Communications/Cache/CryptoGridAssetClient.cs
index 0f4e8ac..f1c19fa 100644
--- a/OpenSim/Framework/Communications/Cache/CryptoGridAssetClient.cs
+++ b/OpenSim/Framework/Communications/Cache/CryptoGridAssetClient.cs
@@ -441,17 +441,17 @@ namespace OpenSim.Framework.Communications.Cache
441 string salt = Convert.ToBase64String(rand); 441 string salt = Convert.ToBase64String(rand);
442 442
443 x.Data = UtilRijndael.Encrypt(x.Data, file.Secret, salt, "SHA1", 2, file.IVBytes, file.Keysize); 443 x.Data = UtilRijndael.Encrypt(x.Data, file.Secret, salt, "SHA1", 2, file.IVBytes, file.Keysize);
444 x.Metadata.Description = String.Format("ENCASS#:~:#{0}#:~:#{1}#:~:#{2}#:~:#{3}", 444 x.Description = String.Format("ENCASS#:~:#{0}#:~:#{1}#:~:#{2}#:~:#{3}",
445 "OPENSIM_AES_AF1", 445 "OPENSIM_AES_AF1",
446 file.AlsoKnownAs, 446 file.AlsoKnownAs,
447 salt, 447 salt,
448 x.Metadata.Description); 448 x.Description);
449 } 449 }
450 450
451 private bool DecryptAssetBase(AssetBase x) 451 private bool DecryptAssetBase(AssetBase x)
452 { 452 {
453 // Check it's encrypted first. 453 // Check it's encrypted first.
454 if (!x.Metadata.Description.Contains("ENCASS")) 454 if (!x.Description.Contains("ENCASS"))
455 return true; 455 return true;
456 456
457 // ENCASS:ALG:AKA:SALT:Description 457 // ENCASS:ALG:AKA:SALT:Description
@@ -459,7 +459,7 @@ namespace OpenSim.Framework.Communications.Cache
459 string[] splitchars = new string[1]; 459 string[] splitchars = new string[1];
460 splitchars[0] = "#:~:#"; 460 splitchars[0] = "#:~:#";
461 461
462 string[] meta = x.Metadata.Description.Split(splitchars, StringSplitOptions.None); 462 string[] meta = x.Description.Split(splitchars, StringSplitOptions.None);
463 if (meta.Length < 5) 463 if (meta.Length < 5)
464 { 464 {
465 m_log.Warn("[ENCASSETS] Recieved Encrypted Asset, but header is corrupt"); 465 m_log.Warn("[ENCASSETS] Recieved Encrypted Asset, but header is corrupt");
@@ -470,7 +470,7 @@ namespace OpenSim.Framework.Communications.Cache
470 if (m_keyfiles.ContainsKey(meta[2])) 470 if (m_keyfiles.ContainsKey(meta[2]))
471 { 471 {
472 RjinKeyfile deckey = m_keyfiles[meta[2]]; 472 RjinKeyfile deckey = m_keyfiles[meta[2]];
473 x.Metadata.Description = meta[4]; 473 x.Description = meta[4];
474 switch (meta[1]) 474 switch (meta[1])
475 { 475 {
476 case "OPENSIM_AES_AF1": 476 case "OPENSIM_AES_AF1":
@@ -544,7 +544,7 @@ namespace OpenSim.Framework.Communications.Cache
544 { 544 {
545 string assetUrl = _assetServerUrl + "/assets/"; 545 string assetUrl = _assetServerUrl + "/assets/";
546 546
547 m_log.InfoFormat("[CRYPTO GRID ASSET CLIENT]: Sending store request for asset {0}", asset.Metadata.FullID); 547 m_log.InfoFormat("[CRYPTO GRID ASSET CLIENT]: Sending store request for asset {0}", asset.FullID);
548 548
549 RestObjectPoster.BeginPostObject<AssetBase>(assetUrl, asset); 549 RestObjectPoster.BeginPostObject<AssetBase>(assetUrl, asset);
550 } 550 }
diff --git a/OpenSim/Framework/Communications/Cache/FileAssetClient.cs b/OpenSim/Framework/Communications/Cache/FileAssetClient.cs
index e6574a1..8d03f56 100644
--- a/OpenSim/Framework/Communications/Cache/FileAssetClient.cs
+++ b/OpenSim/Framework/Communications/Cache/FileAssetClient.cs
@@ -79,7 +79,7 @@ namespace OpenSim.Framework.Communications.Cache
79 79
80 public override void StoreAsset(AssetBase asset) 80 public override void StoreAsset(AssetBase asset)
81 { 81 {
82 byte[] idBytes = asset.Metadata.FullID.Guid.ToByteArray(); 82 byte[] idBytes = asset.FullID.Guid.ToByteArray();
83 83
84 string cdir = m_dir + Path.DirectorySeparatorChar + idBytes[0] 84 string cdir = m_dir + Path.DirectorySeparatorChar + idBytes[0]
85 + Path.DirectorySeparatorChar + idBytes[1]; 85 + Path.DirectorySeparatorChar + idBytes[1];
@@ -90,7 +90,7 @@ namespace OpenSim.Framework.Communications.Cache
90 if (!Directory.Exists(cdir)) 90 if (!Directory.Exists(cdir))
91 Directory.CreateDirectory(cdir); 91 Directory.CreateDirectory(cdir);
92 92
93 FileStream x = new FileStream(cdir + Path.DirectorySeparatorChar + asset.Metadata.FullID + ".xml", FileMode.Create); 93 FileStream x = new FileStream(cdir + Path.DirectorySeparatorChar + asset.FullID + ".xml", FileMode.Create);
94 m_xs.Serialize(x, asset); 94 m_xs.Serialize(x, asset);
95 95
96 x.Flush(); 96 x.Flush();
diff --git a/OpenSim/Framework/Communications/Cache/GridAssetClient.cs b/OpenSim/Framework/Communications/Cache/GridAssetClient.cs
index 6522ad0..3b6dc52 100644
--- a/OpenSim/Framework/Communications/Cache/GridAssetClient.cs
+++ b/OpenSim/Framework/Communications/Cache/GridAssetClient.cs
@@ -126,7 +126,7 @@ namespace OpenSim.Framework.Communications.Cache
126 // rc.Request(s); 126 // rc.Request(s);
127 //m_log.InfoFormat("[ASSET]: Stored {0}", rc); 127 //m_log.InfoFormat("[ASSET]: Stored {0}", rc);
128 128
129 m_log.InfoFormat("[GRID ASSET CLIENT]: Sending store request for asset {0}", asset.Metadata.FullID); 129 m_log.InfoFormat("[GRID ASSET CLIENT]: Sending store request for asset {0}", asset.FullID);
130 130
131 RestObjectPoster.BeginPostObject<AssetBase>(assetUrl, asset); 131 RestObjectPoster.BeginPostObject<AssetBase>(assetUrl, asset);
132 } 132 }