aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Communications
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Communications')
-rw-r--r--OpenSim/Framework/Communications/Cache/AssetCache.cs22
1 files changed, 9 insertions, 13 deletions
diff --git a/OpenSim/Framework/Communications/Cache/AssetCache.cs b/OpenSim/Framework/Communications/Cache/AssetCache.cs
index 7d06a1e..bd0b1b1 100644
--- a/OpenSim/Framework/Communications/Cache/AssetCache.cs
+++ b/OpenSim/Framework/Communications/Cache/AssetCache.cs
@@ -350,7 +350,7 @@ namespace OpenSim.Framework.Communications.Cache
350 // If it's a direct request for a script, drop it 350 // If it's a direct request for a script, drop it
351 // because it's a hacked client 351 // because it's a hacked client
352 if (req.AssetRequestSource != 2 || assetInf.Type != 10) 352 if (req.AssetRequestSource != 2 || assetInf.Type != 10)
353 AssetRequests.Add(req); 353 lock(AssetRequests) AssetRequests.Add(req);
354 } 354 }
355 } 355 }
356 356
@@ -487,7 +487,7 @@ namespace OpenSim.Framework.Communications.Cache
487 req.Params = transferRequest.TransferInfo.Params; 487 req.Params = transferRequest.TransferInfo.Params;
488 req.AssetInf = new AssetInfo(asset); 488 req.AssetInf = new AssetInfo(asset);
489 req.NumPackets = CalculateNumPackets(asset.Data); 489 req.NumPackets = CalculateNumPackets(asset.Data);
490 AssetRequests.Add(req); 490 lock(AssetRequests) AssetRequests.Add(req);
491 } 491 }
492 492
493 /// <summary> 493 /// <summary>
@@ -506,16 +506,16 @@ namespace OpenSim.Framework.Communications.Cache
506 int num = Math.Min(5, AssetRequests.Count); 506 int num = Math.Min(5, AssetRequests.Count);
507 507
508 AssetRequest req; 508 AssetRequest req;
509 AssetRequestToClient req2 = null; 509 AssetRequestToClient req2 = new AssetRequestToClient();
510
510 for (int i = 0; i < num; i++) 511 for (int i = 0; i < num; i++)
511 { 512 {
512 req = AssetRequests[i]; 513 lock(AssetRequests)
513 if (req2 == null)
514 { 514 {
515 req2 = new AssetRequestToClient(); 515 req = AssetRequests[0];
516 AssetRequests.RemoveAt(0);
516 } 517 }
517 518
518 // Trying to limit memory usage by only creating AssetRequestToClient if needed
519 req2.AssetInf = req.AssetInf; 519 req2.AssetInf = req.AssetInf;
520 req2.AssetRequestSource = req.AssetRequestSource; 520 req2.AssetRequestSource = req.AssetRequestSource;
521 req2.DataPointer = req.DataPointer; 521 req2.DataPointer = req.DataPointer;
@@ -528,13 +528,9 @@ namespace OpenSim.Framework.Communications.Cache
528 req2.RequestAssetID = req.RequestAssetID; 528 req2.RequestAssetID = req.RequestAssetID;
529 req2.TransferRequestID = req.TransferRequestID; 529 req2.TransferRequestID = req.TransferRequestID;
530 req.RequestUser.SendAsset(req2); 530 req.RequestUser.SendAsset(req2);
531 }
532 531
533 //remove requests that have been completed
534 for (int i = 0; i < num; i++)
535 {
536 AssetRequests.RemoveAt(0);
537 } 532 }
533
538 } 534 }
539 535
540 public class AssetRequest 536 public class AssetRequest