aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/Communications/Cache/AssetServer.cs8
-rw-r--r--OpenSim/Framework/Communications/Cache/AssetServerBase.cs37
-rw-r--r--OpenSim/Framework/Communications/Cache/GridAssetClient.cs14
-rw-r--r--OpenSim/Framework/Communications/Cache/SQLAssetServer.cs12
4 files changed, 46 insertions, 25 deletions
diff --git a/OpenSim/Framework/Communications/Cache/AssetServer.cs b/OpenSim/Framework/Communications/Cache/AssetServer.cs
index 00c2b2a..4ad0f60 100644
--- a/OpenSim/Framework/Communications/Cache/AssetServer.cs
+++ b/OpenSim/Framework/Communications/Cache/AssetServer.cs
@@ -72,7 +72,7 @@ namespace OpenSim.Framework.Communications.Cache
72 } 72 }
73 } 73 }
74 74
75 protected override void ProcessRequest(AssetRequest req) 75 protected override AssetBase _ProcessRequest(AssetRequest req)
76 { 76 {
77 byte[] idata = null; 77 byte[] idata = null;
78 bool found = false; 78 bool found = false;
@@ -93,12 +93,12 @@ namespace OpenSim.Framework.Communications.Cache
93 asset.Name = foundAsset.Name; 93 asset.Name = foundAsset.Name;
94 idata = foundAsset.Data; 94 idata = foundAsset.Data;
95 asset.Data = idata; 95 asset.Data = idata;
96 _receiver.AssetReceived(asset, req.IsTexture); 96
97 return asset;
97 } 98 }
98 else 99 else
99 { 100 {
100 //asset.FullID = ; 101 return null;
101 _receiver.AssetNotFound(req.AssetID);
102 } 102 }
103 } 103 }
104 104
diff --git a/OpenSim/Framework/Communications/Cache/AssetServerBase.cs b/OpenSim/Framework/Communications/Cache/AssetServerBase.cs
index 659b9c9..4d03fee 100644
--- a/OpenSim/Framework/Communications/Cache/AssetServerBase.cs
+++ b/OpenSim/Framework/Communications/Cache/AssetServerBase.cs
@@ -48,7 +48,38 @@ namespace OpenSim.Framework.Communications.Cache
48 protected abstract void StoreAsset(AssetBase asset); 48 protected abstract void StoreAsset(AssetBase asset);
49 protected abstract void CommitAssets(); 49 protected abstract void CommitAssets();
50 50
51 protected abstract void ProcessRequest(AssetRequest req); 51 /// <summary>
52 /// This method must be implemented by a subclass to retrieve the asset named in the
53 /// AssetRequest. If the asset is not found, null should be returned.
54 /// </summary>
55 /// <param name="req"></param>
56 /// <returns></returns>
57 protected abstract AssetBase _ProcessRequest(AssetRequest req);
58
59 /// <summary>
60 /// Process an asset request. This method will call _ProcessRequest(AssetRequest req)
61 /// on the subclass.
62 /// </summary>
63 /// <param name="req"></param>
64 protected void ProcessRequest(AssetRequest req)
65 {
66 AssetBase asset = _ProcessRequest(req);
67
68 if (asset != null)
69 {
70 MainLog.Instance.Verbose(
71 "ASSET", "Asset {0} received from asset server", req.AssetID);
72
73 _receiver.AssetReceived(asset, req.IsTexture);
74 }
75 else
76 {
77 MainLog.Instance.Error(
78 "ASSET", "Asset {0} not found by asset server", req.AssetID);
79
80 _receiver.AssetNotFound(req.AssetID);
81 }
82 }
52 83
53 public void LoadDefaultAssets() 84 public void LoadDefaultAssets()
54 { 85 {
@@ -117,9 +148,9 @@ namespace OpenSim.Framework.Communications.Cache
117 AssetRequest req = new AssetRequest(); 148 AssetRequest req = new AssetRequest();
118 req.AssetID = assetID; 149 req.AssetID = assetID;
119 req.IsTexture = isTexture; 150 req.IsTexture = isTexture;
120 MainLog.Instance.Verbose("ASSET","Adding {0} to request queue", assetID);
121 _assetRequests.Enqueue(req); 151 _assetRequests.Enqueue(req);
122 MainLog.Instance.Verbose("ASSET","Added {0} to request queue", assetID); 152
153 MainLog.Instance.Verbose("ASSET", "Added {0} to request queue", assetID);
123 } 154 }
124 155
125 public virtual void UpdateAsset(AssetBase asset) 156 public virtual void UpdateAsset(AssetBase asset)
diff --git a/OpenSim/Framework/Communications/Cache/GridAssetClient.cs b/OpenSim/Framework/Communications/Cache/GridAssetClient.cs
index 47104d7..5801aa8 100644
--- a/OpenSim/Framework/Communications/Cache/GridAssetClient.cs
+++ b/OpenSim/Framework/Communications/Cache/GridAssetClient.cs
@@ -47,7 +47,7 @@ namespace OpenSim.Framework.Communications.Cache
47 47
48 #region IAssetServer Members 48 #region IAssetServer Members
49 49
50 protected override void ProcessRequest(AssetRequest req) 50 protected override AssetBase _ProcessRequest(AssetRequest req)
51 { 51 {
52 Stream s = null; 52 Stream s = null;
53 try 53 try
@@ -66,14 +66,8 @@ namespace OpenSim.Framework.Communications.Cache
66 if (s.Length > 0) 66 if (s.Length > 0)
67 { 67 {
68 XmlSerializer xs = new XmlSerializer(typeof(AssetBase)); 68 XmlSerializer xs = new XmlSerializer(typeof(AssetBase));
69 AssetBase newAsset = (AssetBase)xs.Deserialize(s); 69
70 70 return (AssetBase)xs.Deserialize(s);
71 _receiver.AssetReceived(newAsset, req.IsTexture);
72 }
73 else
74 {
75 MainLog.Instance.Debug("ASSETCACHE", "Asset not found {0}", req.AssetID.ToString());
76 _receiver.AssetNotFound(req.AssetID);
77 } 71 }
78 } 72 }
79 catch (Exception e) 73 catch (Exception e)
@@ -82,6 +76,8 @@ namespace OpenSim.Framework.Communications.Cache
82 MainLog.Instance.Debug("ASSETCACHE", "Getting asset {0}", req.AssetID.ToString()); 76 MainLog.Instance.Debug("ASSETCACHE", "Getting asset {0}", req.AssetID.ToString());
83 MainLog.Instance.Error("ASSETCACHE", e.StackTrace); 77 MainLog.Instance.Error("ASSETCACHE", e.StackTrace);
84 } 78 }
79
80 return null;
85 } 81 }
86 82
87 83
diff --git a/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs b/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs
index 010581f..4fa7684 100644
--- a/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs
+++ b/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs
@@ -77,21 +77,15 @@ namespace OpenSim.Framework.Communications.Cache
77 m_assetProviderPlugin.CommitAssets(); 77 m_assetProviderPlugin.CommitAssets();
78 } 78 }
79 79
80 protected override void ProcessRequest(AssetRequest req) 80 protected override AssetBase _ProcessRequest(AssetRequest req)
81 { 81 {
82 AssetBase asset; 82 AssetBase asset;
83 lock (syncLock) 83 lock (syncLock)
84 { 84 {
85 asset = m_assetProviderPlugin.FetchAsset(req.AssetID); 85 asset = m_assetProviderPlugin.FetchAsset(req.AssetID);
86 } 86 }
87 if (asset != null) 87
88 { 88 return asset;
89 _receiver.AssetReceived(asset, req.IsTexture);
90 }
91 else
92 {
93 _receiver.AssetNotFound(req.AssetID);
94 }
95 } 89 }
96 90
97 protected override void StoreAsset(AssetBase asset) 91 protected override void StoreAsset(AssetBase asset)