aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
authorSean Dague2009-04-23 17:53:18 +0000
committerSean Dague2009-04-23 17:53:18 +0000
commit7943ae48f506f23ac89fdcc0593c296c2cbf6540 (patch)
tree176dbb3601db3f58707768001ac901a11e680081 /OpenSim/Framework
parentbased on recent unit test output, put some extra checking in the (diff)
downloadopensim-SC-7943ae48f506f23ac89fdcc0593c296c2cbf6540.zip
opensim-SC-7943ae48f506f23ac89fdcc0593c296c2cbf6540.tar.gz
opensim-SC-7943ae48f506f23ac89fdcc0593c296c2cbf6540.tar.bz2
opensim-SC-7943ae48f506f23ac89fdcc0593c296c2cbf6540.tar.xz
move the lock out a bit further in the ProccessAssetCache loop to reduce
the number of times we are going to take this lock in a row (which is just wasted resource), and to keep us from attempting to array access a list which might be changing right now. Extremely curious if this helps prevent some of our mono segfaults.
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/Communications/Cache/AssetCache.cs34
1 files changed, 18 insertions, 16 deletions
diff --git a/OpenSim/Framework/Communications/Cache/AssetCache.cs b/OpenSim/Framework/Communications/Cache/AssetCache.cs
index f214e19..7d25ca9 100644
--- a/OpenSim/Framework/Communications/Cache/AssetCache.cs
+++ b/OpenSim/Framework/Communications/Cache/AssetCache.cs
@@ -515,7 +515,10 @@ namespace OpenSim.Framework.Communications.Cache
515 req.Params = transferRequest.TransferInfo.Params; 515 req.Params = transferRequest.TransferInfo.Params;
516 req.AssetInf = new AssetInfo(asset); 516 req.AssetInf = new AssetInfo(asset);
517 req.NumPackets = CalculateNumPackets(asset.Data); 517 req.NumPackets = CalculateNumPackets(asset.Data);
518 lock (AssetRequests) AssetRequests.Add(req); 518 lock (AssetRequests)
519 {
520 AssetRequests.Add(req);
521 }
519 } 522 }
520 523
521 /// <summary> 524 /// <summary>
@@ -536,26 +539,25 @@ namespace OpenSim.Framework.Communications.Cache
536 AssetRequest req; 539 AssetRequest req;
537 AssetRequestToClient req2 = new AssetRequestToClient(); 540 AssetRequestToClient req2 = new AssetRequestToClient();
538 541
539 for (int i = 0; i < num; i++) 542 lock (AssetRequests)
540 { 543 {
541 lock (AssetRequests) 544 for (int i = 0; i < num; i++)
542 { 545 {
543 req = AssetRequests[0]; 546 req = AssetRequests[0];
544 AssetRequests.RemoveAt(0); 547 AssetRequests.RemoveAt(0);
548 req2.AssetInf = req.AssetInf;
549 req2.AssetRequestSource = req.AssetRequestSource;
550 req2.DataPointer = req.DataPointer;
551 req2.DiscardLevel = req.DiscardLevel;
552 req2.ImageInfo = req.ImageInfo;
553 req2.IsTextureRequest = req.IsTextureRequest;
554 req2.NumPackets = req.NumPackets;
555 req2.PacketCounter = req.PacketCounter;
556 req2.Params = req.Params;
557 req2.RequestAssetID = req.RequestAssetID;
558 req2.TransferRequestID = req.TransferRequestID;
559 req.RequestUser.SendAsset(req2);
545 } 560 }
546
547 req2.AssetInf = req.AssetInf;
548 req2.AssetRequestSource = req.AssetRequestSource;
549 req2.DataPointer = req.DataPointer;
550 req2.DiscardLevel = req.DiscardLevel;
551 req2.ImageInfo = req.ImageInfo;
552 req2.IsTextureRequest = req.IsTextureRequest;
553 req2.NumPackets = req.NumPackets;
554 req2.PacketCounter = req.PacketCounter;
555 req2.Params = req.Params;
556 req2.RequestAssetID = req.RequestAssetID;
557 req2.TransferRequestID = req.TransferRequestID;
558 req.RequestUser.SendAsset(req2);
559 } 561 }
560 } 562 }
561 563