aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-11-04 21:26:40 +0000
committerJustin Clarke Casey2008-11-04 21:26:40 +0000
commit09dabb2aec0ebfd4bc53a18affe091b25f4ba041 (patch)
tree54d6835a043ba0f1c0e5cd550676e780bc694f03
parent* Stop an exception in getting assets for the archiver from crashing the sim (diff)
downloadopensim-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
-rw-r--r--OpenSim/Region/Environment/Modules/Agent/TextureDownload/TextureDownloadModule.cs46
-rw-r--r--OpenSim/Region/Environment/Modules/Avatar/Chat/IRCConnector.cs2
2 files changed, 28 insertions, 20 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>
diff --git a/OpenSim/Region/Environment/Modules/Avatar/Chat/IRCConnector.cs b/OpenSim/Region/Environment/Modules/Avatar/Chat/IRCConnector.cs
index b9422f3..3ebb226 100644
--- a/OpenSim/Region/Environment/Modules/Avatar/Chat/IRCConnector.cs
+++ b/OpenSim/Region/Environment/Modules/Avatar/Chat/IRCConnector.cs
@@ -371,7 +371,6 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
371 371
372 public void Reconnect() 372 public void Reconnect()
373 { 373 {
374
375 m_log.DebugFormat("[IRC-Connector-{0}]: Reconnect request for {1} on {2}:{3}", idn, m_nick, m_server, m_ircChannel); 374 m_log.DebugFormat("[IRC-Connector-{0}]: Reconnect request for {1} on {2}:{3}", idn, m_nick, m_server, m_ircChannel);
376 375
377 // Don't do this if a Connect is in progress... 376 // Don't do this if a Connect is in progress...
@@ -518,7 +517,6 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
518 } 517 }
519 518
520 if (m_enabled) Reconnect(); 519 if (m_enabled) Reconnect();
521
522 } 520 }
523 521
524 private Regex RE = new Regex(@":(?<nick>[\w-]*)!(?<user>\S*) PRIVMSG (?<channel>\S+) :(?<msg>.*)", 522 private Regex RE = new Regex(@":(?<nick>[\w-]*)!(?<user>\S*) PRIVMSG (?<channel>\S+) :(?<msg>.*)",