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);
|
||||
}
|
||||
|
||||
public void UpdateAsset(AssetBase asset)
|
||||
public virtual void UpdateAsset(AssetBase asset)
|
||||
{
|
||||
lock (syncLock)
|
||||
{
|
||||
|
|
|
@ -35,10 +35,9 @@ using OpenSim.Framework.Console;
|
|||
|
||||
namespace OpenSim.Framework.Communications.Cache
|
||||
{
|
||||
public class GridAssetClient : IAssetServer
|
||||
public class GridAssetClient : AssetServerBase
|
||||
{
|
||||
private string _assetServerUrl;
|
||||
private IAssetReceiver _receiver;
|
||||
|
||||
public GridAssetClient(string serverUrl)
|
||||
{
|
||||
|
@ -47,54 +46,60 @@ namespace OpenSim.Framework.Communications.Cache
|
|||
|
||||
#region IAssetServer Members
|
||||
|
||||
public void SetReceiver(IAssetReceiver receiver)
|
||||
protected override void RunRequests()
|
||||
{
|
||||
_receiver = receiver;
|
||||
}
|
||||
|
||||
public void FetchAsset(LLUUID assetID, bool isTexture)
|
||||
{
|
||||
Stream s = null;
|
||||
try
|
||||
while (true)
|
||||
{
|
||||
MainLog.Instance.Debug("ASSETCACHE", "Querying for {0}", assetID.ToString());
|
||||
ARequest req = _assetRequests.Dequeue();
|
||||
|
||||
RestClient rc = new RestClient(_assetServerUrl);
|
||||
rc.AddResourcePath("assets");
|
||||
rc.AddResourcePath(assetID.ToString());
|
||||
if (isTexture)
|
||||
rc.AddQueryParameter("texture");
|
||||
//MainLog.Instance.Verbose("AssetStorage","Requesting asset: " + req.AssetID);
|
||||
|
||||
rc.RequestMethod = "GET";
|
||||
s = rc.Request();
|
||||
|
||||
if (s.Length > 0)
|
||||
Stream s = null;
|
||||
try
|
||||
{
|
||||
XmlSerializer xs = new XmlSerializer(typeof (AssetBase));
|
||||
AssetBase asset = (AssetBase) xs.Deserialize(s);
|
||||
MainLog.Instance.Debug("ASSETCACHE", "Querying for {0}", req.AssetID.ToString());
|
||||
|
||||
_receiver.AssetReceived(asset, isTexture);
|
||||
RestClient rc = new RestClient(_assetServerUrl);
|
||||
rc.AddResourcePath("assets");
|
||||
rc.AddResourcePath(req.AssetID.ToString());
|
||||
if (req.IsTexture)
|
||||
rc.AddQueryParameter("texture");
|
||||
|
||||
rc.RequestMethod = "GET";
|
||||
s = rc.Request();
|
||||
|
||||
if (s.Length > 0)
|
||||
{
|
||||
XmlSerializer xs = new XmlSerializer(typeof(AssetBase));
|
||||
AssetBase newAsset = (AssetBase)xs.Deserialize(s);
|
||||
|
||||
_receiver.AssetReceived(newAsset, req.IsTexture);
|
||||
}
|
||||
else
|
||||
{
|
||||
MainLog.Instance.Debug("ASSETCACHE", "Asset not found {0}", req.AssetID.ToString());
|
||||
_receiver.AssetNotFound(req.AssetID);
|
||||
}
|
||||
}
|
||||
else
|
||||
catch (Exception e)
|
||||
{
|
||||
MainLog.Instance.Debug("ASSETCACHE", "Asset not found {0}", assetID.ToString());
|
||||
_receiver.AssetNotFound(assetID);
|
||||
MainLog.Instance.Error("ASSETCACHE", e.Message);
|
||||
MainLog.Instance.Debug("ASSETCACHE", "Getting asset {0}", req.AssetID.ToString());
|
||||
MainLog.Instance.Error("ASSETCACHE", e.StackTrace);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MainLog.Instance.Error("ASSETCACHE", e.Message);
|
||||
MainLog.Instance.Debug("ASSETCACHE", "Getting asset {0}", assetID.ToString());
|
||||
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.");
|
||||
}
|
||||
|
||||
public void StoreAndCommitAsset(AssetBase asset)
|
||||
protected override void StoreAsset(AssetBase asset)
|
||||
{
|
||||
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.");
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue