diff options
author | Justin Clarke Casey | 2007-12-22 19:48:01 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2007-12-22 19:48:01 +0000 |
commit | c470efea5734e4515baaf9023f2f2b2cd724725c (patch) | |
tree | 23c6c1d80fe1c8995644c2e51002290de7216048 /OpenSim/Framework | |
parent | minor refactor (diff) | |
download | opensim-SC-c470efea5734e4515baaf9023f2f2b2cd724725c.zip opensim-SC-c470efea5734e4515baaf9023f2f2b2cd724725c.tar.gz opensim-SC-c470efea5734e4515baaf9023f2f2b2cd724725c.tar.bz2 opensim-SC-c470efea5734e4515baaf9023f2f2b2cd724725c.tar.xz |
Make copying of scripts into prim inventories more reliable on the first attempt when the asset server is lagging by formalising the de facto polling.
This may not be the best solution in the long run, but should improve things for now.
This may also improve reliability when updating inventory item metadata (e.g. renaming an item) and in retrieving textures
for the main map view.
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r-- | OpenSim/Framework/Communications/Cache/AssetCache.cs | 48 | ||||
-rw-r--r-- | OpenSim/Framework/IClientAPI.cs | 9 |
2 files changed, 52 insertions, 5 deletions
diff --git a/OpenSim/Framework/Communications/Cache/AssetCache.cs b/OpenSim/Framework/Communications/Cache/AssetCache.cs index d1ff9c9..4765548 100644 --- a/OpenSim/Framework/Communications/Cache/AssetCache.cs +++ b/OpenSim/Framework/Communications/Cache/AssetCache.cs | |||
@@ -156,16 +156,58 @@ namespace OpenSim.Framework.Communications.Cache | |||
156 | } | 156 | } |
157 | } | 157 | } |
158 | 158 | ||
159 | /// <summary> | ||
160 | /// Get an asset. If the asset isn't in the cache, a request will be made to the persistent store to | ||
161 | /// load it into the cache. | ||
162 | /// | ||
163 | /// XXX We'll keep polling the cache until we get the asset or we exceed | ||
164 | /// the allowed number of polls. This isn't a very good way of doing things since a single thread | ||
165 | /// is processing inbound packets, so if the asset server is slow, we could block this for up to | ||
166 | /// the timeout period. What we might want to do is register asynchronous callbacks on asset | ||
167 | /// receipt in the same manner as the nascent (but not yet active) TextureDownloadModule. Of course, | ||
168 | /// a timeout before asset receipt usually isn't fatal, the operation will work on the retry when the | ||
169 | /// asset is much more likely to have made it into the cache. | ||
170 | /// </summary> | ||
171 | /// <param name="assetID"></param> | ||
172 | /// <param name="isTexture"></param> | ||
173 | /// <returns>null if the asset could not be retrieved</returns> | ||
159 | public AssetBase GetAsset(LLUUID assetID, bool isTexture) | 174 | public AssetBase GetAsset(LLUUID assetID, bool isTexture) |
160 | { | 175 | { |
176 | // I'm not going over 3 seconds since this will be blocking processing of all the other inbound | ||
177 | // packets from the client. | ||
178 | int pollPeriod = 200; | ||
179 | int maxPolls = 15; | ||
180 | |||
161 | AssetBase asset = GetCachedAsset(assetID); | 181 | AssetBase asset = GetCachedAsset(assetID); |
162 | if (asset == null) | 182 | if (asset != null) |
163 | { | 183 | { |
164 | m_assetServer.RequestAsset(assetID, isTexture); | 184 | return asset; |
165 | } | 185 | } |
166 | return asset; | 186 | |
187 | m_assetServer.RequestAsset(assetID, isTexture); | ||
188 | |||
189 | do | ||
190 | { | ||
191 | Thread.Sleep(pollPeriod); | ||
192 | |||
193 | asset = GetCachedAsset(assetID); | ||
194 | if (asset != null) | ||
195 | { | ||
196 | return asset; | ||
197 | } | ||
198 | } | ||
199 | while (--maxPolls > 0); | ||
200 | |||
201 | MainLog.Instance.Warn( | ||
202 | "ASSETCACHE", "Asset {0} was not received before the retrieval timeout was reached"); | ||
203 | |||
204 | return null; | ||
167 | } | 205 | } |
168 | 206 | ||
207 | /// <summary> | ||
208 | /// Add an asset to both the persistent store and the cache. | ||
209 | /// </summary> | ||
210 | /// <param name="asset"></param> | ||
169 | public void AddAsset(AssetBase asset) | 211 | public void AddAsset(AssetBase asset) |
170 | { | 212 | { |
171 | string temporary = asset.Temporary ? "temporary" : ""; | 213 | string temporary = asset.Temporary ? "temporary" : ""; |
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 8ba161a..18ecd92 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs | |||
@@ -473,8 +473,6 @@ namespace OpenSim.Framework | |||
473 | event RegionInfoRequest OnRegionInfoRequest; | 473 | event RegionInfoRequest OnRegionInfoRequest; |
474 | event EstateCovenantRequest OnEstateCovenantRequest; | 474 | event EstateCovenantRequest OnEstateCovenantRequest; |
475 | 475 | ||
476 | |||
477 | |||
478 | LLVector3 StartPos { get; set; } | 476 | LLVector3 StartPos { get; set; } |
479 | 477 | ||
480 | LLUUID AgentId { get; } | 478 | LLUUID AgentId { get; } |
@@ -486,6 +484,13 @@ namespace OpenSim.Framework | |||
486 | string FirstName { get; } | 484 | string FirstName { get; } |
487 | 485 | ||
488 | string LastName { get; } | 486 | string LastName { get; } |
487 | |||
488 | /// <summary> | ||
489 | /// Returns the full name of the agent/avatar represented by this client | ||
490 | /// </summary> | ||
491 | /// <param name="newPack"></param> | ||
492 | /// <param name="packType"></param> | ||
493 | string Name { get; } | ||
489 | 494 | ||
490 | uint CircuitCode { get; } | 495 | uint CircuitCode { get; } |
491 | 496 | ||