* Removing unnecessary LLUUID.Zero check from AssetCache
* This revision also includes a very temporary fix for the fact that NREs are received because of a missing avatar apperance in grid mode0.6.0-stable
parent
6a526fcb6f
commit
772f88d2e5
|
@ -371,85 +371,81 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
// See IAssetReceiver
|
// See IAssetReceiver
|
||||||
public void AssetReceived(AssetBase asset, bool IsTexture)
|
public void AssetReceived(AssetBase asset, bool IsTexture)
|
||||||
{
|
{
|
||||||
if (asset.FullID != LLUUID.Zero) // if it is set to zero then the asset wasn't found by the server
|
//check if it is a texture or not
|
||||||
|
//then add to the correct cache list
|
||||||
|
//then check for waiting requests for this asset/texture (in the Requested lists)
|
||||||
|
//and move those requests into the Requests list.
|
||||||
|
if (IsTexture)
|
||||||
{
|
{
|
||||||
//check if it is a texture or not
|
TextureImage image = new TextureImage(asset);
|
||||||
//then add to the correct cache list
|
if (!Textures.ContainsKey(image.FullID))
|
||||||
//then check for waiting requests for this asset/texture (in the Requested lists)
|
|
||||||
//and move those requests into the Requests list.
|
|
||||||
|
|
||||||
if (IsTexture)
|
|
||||||
{
|
{
|
||||||
TextureImage image = new TextureImage(asset);
|
Textures.Add(image.FullID, image);
|
||||||
if (!Textures.ContainsKey(image.FullID))
|
|
||||||
{
|
|
||||||
Textures.Add(image.FullID, image);
|
|
||||||
|
|
||||||
if (StatsManager.SimExtraStats != null)
|
if (StatsManager.SimExtraStats != null)
|
||||||
{
|
{
|
||||||
StatsManager.SimExtraStats.AddTexture(image);
|
StatsManager.SimExtraStats.AddTexture(image);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AssetInfo assetInf = new AssetInfo(asset);
|
||||||
|
if (!Assets.ContainsKey(assetInf.FullID))
|
||||||
{
|
{
|
||||||
AssetInfo assetInf = new AssetInfo(asset);
|
Assets.Add(assetInf.FullID, assetInf);
|
||||||
if (!Assets.ContainsKey(assetInf.FullID))
|
|
||||||
|
if (StatsManager.SimExtraStats != null)
|
||||||
{
|
{
|
||||||
Assets.Add(assetInf.FullID, assetInf);
|
StatsManager.SimExtraStats.AddAsset(assetInf);
|
||||||
|
}
|
||||||
|
|
||||||
if (StatsManager.SimExtraStats != null)
|
if (RequestedAssets.ContainsKey(assetInf.FullID))
|
||||||
{
|
{
|
||||||
StatsManager.SimExtraStats.AddAsset(assetInf);
|
AssetRequest req = RequestedAssets[assetInf.FullID];
|
||||||
}
|
req.AssetInf = assetInf;
|
||||||
|
req.NumPackets = CalculateNumPackets(assetInf.Data);
|
||||||
|
|
||||||
if (RequestedAssets.ContainsKey(assetInf.FullID))
|
RequestedAssets.Remove(assetInf.FullID);
|
||||||
{
|
AssetRequests.Add(req);
|
||||||
AssetRequest req = RequestedAssets[assetInf.FullID];
|
|
||||||
req.AssetInf = assetInf;
|
|
||||||
req.NumPackets = CalculateNumPackets(assetInf.Data);
|
|
||||||
|
|
||||||
RequestedAssets.Remove(assetInf.FullID);
|
|
||||||
AssetRequests.Add(req);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Notify requesters for this asset
|
// Notify requesters for this asset
|
||||||
if (RequestLists.ContainsKey(asset.FullID))
|
if (RequestLists.ContainsKey(asset.FullID))
|
||||||
|
{
|
||||||
|
AssetRequestsList reqList = null;
|
||||||
|
lock (RequestLists)
|
||||||
{
|
{
|
||||||
AssetRequestsList reqList = null;
|
//m_log.Info("AssetCache: Lock taken on requestLists (AssetReceived #1)");
|
||||||
|
reqList = RequestLists[asset.FullID];
|
||||||
|
|
||||||
|
}
|
||||||
|
//m_log.Info("AssetCache: Lock released on requestLists (AssetReceived #1)");
|
||||||
|
if (reqList != null)
|
||||||
|
{
|
||||||
|
//making a copy of the list is not ideal
|
||||||
|
//but the old method of locking around this whole block of code was causing a multi-thread lock
|
||||||
|
//between this and the TextureDownloadModule
|
||||||
|
//while the localAsset thread running this and trying to send a texture to the callback in the
|
||||||
|
//texturedownloadmodule , and hitting a lock in there. While the texturedownload thread (which was holding
|
||||||
|
// the lock in the texturedownload module) was trying to
|
||||||
|
//request a new asset and hitting a lock in here on the RequestLists.
|
||||||
|
|
||||||
|
List<NewAssetRequest> theseRequests = new List<NewAssetRequest>(reqList.Requests);
|
||||||
|
reqList.Requests.Clear();
|
||||||
|
|
||||||
lock (RequestLists)
|
lock (RequestLists)
|
||||||
{
|
{
|
||||||
//m_log.Info("AssetCache: Lock taken on requestLists (AssetReceived #1)");
|
// m_log.Info("AssetCache: Lock taken on requestLists (AssetReceived #2)");
|
||||||
reqList = RequestLists[asset.FullID];
|
RequestLists.Remove(asset.FullID);
|
||||||
|
|
||||||
}
|
}
|
||||||
//m_log.Info("AssetCache: Lock released on requestLists (AssetReceived #1)");
|
//m_log.Info("AssetCache: Lock released on requestLists (AssetReceived #2)");
|
||||||
if (reqList != null)
|
|
||||||
|
foreach (NewAssetRequest req in theseRequests)
|
||||||
{
|
{
|
||||||
//making a copy of the list is not ideal
|
req.Callback(asset.FullID, asset);
|
||||||
//but the old method of locking around this whole block of code was causing a multi-thread lock
|
|
||||||
//between this and the TextureDownloadModule
|
|
||||||
//while the localAsset thread running this and trying to send a texture to the callback in the
|
|
||||||
//texturedownloadmodule , and hitting a lock in there. While the texturedownload thread (which was holding
|
|
||||||
// the lock in the texturedownload module) was trying to
|
|
||||||
//request a new asset and hitting a lock in here on the RequestLists.
|
|
||||||
|
|
||||||
List<NewAssetRequest> theseRequests = new List<NewAssetRequest>(reqList.Requests);
|
|
||||||
reqList.Requests.Clear();
|
|
||||||
|
|
||||||
lock (RequestLists)
|
|
||||||
{
|
|
||||||
// m_log.Info("AssetCache: Lock taken on requestLists (AssetReceived #2)");
|
|
||||||
RequestLists.Remove(asset.FullID);
|
|
||||||
}
|
|
||||||
//m_log.Info("AssetCache: Lock released on requestLists (AssetReceived #2)");
|
|
||||||
|
|
||||||
foreach (NewAssetRequest req in theseRequests)
|
|
||||||
{
|
|
||||||
req.Callback(asset.FullID, asset);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,10 @@ namespace OpenSim.Framework
|
||||||
void Close();
|
void Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
// could change to delegate?
|
/// <summary>
|
||||||
|
/// Implemented by classes which with to asynchronously receive asset data from the asset service
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>could change to delegate?</remarks>
|
||||||
public interface IAssetReceiver
|
public interface IAssetReceiver
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -1452,8 +1452,13 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void SendInitialData()
|
public void SendInitialData()
|
||||||
{
|
{
|
||||||
|
// justincc - very temporary fix for the fact that m_apperance appears to be null at this point in grid mode
|
||||||
|
if (null == m_appearance)
|
||||||
|
m_appearance = new AvatarAppearance();
|
||||||
|
|
||||||
m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid, LocalId,
|
m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid, LocalId,
|
||||||
m_pos, m_appearance.Texture.ToBytes(), m_parentID);
|
m_pos, m_appearance.Texture.ToBytes(), m_parentID);
|
||||||
|
|
||||||
if (!m_isChildAgent)
|
if (!m_isChildAgent)
|
||||||
{
|
{
|
||||||
m_scene.InformClientOfNeighbours(this);
|
m_scene.InformClientOfNeighbours(this);
|
||||||
|
|
Loading…
Reference in New Issue