diff options
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Framework/Communications/Cache/AssetCache.cs | 22 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs | 44 |
2 files changed, 46 insertions, 20 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 |
diff --git a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs index b4ec7ae..dedd37f 100644 --- a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs | |||
@@ -66,15 +66,37 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture | |||
66 | /// <param name="data"></param> | 66 | /// <param name="data"></param> |
67 | public void ReturnData(UUID id, byte[] data) | 67 | public void ReturnData(UUID id, byte[] data) |
68 | { | 68 | { |
69 | if (Updaters.ContainsKey(id)) | 69 | |
70 | DynamicTextureUpdater updater = null; | ||
71 | |||
72 | lock(Updaters) | ||
73 | { | ||
74 | if (Updaters.ContainsKey(id)) | ||
75 | { | ||
76 | updater = Updaters[id]; | ||
77 | } | ||
78 | } | ||
79 | |||
80 | if(updater != null) | ||
70 | { | 81 | { |
71 | DynamicTextureUpdater updater = Updaters[id]; | ||
72 | if (RegisteredScenes.ContainsKey(updater.SimUUID)) | 82 | if (RegisteredScenes.ContainsKey(updater.SimUUID)) |
73 | { | 83 | { |
74 | Scene scene = RegisteredScenes[updater.SimUUID]; | 84 | Scene scene = RegisteredScenes[updater.SimUUID]; |
75 | updater.DataReceived(data, scene); | 85 | updater.DataReceived(data, scene); |
76 | } | 86 | } |
77 | } | 87 | } |
88 | |||
89 | if(updater.UpdateTimer == 0) | ||
90 | { | ||
91 | lock(Updaters) | ||
92 | { | ||
93 | if (!Updaters.ContainsKey(updater.UpdaterID)) | ||
94 | { | ||
95 | Updaters.Remove(updater.UpdaterID); | ||
96 | } | ||
97 | } | ||
98 | } | ||
99 | |||
78 | } | 100 | } |
79 | 101 | ||
80 | public UUID AddDynamicTextureURL(UUID simID, UUID primID, string contentType, string url, | 102 | public UUID AddDynamicTextureURL(UUID simID, UUID primID, string contentType, string url, |
@@ -101,9 +123,12 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture | |||
101 | updater.BlendWithOldTexture = SetBlending; | 123 | updater.BlendWithOldTexture = SetBlending; |
102 | updater.FrontAlpha = AlphaValue; | 124 | updater.FrontAlpha = AlphaValue; |
103 | 125 | ||
104 | if (!Updaters.ContainsKey(updater.UpdaterID)) | 126 | lock(Updaters) |
105 | { | 127 | { |
106 | Updaters.Add(updater.UpdaterID, updater); | 128 | if (!Updaters.ContainsKey(updater.UpdaterID)) |
129 | { | ||
130 | Updaters.Add(updater.UpdaterID, updater); | ||
131 | } | ||
107 | } | 132 | } |
108 | 133 | ||
109 | RenderPlugins[contentType].AsyncConvertUrl(updater.UpdaterID, url, extraParams); | 134 | RenderPlugins[contentType].AsyncConvertUrl(updater.UpdaterID, url, extraParams); |
@@ -134,9 +159,12 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture | |||
134 | updater.BlendWithOldTexture = SetBlending; | 159 | updater.BlendWithOldTexture = SetBlending; |
135 | updater.FrontAlpha = AlphaValue; | 160 | updater.FrontAlpha = AlphaValue; |
136 | 161 | ||
137 | if (!Updaters.ContainsKey(updater.UpdaterID)) | 162 | lock(Updaters) |
138 | { | 163 | { |
139 | Updaters.Add(updater.UpdaterID, updater); | 164 | if (!Updaters.ContainsKey(updater.UpdaterID)) |
165 | { | ||
166 | Updaters.Add(updater.UpdaterID, updater); | ||
167 | } | ||
140 | } | 168 | } |
141 | 169 | ||
142 | RenderPlugins[contentType].AsyncConvertData(updater.UpdaterID, data, extraParams); | 170 | RenderPlugins[contentType].AsyncConvertData(updater.UpdaterID, data, extraParams); |
@@ -270,7 +298,6 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture | |||
270 | 298 | ||
271 | // remove the old asset from the cache | 299 | // remove the old asset from the cache |
272 | UUID oldID = tmptex.DefaultTexture.TextureID; | 300 | UUID oldID = tmptex.DefaultTexture.TextureID; |
273 | scene.CommsManager.AssetCache.ExpireAsset(oldID); | ||
274 | 301 | ||
275 | tmptex.DefaultTexture.TextureID = asset.FullID; | 302 | tmptex.DefaultTexture.TextureID = asset.FullID; |
276 | // I'm pretty sure we always want to force this to true | 303 | // I'm pretty sure we always want to force this to true |
@@ -278,6 +305,9 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture | |||
278 | 305 | ||
279 | part.Shape.Textures = tmptex; | 306 | part.Shape.Textures = tmptex; |
280 | part.ScheduleFullUpdate(); | 307 | part.ScheduleFullUpdate(); |
308 | |||
309 | scene.CommsManager.AssetCache.ExpireAsset(oldID); | ||
310 | |||
281 | } | 311 | } |
282 | 312 | ||
283 | private byte[] BlendTextures(byte[] frontImage, byte[] backImage, bool setNewAlpha, byte newAlpha) | 313 | private byte[] BlendTextures(byte[] frontImage, byte[] backImage, bool setNewAlpha, byte newAlpha) |