aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Framework/Communications/Cache/AssetCache.cs171
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.cs1
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneXmlLoader.cs5
4 files changed, 104 insertions, 75 deletions
diff --git a/OpenSim/Framework/Communications/Cache/AssetCache.cs b/OpenSim/Framework/Communications/Cache/AssetCache.cs
index b793b62..0904823 100644
--- a/OpenSim/Framework/Communications/Cache/AssetCache.cs
+++ b/OpenSim/Framework/Communications/Cache/AssetCache.cs
@@ -81,8 +81,8 @@ namespace OpenSim.Framework.Communications.Cache
81 long imageBytes = 0; 81 long imageBytes = 0;
82 long assetBytes = 0; 82 long assetBytes = 0;
83 83
84 84
85 85
86 86
87 foreach (TextureImage texture in Textures.Values) 87 foreach (TextureImage texture in Textures.Values)
88 { 88 {
@@ -109,8 +109,8 @@ namespace OpenSim.Framework.Communications.Cache
109 temporaryAssets); 109 temporaryAssets);
110 110
111 m_log.InfoFormat("Image data: {0}kb Asset data: {1}kb", 111 m_log.InfoFormat("Image data: {0}kb Asset data: {1}kb",
112 imageBytes/1024, 112 imageBytes / 1024,
113 assetBytes/1024); 113 assetBytes / 1024);
114 114
115 } 115 }
116 116
@@ -141,7 +141,6 @@ namespace OpenSim.Framework.Communications.Cache
141 m_assetServer = assetServer; 141 m_assetServer = assetServer;
142 m_assetServer.SetReceiver(this); 142 m_assetServer.SetReceiver(this);
143 143
144
145 m_assetCacheThread = new Thread(new ThreadStart(RunAssetManager)); 144 m_assetCacheThread = new Thread(new ThreadStart(RunAssetManager));
146 m_assetCacheThread.Name = "AssetCacheThread"; 145 m_assetCacheThread.Name = "AssetCacheThread";
147 m_assetCacheThread.IsBackground = true; 146 m_assetCacheThread.IsBackground = true;
@@ -170,59 +169,72 @@ namespace OpenSim.Framework.Communications.Cache
170 /// <summary> 169 /// <summary>
171 /// Only get an asset if we already have it in the cache. 170 /// Only get an asset if we already have it in the cache.
172 /// </summary> 171 /// </summary>
173 /// <param name="assetID"></param></param> 172 /// <param name="assetId"></param></param>
174 /// <returns></returns> 173 /// <returns></returns>
175 private AssetBase GetCachedAsset(LLUUID assetID) 174 //private AssetBase GetCachedAsset(LLUUID assetId)
175 //{
176 // AssetBase asset = null;
177
178 // if (Textures.ContainsKey(assetId))
179 // {
180 // asset = Textures[assetId];
181 // }
182 // else if (Assets.ContainsKey(assetId))
183 // {
184 // asset = Assets[assetId];
185 // }
186
187 // return asset;
188 //}
189
190 private bool TryGetCachedAsset(LLUUID assetId, out AssetBase asset)
176 { 191 {
177 AssetBase asset = null; 192 if (Textures.ContainsKey(assetId))
178 if (Textures.ContainsKey(assetID))
179 { 193 {
180 asset = Textures[assetID]; 194 asset = Textures[assetId];
195 return true;
181 } 196 }
182 else if (Assets.ContainsKey(assetID)) 197 else if (Assets.ContainsKey(assetId))
183 { 198 {
184 asset = Assets[assetID]; 199 asset = Assets[assetId];
200 return true;
185 } 201 }
186 return asset; 202
203 asset = null;
204 return false;
187 } 205 }
188 206
189 public void GetAsset(LLUUID assetID, AssetRequestCallback callback) 207 public void GetAsset(LLUUID assetId, AssetRequestCallback callback)
190 { 208 {
191 AssetBase asset = null; 209 AssetBase asset;
192 if (Textures.ContainsKey(assetID))
193 {
194 asset = Textures[assetID];
195 }
196 else if (Assets.ContainsKey(assetID))
197 {
198 asset = Assets[assetID];
199 }
200 210
201 if (asset != null) 211 if (TryGetCachedAsset(assetId, out asset))
202 { 212 {
203 callback(assetID, asset); 213
214 callback(assetId, asset);
204 } 215 }
205 else 216 else
206 { 217 {
207 NewAssetRequest req = new NewAssetRequest(assetID, callback); 218 NewAssetRequest req = new NewAssetRequest(assetId, callback);
208 219
209 AssetRequestsList requestList; 220 AssetRequestsList requestList;
210 221
211 lock (RequestLists) 222 lock (RequestLists)
212 { 223 {
213 if (RequestLists.TryGetValue(assetID, out requestList)) 224 if (RequestLists.TryGetValue(assetId, out requestList))
214 { 225 {
215 } 226 }
216 else 227 else
217 { 228 {
218 requestList = new AssetRequestsList(assetID); 229 requestList = new AssetRequestsList(assetId);
219 RequestLists.Add(assetID, requestList); 230 RequestLists.Add(assetId, requestList);
220 } 231 }
221 } 232 }
222 233
234 m_log.DebugFormat("[ASSETCACHE]: Added request for asset {0}", assetId);
223 requestList.Requests.Add(req); 235 requestList.Requests.Add(req);
224 236
225 m_assetServer.RequestAsset(assetID, false); 237 m_assetServer.RequestAsset(assetId, false);
226 } 238 }
227 } 239 }
228 240
@@ -248,28 +260,30 @@ namespace OpenSim.Framework.Communications.Cache
248 int pollPeriod = 200; 260 int pollPeriod = 200;
249 int maxPolls = 15; 261 int maxPolls = 15;
250 262
251 AssetBase asset = GetCachedAsset(assetID); 263 AssetBase asset;
252 if (asset != null)
253 {
254 return asset;
255 }
256
257 m_assetServer.RequestAsset(assetID, isTexture);
258 264
259 do 265 if (TryGetCachedAsset(assetID, out asset))
260 { 266 {
261 Thread.Sleep(pollPeriod); 267 m_assetServer.RequestAsset(assetID, isTexture);
262 268
263 asset = GetCachedAsset(assetID); 269 do
264 if (asset != null)
265 { 270 {
266 return asset; 271 Thread.Sleep(pollPeriod);
267 }
268 } while (--maxPolls > 0);
269 272
270 m_log.WarnFormat("[ASSETCACHE]: Asset {0} was not received before the retrieval timeout was reached", assetID.ToString()); 273 if (TryGetCachedAsset(assetID, out asset))
274 {
275 return asset;
276 }
277 } while (--maxPolls > 0);
271 278
272 return null; 279 m_log.WarnFormat("[ASSETCACHE]: Asset {0} was not received before the retrieval timeout was reached", assetID.ToString());
280
281 return null;
282 }
283 else
284 {
285 return asset;
286 }
273 } 287 }
274 288
275 /// <summary> 289 /// <summary>
@@ -337,26 +351,26 @@ namespace OpenSim.Framework.Communications.Cache
337 m_log.InfoFormat("[ASSETCACHE]: Adding {0} {1} [{2}]: {3}.", temporary, type, asset.FullID, result); 351 m_log.InfoFormat("[ASSETCACHE]: Adding {0} {1} [{2}]: {3}.", temporary, type, asset.FullID, result);
338 } 352 }
339 353
340 public void DeleteAsset(LLUUID assetID)
341 {
342 // this.m_assetServer.DeleteAsset(assetID);
343
344 //Todo should delete it from memory too
345 }
346
347 public AssetBase CopyAsset(LLUUID assetID) 354 public AssetBase CopyAsset(LLUUID assetID)
348 { 355 {
349 AssetBase asset = GetCachedAsset(assetID); 356 AssetBase asset;
350 if (asset == null)
351 return null;
352 357
353 asset.FullID = LLUUID.Random(); // TODO: check for conflicts 358 if (TryGetCachedAsset(assetID, out asset))
354 AddAsset(asset); 359 {
355 return asset; 360 asset.FullID = LLUUID.Random(); // TODO: check for conflicts
361 AddAsset(asset);
362 return asset;
363 }
364 else
365 {
366 return null;
367 }
356 } 368 }
357 369
358 public void AssetReceived(AssetBase asset, bool IsTexture) 370 public void AssetReceived(AssetBase asset, bool IsTexture)
359 { 371 {
372 m_log.InfoFormat("[ASSETCACHE]: Recieved {0} [{1}]", IsTexture ? "texture" : "asset", asset.FullID);
373
360 if (asset.FullID != LLUUID.Zero) // if it is set to zero then the asset wasn't found by the server 374 if (asset.FullID != LLUUID.Zero) // if it is set to zero then the asset wasn't found by the server
361 { 375 {
362 //check if it is a texture or not 376 //check if it is a texture or not
@@ -366,18 +380,24 @@ namespace OpenSim.Framework.Communications.Cache
366 380
367 if (IsTexture) 381 if (IsTexture)
368 { 382 {
369 //Console.WriteLine("asset received from asset server");
370
371 TextureImage image = new TextureImage(asset); 383 TextureImage image = new TextureImage(asset);
372 if (!Textures.ContainsKey(image.FullID)) 384 if (Textures.ContainsKey(image.FullID))
385 {
386 m_log.InfoFormat("[ASSETCACHE]: There's already an texture {0} in memory. Skipping.", asset.FullID);
387 }
388 else
373 { 389 {
374 Textures.Add(image.FullID, image); 390 Textures.Add(image.FullID, image);
375 391
376 if (StatsManager.SimExtraStats != null) 392 if (StatsManager.SimExtraStats != null)
393 {
377 StatsManager.SimExtraStats.AddTexture(image); 394 StatsManager.SimExtraStats.AddTexture(image);
395 }
378 396
379 if (RequestedTextures.ContainsKey(image.FullID)) 397 if (RequestedTextures.ContainsKey(image.FullID))
380 { 398 {
399 m_log.InfoFormat("[ASSETCACHE]: Moving {0} from RequestedTextures to TextureRequests", asset.FullID);
400
381 AssetRequest req = RequestedTextures[image.FullID]; 401 AssetRequest req = RequestedTextures[image.FullID];
382 req.ImageInfo = image; 402 req.ImageInfo = image;
383 403
@@ -391,18 +411,27 @@ namespace OpenSim.Framework.Communications.Cache
391 else 411 else
392 { 412 {
393 AssetInfo assetInf = new AssetInfo(asset); 413 AssetInfo assetInf = new AssetInfo(asset);
394 if (!Assets.ContainsKey(assetInf.FullID)) 414 if (Assets.ContainsKey(assetInf.FullID))
415 {
416 m_log.InfoFormat("[ASSETCACHE]: There's already an asset {0} in memory. Skipping.", asset.FullID);
417 }
418 else
395 { 419 {
396 Assets.Add(assetInf.FullID, assetInf); 420 Assets.Add(assetInf.FullID, assetInf);
397 421
398 if (StatsManager.SimExtraStats != null) 422 if (StatsManager.SimExtraStats != null)
423 {
399 StatsManager.SimExtraStats.AddAsset(assetInf); 424 StatsManager.SimExtraStats.AddAsset(assetInf);
425 }
400 426
401 if (RequestedAssets.ContainsKey(assetInf.FullID)) 427 if (RequestedAssets.ContainsKey(assetInf.FullID))
402 { 428 {
429 m_log.InfoFormat("[ASSETCACHE]: Moving {0} from RequestedAssets to AssetRequests", asset.FullID);
430
403 AssetRequest req = RequestedAssets[assetInf.FullID]; 431 AssetRequest req = RequestedAssets[assetInf.FullID];
404 req.AssetInf = assetInf; 432 req.AssetInf = assetInf;
405 req.NumPackets = CalculateNumPackets(assetInf.Data); 433 req.NumPackets = CalculateNumPackets(assetInf.Data);
434
406 RequestedAssets.Remove(assetInf.FullID); 435 RequestedAssets.Remove(assetInf.FullID);
407 AssetRequests.Add(req); 436 AssetRequests.Add(req);
408 } 437 }
@@ -411,14 +440,14 @@ namespace OpenSim.Framework.Communications.Cache
411 440
412 if (RequestLists.ContainsKey(asset.FullID)) 441 if (RequestLists.ContainsKey(asset.FullID))
413 { 442 {
414 AssetRequestsList reqList = RequestLists[asset.FullID];
415 foreach (NewAssetRequest req in reqList.Requests)
416 {
417 req.Callback(asset.FullID, asset);
418 }
419
420 lock (RequestLists) 443 lock (RequestLists)
421 { 444 {
445 AssetRequestsList reqList = RequestLists[asset.FullID];
446 foreach (NewAssetRequest req in reqList.Requests)
447 {
448 req.Callback(asset.FullID, asset);
449 }
450
422 RequestLists.Remove(asset.FullID); 451 RequestLists.Remove(asset.FullID);
423 reqList.Requests.Clear(); 452 reqList.Requests.Clear();
424 } 453 }
@@ -428,6 +457,8 @@ namespace OpenSim.Framework.Communications.Cache
428 457
429 public void AssetNotFound(LLUUID assetID) 458 public void AssetNotFound(LLUUID assetID)
430 { 459 {
460 m_log.ErrorFormat("[ASSET CACHE]: Unhandled AssetNotFound for {0}", assetID);
461
431 //if (this.RequestedTextures.ContainsKey(assetID)) 462 //if (this.RequestedTextures.ContainsKey(assetID))
432 //{ 463 //{
433 // m_log.WarnFormat("[ASSET CACHE]: sending image not found for {0}", assetID); 464 // m_log.WarnFormat("[ASSET CACHE]: sending image not found for {0}", assetID);
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index 91b9a61..b13a702 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -352,8 +352,6 @@ namespace OpenSim.Region.Environment.Scenes
352 sr.Close(); 352 sr.Close();
353 353
354 UpdateParentIDs(); 354 UpdateParentIDs();
355
356 ScheduleGroupForFullUpdate();
357 } 355 }
358 356
359 private void AttachToBackup() 357 private void AttachToBackup()
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
index a522380..650f549 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -543,7 +543,6 @@ namespace OpenSim.Region.Environment.Scenes
543 set 543 set
544 { 544 {
545 m_clickAction = value; 545 m_clickAction = value;
546 ScheduleFullUpdate();
547 } 546 }
548 } 547 }
549 548
diff --git a/OpenSim/Region/Environment/Scenes/SceneXmlLoader.cs b/OpenSim/Region/Environment/Scenes/SceneXmlLoader.cs
index 4982613..2b05bb6 100644
--- a/OpenSim/Region/Environment/Scenes/SceneXmlLoader.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneXmlLoader.cs
@@ -193,9 +193,10 @@ namespace OpenSim.Region.Environment.Scenes
193 new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X, 193 new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X,
194 rootPart.RotationOffset.Y, rootPart.RotationOffset.Z), UsePhysics); 194 rootPart.RotationOffset.Y, rootPart.RotationOffset.Z), UsePhysics);
195 rootPart.DoPhysicsPropertyUpdate(UsePhysics, true); 195 rootPart.DoPhysicsPropertyUpdate(UsePhysics, true);
196 rootPart.Velocity = receivedVelocity; 196 rootPart.Velocity = receivedVelocity;
197
198 } 197 }
198
199 obj.ScheduleGroupForFullUpdate();
199 } 200 }
200 201
201 public void SavePrimsToXml2(string fileName) 202 public void SavePrimsToXml2(string fileName)