diff options
author | Justin Clarke Casey | 2009-04-14 17:44:10 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2009-04-14 17:44:10 +0000 |
commit | e1c449b492a08b95e9f4ea0556b6ec77f32ef0e7 (patch) | |
tree | b2a678fcd49554c33ca354590cebb0b8ced34896 /OpenSim/Framework/Communications/Cache/AssetServerBase.cs | |
parent | Changing the CAP seed to be the string representation of a full UUID, instead... (diff) | |
download | opensim-SC-e1c449b492a08b95e9f4ea0556b6ec77f32ef0e7.zip opensim-SC-e1c449b492a08b95e9f4ea0556b6ec77f32ef0e7.tar.gz opensim-SC-e1c449b492a08b95e9f4ea0556b6ec77f32ef0e7.tar.bz2 opensim-SC-e1c449b492a08b95e9f4ea0556b6ec77f32ef0e7.tar.xz |
* Change simple asset cache test to manually pump the asset server rather than relying on another thread
Diffstat (limited to 'OpenSim/Framework/Communications/Cache/AssetServerBase.cs')
-rw-r--r-- | OpenSim/Framework/Communications/Cache/AssetServerBase.cs | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/OpenSim/Framework/Communications/Cache/AssetServerBase.cs b/OpenSim/Framework/Communications/Cache/AssetServerBase.cs index 343667a..24cb598 100644 --- a/OpenSim/Framework/Communications/Cache/AssetServerBase.cs +++ b/OpenSim/Framework/Communications/Cache/AssetServerBase.cs | |||
@@ -138,14 +138,29 @@ namespace OpenSim.Framework.Communications.Cache | |||
138 | /// asset cannot be found. | 138 | /// asset cannot be found. |
139 | /// </exception> | 139 | /// </exception> |
140 | protected abstract AssetBase GetAsset(AssetRequest req); | 140 | protected abstract AssetBase GetAsset(AssetRequest req); |
141 | 141 | ||
142 | /// <summary> | ||
143 | /// Does the asset server have any waiting requests? | ||
144 | /// </summary> | ||
145 | /// | ||
146 | /// This does include any request that is currently being handled. This information is not reliable where | ||
147 | /// another thread may be processing requests. | ||
148 | /// | ||
149 | /// <returns> | ||
150 | /// True if there are waiting requests. False if there are no waiting requests. | ||
151 | /// </returns> | ||
152 | public virtual bool HasWaitingRequests() | ||
153 | { | ||
154 | return m_assetRequests.Count() != 0; | ||
155 | } | ||
156 | |||
142 | /// <summary> | 157 | /// <summary> |
143 | /// Process an asset request. This method will call GetAsset(AssetRequest req) | 158 | /// Process an asset request. This method will call GetAsset(AssetRequest req) |
144 | /// on the subclass. | 159 | /// on the subclass. |
145 | /// </summary> | 160 | /// </summary> |
146 | /// <param name="req"></param> | 161 | public virtual void ProcessNextRequest() |
147 | protected virtual void ProcessRequest(AssetRequest req) | ||
148 | { | 162 | { |
163 | AssetRequest req = m_assetRequests.Dequeue(); | ||
149 | AssetBase asset; | 164 | AssetBase asset; |
150 | 165 | ||
151 | try | 166 | try |
@@ -160,7 +175,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
160 | StatsManager.SimExtraStats.AddAssetServiceRequestFailure(); | 175 | StatsManager.SimExtraStats.AddAssetServiceRequestFailure(); |
161 | 176 | ||
162 | m_receiver.AssetNotFound(req.AssetID, req.IsTexture); | 177 | m_receiver.AssetNotFound(req.AssetID, req.IsTexture); |
163 | 178 | ||
164 | return; | 179 | return; |
165 | } | 180 | } |
166 | 181 | ||
@@ -190,10 +205,8 @@ namespace OpenSim.Framework.Communications.Cache | |||
190 | while (true) // Since it's a 'blocking queue' | 205 | while (true) // Since it's a 'blocking queue' |
191 | { | 206 | { |
192 | try | 207 | try |
193 | { | 208 | { |
194 | AssetRequest req = m_assetRequests.Dequeue(); | 209 | ProcessNextRequest(); |
195 | |||
196 | ProcessRequest(req); | ||
197 | } | 210 | } |
198 | catch (Exception e) | 211 | catch (Exception e) |
199 | { | 212 | { |