Test on the grid asset problem, don't update to this version unless you just want to test to see if this fixes anything (but it could just as well break grid assets even more).
parent
2aa9440437
commit
88f04731ca
|
@ -74,7 +74,7 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
_assetRequests.Enqueue(req);
|
_assetRequests.Enqueue(req);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateAsset(AssetBase asset)
|
public virtual void UpdateAsset(AssetBase asset)
|
||||||
{
|
{
|
||||||
lock (syncLock)
|
lock (syncLock)
|
||||||
{
|
{
|
||||||
|
|
|
@ -35,10 +35,9 @@ using OpenSim.Framework.Console;
|
||||||
|
|
||||||
namespace OpenSim.Framework.Communications.Cache
|
namespace OpenSim.Framework.Communications.Cache
|
||||||
{
|
{
|
||||||
public class GridAssetClient : IAssetServer
|
public class GridAssetClient : AssetServerBase
|
||||||
{
|
{
|
||||||
private string _assetServerUrl;
|
private string _assetServerUrl;
|
||||||
private IAssetReceiver _receiver;
|
|
||||||
|
|
||||||
public GridAssetClient(string serverUrl)
|
public GridAssetClient(string serverUrl)
|
||||||
{
|
{
|
||||||
|
@ -47,22 +46,24 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
|
|
||||||
#region IAssetServer Members
|
#region IAssetServer Members
|
||||||
|
|
||||||
public void SetReceiver(IAssetReceiver receiver)
|
protected override void RunRequests()
|
||||||
{
|
{
|
||||||
_receiver = receiver;
|
while (true)
|
||||||
}
|
{
|
||||||
|
ARequest req = _assetRequests.Dequeue();
|
||||||
|
|
||||||
|
//MainLog.Instance.Verbose("AssetStorage","Requesting asset: " + req.AssetID);
|
||||||
|
|
||||||
|
|
||||||
public void FetchAsset(LLUUID assetID, bool isTexture)
|
|
||||||
{
|
|
||||||
Stream s = null;
|
Stream s = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
MainLog.Instance.Debug("ASSETCACHE", "Querying for {0}", assetID.ToString());
|
MainLog.Instance.Debug("ASSETCACHE", "Querying for {0}", req.AssetID.ToString());
|
||||||
|
|
||||||
RestClient rc = new RestClient(_assetServerUrl);
|
RestClient rc = new RestClient(_assetServerUrl);
|
||||||
rc.AddResourcePath("assets");
|
rc.AddResourcePath("assets");
|
||||||
rc.AddResourcePath(assetID.ToString());
|
rc.AddResourcePath(req.AssetID.ToString());
|
||||||
if (isTexture)
|
if (req.IsTexture)
|
||||||
rc.AddQueryParameter("texture");
|
rc.AddQueryParameter("texture");
|
||||||
|
|
||||||
rc.RequestMethod = "GET";
|
rc.RequestMethod = "GET";
|
||||||
|
@ -71,30 +72,34 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
if (s.Length > 0)
|
if (s.Length > 0)
|
||||||
{
|
{
|
||||||
XmlSerializer xs = new XmlSerializer(typeof(AssetBase));
|
XmlSerializer xs = new XmlSerializer(typeof(AssetBase));
|
||||||
AssetBase asset = (AssetBase) xs.Deserialize(s);
|
AssetBase newAsset = (AssetBase)xs.Deserialize(s);
|
||||||
|
|
||||||
_receiver.AssetReceived(asset, isTexture);
|
_receiver.AssetReceived(newAsset, req.IsTexture);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MainLog.Instance.Debug("ASSETCACHE", "Asset not found {0}", assetID.ToString());
|
MainLog.Instance.Debug("ASSETCACHE", "Asset not found {0}", req.AssetID.ToString());
|
||||||
_receiver.AssetNotFound(assetID);
|
_receiver.AssetNotFound(req.AssetID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
MainLog.Instance.Error("ASSETCACHE", e.Message);
|
MainLog.Instance.Error("ASSETCACHE", e.Message);
|
||||||
MainLog.Instance.Debug("ASSETCACHE", "Getting asset {0}", assetID.ToString());
|
MainLog.Instance.Debug("ASSETCACHE", "Getting asset {0}", req.AssetID.ToString());
|
||||||
MainLog.Instance.Error("ASSETCACHE", e.StackTrace);
|
MainLog.Instance.Error("ASSETCACHE", e.StackTrace);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateAsset(AssetBase asset)
|
|
||||||
|
|
||||||
|
public override void UpdateAsset(AssetBase asset)
|
||||||
{
|
{
|
||||||
throw new Exception("The method or operation is not implemented.");
|
throw new Exception("The method or operation is not implemented.");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StoreAndCommitAsset(AssetBase asset)
|
protected override void StoreAsset(AssetBase asset)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -113,40 +118,16 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Close()
|
protected override void CommitAssets()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Close()
|
||||||
{
|
{
|
||||||
throw new Exception("The method or operation is not implemented.");
|
throw new Exception("The method or operation is not implemented.");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LoadAsset(AssetBase info, bool image, string filename)
|
|
||||||
{
|
|
||||||
throw new Exception("The method or operation is not implemented.");
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<AssetBase> GetDefaultAssets()
|
|
||||||
{
|
|
||||||
throw new Exception("The method or operation is not implemented.");
|
|
||||||
}
|
|
||||||
|
|
||||||
public AssetBase CreateImageAsset(string assetIdStr, string name, string filename)
|
|
||||||
{
|
|
||||||
throw new Exception("The method or operation is not implemented.");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ForEachDefaultAsset(Action<AssetBase> action)
|
|
||||||
{
|
|
||||||
throw new Exception("The method or operation is not implemented.");
|
|
||||||
}
|
|
||||||
|
|
||||||
public AssetBase CreateAsset(string assetIdStr, string name, string filename, bool isImage)
|
|
||||||
{
|
|
||||||
throw new Exception("The method or operation is not implemented.");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ForEachXmlAsset(Action<AssetBase> action)
|
|
||||||
{
|
|
||||||
throw new Exception("The method or operation is not implemented.");
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue