aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-02-20 23:21:51 +0000
committerJustin Clarke Casey2008-02-20 23:21:51 +0000
commitb0c5ef0b68c8664d250d0b0c0c5c1ddb7eab3acf (patch)
tree4408c9d9ec8f42ac4644447590399065cca0b25e
parentTreads command lists threads, but not thread name (yet) (diff)
downloadopensim-SC_OLD-b0c5ef0b68c8664d250d0b0c0c5c1ddb7eab3acf.zip
opensim-SC_OLD-b0c5ef0b68c8664d250d0b0c0c5c1ddb7eab3acf.tar.gz
opensim-SC_OLD-b0c5ef0b68c8664d250d0b0c0c5c1ddb7eab3acf.tar.bz2
opensim-SC_OLD-b0c5ef0b68c8664d250d0b0c0c5c1ddb7eab3acf.tar.xz
* Eliminate AssetCache.CopyAsset()
* Resolve a bad logic bug in AssetCache.GetAsset() * This may make some asset related things work better (possibly getting main map images will now be improved).
-rw-r--r--OpenSim/Framework/Communications/Cache/AssetCache.cs30
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs58
2 files changed, 30 insertions, 58 deletions
diff --git a/OpenSim/Framework/Communications/Cache/AssetCache.cs b/OpenSim/Framework/Communications/Cache/AssetCache.cs
index 5e6bd5f..8f8e362 100644
--- a/OpenSim/Framework/Communications/Cache/AssetCache.cs
+++ b/OpenSim/Framework/Communications/Cache/AssetCache.cs
@@ -299,6 +299,10 @@ namespace OpenSim.Framework.Communications.Cache
299 299
300 if (TryGetCachedAsset(assetID, out asset)) 300 if (TryGetCachedAsset(assetID, out asset))
301 { 301 {
302 return asset;
303 }
304 else
305 {
302 m_assetServer.RequestAsset(assetID, isTexture); 306 m_assetServer.RequestAsset(assetID, isTexture);
303 307
304 do 308 do
@@ -316,10 +320,6 @@ namespace OpenSim.Framework.Communications.Cache
316 320
317 return null; 321 return null;
318 } 322 }
319 else
320 {
321 return asset;
322 }
323 } 323 }
324 324
325 /// <summary> 325 /// <summary>
@@ -387,28 +387,6 @@ namespace OpenSim.Framework.Communications.Cache
387 m_log.DebugFormat("[ASSET CACHE]: Adding {0} {1} [{2}]: {3}.", temporary, type, asset.FullID, result); 387 m_log.DebugFormat("[ASSET CACHE]: Adding {0} {1} [{2}]: {3}.", temporary, type, asset.FullID, result);
388 } 388 }
389 389
390 /// <summary>
391 /// Copy an asset and add it to the cache with a new assetID.
392 /// XXX We shouldn't actually ever need to do this!
393 /// </summary>
394 /// <param name="assetID"></param>
395 /// <returns></returns>
396 public AssetBase CopyAsset(LLUUID assetID)
397 {
398 AssetBase asset;
399
400 if (TryGetCachedAsset(assetID, out asset))
401 {
402 asset.FullID = LLUUID.Random(); // TODO: check for conflicts
403 AddAsset(asset);
404 return asset;
405 }
406 else
407 {
408 return null;
409 }
410 }
411
412 // See IAssetReceiver 390 // See IAssetReceiver
413 public void AssetReceived(AssetBase asset, bool IsTexture) 391 public void AssetReceived(AssetBase asset, bool IsTexture)
414 { 392 {
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index 6ca855d..a759173 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -51,7 +51,7 @@ namespace OpenSim.Region.Environment.Scenes
51 /// </summary> 51 /// </summary>
52 public void StartScripts() 52 public void StartScripts()
53 { 53 {
54 m_log.Info("[PRIMINVENTORY]: Starting scripts in scene"); 54 m_log.Info("[PRIM INVENTORY]: Starting scripts in scene");
55 55
56 foreach (SceneObjectGroup group in Entities.Values) 56 foreach (SceneObjectGroup group in Entities.Values)
57 { 57 {
@@ -90,7 +90,7 @@ namespace OpenSim.Region.Environment.Scenes
90 if (!TryGetAvatar(avatarId, out avatar)) 90 if (!TryGetAvatar(avatarId, out avatar))
91 { 91 {
92 m_log.ErrorFormat( 92 m_log.ErrorFormat(
93 "[AGENTINVENTORY]: Could not find avatar {0} to add inventory item", avatarId); 93 "[AGENT INVENTORY]: Could not find avatar {0} to add inventory item", avatarId);
94 return; 94 return;
95 } 95 }
96 96
@@ -153,7 +153,7 @@ namespace OpenSim.Region.Environment.Scenes
153 else 153 else
154 { 154 {
155 m_log.ErrorFormat( 155 m_log.ErrorFormat(
156 "[AGENTINVENTORY]: " + 156 "[AGENT INVENTORY]: " +
157 "Avatar {0} cannot be found to update its inventory item asset", 157 "Avatar {0} cannot be found to update its inventory item asset",
158 avatarId); 158 avatarId);
159 } 159 }
@@ -178,7 +178,7 @@ namespace OpenSim.Region.Environment.Scenes
178 if (null == group) 178 if (null == group)
179 { 179 {
180 m_log.ErrorFormat( 180 m_log.ErrorFormat(
181 "[PRIMINVENTORY]: " + 181 "[PRIM INVENTORY]: " +
182 "Prim inventory update requested for item ID {0} in prim ID {1} but this prim does not exist", 182 "Prim inventory update requested for item ID {0} in prim ID {1} but this prim does not exist",
183 itemId, primId); 183 itemId, primId);
184 184
@@ -227,7 +227,7 @@ namespace OpenSim.Region.Environment.Scenes
227 else 227 else
228 { 228 {
229 m_log.ErrorFormat( 229 m_log.ErrorFormat(
230 "[PRIMINVENTORY]: " + 230 "[PRIM INVENTORY]: " +
231 "Avatar {0} cannot be found to update its prim item asset", 231 "Avatar {0} cannot be found to update its prim item asset",
232 avatarId); 232 avatarId);
233 } 233 }
@@ -284,7 +284,7 @@ namespace OpenSim.Region.Environment.Scenes
284 else 284 else
285 { 285 {
286 m_log.Error( 286 m_log.Error(
287 "[AGENTINVENTORY]: Agent ID " + remoteClient.AgentId + " not found for an inventory item update."); 287 "[AGENT INVENTORY]: Agent ID " + remoteClient.AgentId + " not found for an inventory item update.");
288 } 288 }
289 } 289 }
290 290
@@ -297,7 +297,7 @@ namespace OpenSim.Region.Environment.Scenes
297 CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(oldAgentID); 297 CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(oldAgentID);
298 if (userInfo == null) 298 if (userInfo == null)
299 { 299 {
300 m_log.Error("[AGENTINVENTORY]: Failed to find user " + oldAgentID.ToString()); 300 m_log.Error("[AGENT INVENTORY]: Failed to find user " + oldAgentID.ToString());
301 return; 301 return;
302 } 302 }
303 303
@@ -306,29 +306,22 @@ namespace OpenSim.Region.Environment.Scenes
306 item = userInfo.RootFolder.HasItem(oldItemID); 306 item = userInfo.RootFolder.HasItem(oldItemID);
307 if (item == null) 307 if (item == null)
308 { 308 {
309 m_log.Error("[AGENTINVENTORY]: Failed to find item " + oldItemID.ToString()); 309 m_log.Error("[AGENT INVENTORY]: Failed to find item " + oldItemID.ToString());
310 return; 310 return;
311 } 311 }
312 } 312 }
313 else 313 else
314 { 314 {
315 m_log.Error("[AGENTINVENTORY]: Failed to find item " + oldItemID.ToString()); 315 m_log.Error("[AGENT INVENTORY]: Failed to find item " + oldItemID.ToString());
316 return; 316 return;
317 } 317 }
318 } 318 }
319 319
320
321 AssetBase asset = AssetCache.CopyAsset(item.assetID);
322 if (asset == null)
323 {
324 m_log.Warn("[AGENTINVENTORY]: Failed to find asset " + item.assetID.ToString());
325 return;
326 }
327
328 asset.Name = (newName.Length == 0) ? item.inventoryName : newName;
329
330 // TODO: preserve current permissions? 320 // TODO: preserve current permissions?
331 CreateNewInventoryItem(remoteClient, newFolderID, callbackID, asset, item.inventoryNextPermissions); 321 CreateNewInventoryItem(
322 remoteClient, newFolderID, callbackID,
323 AssetCache.GetAsset(item.assetID, (item.assetType == (int)AssetType.Texture ? true : false)),
324 item.inventoryNextPermissions);
332 } 325 }
333 326
334 private AssetBase CreateAsset(string name, string description, sbyte invType, sbyte assetType, byte[] data) 327 private AssetBase CreateAsset(string name, string description, sbyte invType, sbyte assetType, byte[] data)
@@ -347,13 +340,13 @@ namespace OpenSim.Region.Environment.Scenes
347 string newName) 340 string newName)
348 { 341 {
349 m_log.Info( 342 m_log.Info(
350 "[AGENTINVENTORY]: " + 343 "[AGENT INVENTORY]: " +
351 "Moving item for " + remoteClient.AgentId.ToString()); 344 "Moving item for " + remoteClient.AgentId.ToString());
352 345
353 CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); 346 CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
354 if (userInfo == null) 347 if (userInfo == null)
355 { 348 {
356 m_log.Error("[AGENTINVENTORY]: Failed to find user " + remoteClient.AgentId.ToString()); 349 m_log.Error("[AGENT INVENTORY]: Failed to find user " + remoteClient.AgentId.ToString());
357 return; 350 return;
358 } 351 }
359 352
@@ -374,13 +367,13 @@ namespace OpenSim.Region.Environment.Scenes
374 } 367 }
375 else 368 else
376 { 369 {
377 m_log.Error("[AGENTINVENTORY]: Failed to find item " + itemID.ToString()); 370 m_log.Error("[AGENT INVENTORY]: Failed to find item " + itemID.ToString());
378 return; 371 return;
379 } 372 }
380 } 373 }
381 else 374 else
382 { 375 {
383 m_log.Error("[AGENTINVENTORY]: Failed to find item " + itemID.ToString() + ", no root folder"); 376 m_log.Error("[AGENT INVENTORY]: Failed to find item " + itemID.ToString() + ", no root folder");
384 return; 377 return;
385 } 378 }
386 } 379 }
@@ -482,7 +475,7 @@ namespace OpenSim.Region.Environment.Scenes
482 = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); 475 = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
483 if (userInfo == null) 476 if (userInfo == null)
484 { 477 {
485 m_log.Error("[AGENTINVENTORY]: Failed to find user " + remoteClient.AgentId.ToString()); 478 m_log.Error("[AGENT INVENTORY]: Failed to find user " + remoteClient.AgentId.ToString());
486 return; 479 return;
487 } 480 }
488 481
@@ -506,7 +499,7 @@ namespace OpenSim.Region.Environment.Scenes
506 = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); 499 = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
507 if (userInfo == null) 500 if (userInfo == null)
508 { 501 {
509 m_log.Error("[AGENTINVENTORY]: Failed to find user " + remoteClient.AgentId.ToString()); 502 m_log.Error("[AGENT INVENTORY]: Failed to find user " + remoteClient.AgentId.ToString());
510 return; 503 return;
511 } 504 }
512 505
@@ -558,7 +551,7 @@ namespace OpenSim.Region.Environment.Scenes
558 else 551 else
559 { 552 {
560 m_log.ErrorFormat( 553 m_log.ErrorFormat(
561 "[PRIMINVENTORY]: Inventory requested of prim {0} which doesn't exist", primLocalID); 554 "[PRIM INVENTORY]: Inventory requested of prim {0} which doesn't exist", primLocalID);
562 } 555 }
563 } 556 }
564 557
@@ -584,7 +577,7 @@ namespace OpenSim.Region.Environment.Scenes
584 else 577 else
585 { 578 {
586 m_log.ErrorFormat( 579 m_log.ErrorFormat(
587 "[PRIMINVENTORY]: " + 580 "[PRIM INVENTORY]: " +
588 "Removal of item {0} requested of prim {1} but this prim does not exist", 581 "Removal of item {0} requested of prim {1} but this prim does not exist",
589 itemID, 582 itemID,
590 localID); 583 localID);
@@ -608,7 +601,7 @@ namespace OpenSim.Region.Environment.Scenes
608 // TODO Retrieve itemID from client's inventory to pass on 601 // TODO Retrieve itemID from client's inventory to pass on
609 //group.AddInventoryItem(remoteClient, primLocalID, null); 602 //group.AddInventoryItem(remoteClient, primLocalID, null);
610 m_log.InfoFormat( 603 m_log.InfoFormat(
611 "[PRIMINVENTORY]: " + 604 "[PRIM INVENTORY]: " +
612 "Non script prim inventory not yet implemented!" 605 "Non script prim inventory not yet implemented!"
613 + "\nUpdateTaskInventory called with item {0}, folder {1}, primLocalID {2}, user {3}", 606 + "\nUpdateTaskInventory called with item {0}, folder {1}, primLocalID {2}, user {3}",
614 itemID, folderID, primLocalID, remoteClient.Name); 607 itemID, folderID, primLocalID, remoteClient.Name);
@@ -616,7 +609,7 @@ namespace OpenSim.Region.Environment.Scenes
616 else 609 else
617 { 610 {
618 m_log.WarnFormat( 611 m_log.WarnFormat(
619 "[PRIMINVENTORY]: " + 612 "[PRIM INVENTORY]: " +
620 "Update with item {0} requested of prim {1} for {2} but this prim does not exist", 613 "Update with item {0} requested of prim {1} for {2} but this prim does not exist",
621 itemID, primLocalID, remoteClient.Name); 614 itemID, primLocalID, remoteClient.Name);
622 } 615 }
@@ -663,7 +656,7 @@ namespace OpenSim.Region.Environment.Scenes
663 else 656 else
664 { 657 {
665 m_log.ErrorFormat( 658 m_log.ErrorFormat(
666 "[PRIMINVENTORY]: " + 659 "[PRIM INVENTORY]: " +
667 "Could not rez script {0} into prim local ID {1} for user {2}" 660 "Could not rez script {0} into prim local ID {1} for user {2}"
668 + " because the prim could not be found in the region!", 661 + " because the prim could not be found in the region!",
669 item.inventoryName, localID, remoteClient.Name); 662 item.inventoryName, localID, remoteClient.Name);
@@ -672,7 +665,7 @@ namespace OpenSim.Region.Environment.Scenes
672 else 665 else
673 { 666 {
674 m_log.ErrorFormat( 667 m_log.ErrorFormat(
675 "[PRIMINVENTORY]: Could not find script inventory item {0} to rez for {1}!", 668 "[PRIM INVENTORY]: Could not find script inventory item {0} to rez for {1}!",
676 itemID, remoteClient.Name); 669 itemID, remoteClient.Name);
677 } 670 }
678 } 671 }
@@ -824,6 +817,7 @@ namespace OpenSim.Region.Environment.Scenes
824 } 817 }
825 } 818 }
826 } 819 }
820
827 public void RezSingleAttachment(IClientAPI remoteClient, LLUUID itemID, uint AttachmentPt, 821 public void RezSingleAttachment(IClientAPI remoteClient, LLUUID itemID, uint AttachmentPt,
828 uint ItemFlags, uint NextOwnerMask) 822 uint ItemFlags, uint NextOwnerMask)
829 { 823 {