* 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).
ThreadPoolClientBranch
Justin Clarke Casey 2008-02-20 23:21:51 +00:00
parent 5f7a02fce9
commit b0c5ef0b68
2 changed files with 30 additions and 58 deletions

View File

@ -298,6 +298,10 @@ namespace OpenSim.Framework.Communications.Cache
AssetBase asset; AssetBase asset;
if (TryGetCachedAsset(assetID, out asset)) if (TryGetCachedAsset(assetID, out asset))
{
return asset;
}
else
{ {
m_assetServer.RequestAsset(assetID, isTexture); m_assetServer.RequestAsset(assetID, isTexture);
@ -316,10 +320,6 @@ namespace OpenSim.Framework.Communications.Cache
return null; return null;
} }
else
{
return asset;
}
} }
/// <summary> /// <summary>
@ -387,28 +387,6 @@ namespace OpenSim.Framework.Communications.Cache
m_log.DebugFormat("[ASSET CACHE]: Adding {0} {1} [{2}]: {3}.", temporary, type, asset.FullID, result); m_log.DebugFormat("[ASSET CACHE]: Adding {0} {1} [{2}]: {3}.", temporary, type, asset.FullID, result);
} }
/// <summary>
/// Copy an asset and add it to the cache with a new assetID.
/// XXX We shouldn't actually ever need to do this!
/// </summary>
/// <param name="assetID"></param>
/// <returns></returns>
public AssetBase CopyAsset(LLUUID assetID)
{
AssetBase asset;
if (TryGetCachedAsset(assetID, out asset))
{
asset.FullID = LLUUID.Random(); // TODO: check for conflicts
AddAsset(asset);
return asset;
}
else
{
return null;
}
}
// See IAssetReceiver // See IAssetReceiver
public void AssetReceived(AssetBase asset, bool IsTexture) public void AssetReceived(AssetBase asset, bool IsTexture)
{ {

View File

@ -317,18 +317,11 @@ namespace OpenSim.Region.Environment.Scenes
} }
} }
AssetBase asset = AssetCache.CopyAsset(item.assetID);
if (asset == null)
{
m_log.Warn("[AGENTINVENTORY]: Failed to find asset " + item.assetID.ToString());
return;
}
asset.Name = (newName.Length == 0) ? item.inventoryName : newName;
// TODO: preserve current permissions? // TODO: preserve current permissions?
CreateNewInventoryItem(remoteClient, newFolderID, callbackID, asset, item.inventoryNextPermissions); CreateNewInventoryItem(
remoteClient, newFolderID, callbackID,
AssetCache.GetAsset(item.assetID, (item.assetType == (int)AssetType.Texture ? true : false)),
item.inventoryNextPermissions);
} }
private AssetBase CreateAsset(string name, string description, sbyte invType, sbyte assetType, byte[] data) private AssetBase CreateAsset(string name, string description, sbyte invType, sbyte assetType, byte[] data)
@ -824,6 +817,7 @@ namespace OpenSim.Region.Environment.Scenes
} }
} }
} }
public void RezSingleAttachment(IClientAPI remoteClient, LLUUID itemID, uint AttachmentPt, public void RezSingleAttachment(IClientAPI remoteClient, LLUUID itemID, uint AttachmentPt,
uint ItemFlags, uint NextOwnerMask) uint ItemFlags, uint NextOwnerMask)
{ {