diff options
author | Justin Clarke Casey | 2008-11-04 21:26:40 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-11-04 21:26:40 +0000 |
commit | 09dabb2aec0ebfd4bc53a18affe091b25f4ba041 (patch) | |
tree | 54d6835a043ba0f1c0e5cd550676e780bc694f03 /OpenSim/Region/Environment/Modules/Agent/TextureDownload | |
parent | * Stop an exception in getting assets for the archiver from crashing the sim (diff) | |
download | opensim-SC-09dabb2aec0ebfd4bc53a18affe091b25f4ba041.zip opensim-SC-09dabb2aec0ebfd4bc53a18affe091b25f4ba041.tar.gz opensim-SC-09dabb2aec0ebfd4bc53a18affe091b25f4ba041.tar.bz2 opensim-SC-09dabb2aec0ebfd4bc53a18affe091b25f4ba041.tar.xz |
* Prevent texture sender thread termination from immediately crashing the sim
Diffstat (limited to 'OpenSim/Region/Environment/Modules/Agent/TextureDownload')
-rw-r--r-- | OpenSim/Region/Environment/Modules/Agent/TextureDownload/TextureDownloadModule.cs | 46 |
1 files changed, 28 insertions, 18 deletions
diff --git a/OpenSim/Region/Environment/Modules/Agent/TextureDownload/TextureDownloadModule.cs b/OpenSim/Region/Environment/Modules/Agent/TextureDownload/TextureDownloadModule.cs index aa4d070..af51df6 100644 --- a/OpenSim/Region/Environment/Modules/Agent/TextureDownload/TextureDownloadModule.cs +++ b/OpenSim/Region/Environment/Modules/Agent/TextureDownload/TextureDownloadModule.cs | |||
@@ -39,8 +39,8 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload | |||
39 | { | 39 | { |
40 | public class TextureDownloadModule : IRegionModule | 40 | public class TextureDownloadModule : IRegionModule |
41 | { | 41 | { |
42 | //private static readonly log4net.ILog m_log | 42 | private static readonly log4net.ILog m_log |
43 | // = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | 43 | = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); |
44 | 44 | ||
45 | /// <summary> | 45 | /// <summary> |
46 | /// There is one queue for all textures waiting to be sent, regardless of the requesting user. | 46 | /// There is one queue for all textures waiting to be sent, regardless of the requesting user. |
@@ -176,34 +176,44 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload | |||
176 | { | 176 | { |
177 | ITextureSender sender = null; | 177 | ITextureSender sender = null; |
178 | 178 | ||
179 | while (true) | 179 | try |
180 | { | 180 | { |
181 | sender = m_queueSenders.Dequeue(); | 181 | while (true) |
182 | |||
183 | if (sender.Cancel) | ||
184 | { | 182 | { |
185 | TextureSent(sender); | 183 | sender = m_queueSenders.Dequeue(); |
186 | 184 | ||
187 | sender.Cancel = false; | 185 | if (sender.Cancel) |
188 | } | ||
189 | else | ||
190 | { | ||
191 | bool finished = sender.SendTexturePacket(); | ||
192 | if (finished) | ||
193 | { | 186 | { |
194 | TextureSent(sender); | 187 | TextureSent(sender); |
188 | |||
189 | sender.Cancel = false; | ||
195 | } | 190 | } |
196 | else | 191 | else |
197 | { | 192 | { |
198 | m_queueSenders.Enqueue(sender); | 193 | bool finished = sender.SendTexturePacket(); |
194 | if (finished) | ||
195 | { | ||
196 | TextureSent(sender); | ||
197 | } | ||
198 | else | ||
199 | { | ||
200 | m_queueSenders.Enqueue(sender); | ||
201 | } | ||
199 | } | 202 | } |
200 | } | ||
201 | 203 | ||
202 | // Make sure that any sender we currently have can get garbage collected | 204 | // Make sure that any sender we currently have can get garbage collected |
203 | sender = null; | 205 | sender = null; |
204 | 206 | ||
205 | //m_log.InfoFormat("[TEXTURE] Texture sender queue size: {0}", m_queueSenders.Count()); | 207 | //m_log.InfoFormat("[TEXTURE] Texture sender queue size: {0}", m_queueSenders.Count()); |
208 | } | ||
206 | } | 209 | } |
210 | catch (Exception e) | ||
211 | { | ||
212 | // TODO: Let users in the sim and those entering it and possibly an external watchdog know what has happened | ||
213 | m_log.ErrorFormat( | ||
214 | "[TEXTURE]: Texture send thread terminating with exception. PLEASE REBOOT YOUR SIM - TEXTURES WILL NOT BE AVAILABLE UNTIL YOU DO. Exception is {0}", | ||
215 | e); | ||
216 | } | ||
207 | } | 217 | } |
208 | 218 | ||
209 | /// <summary> | 219 | /// <summary> |