aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2014-09-04 00:00:51 +0100
committerJustin Clark-Casey (justincc)2014-09-04 00:00:51 +0100
commit0692ebfbc6bfbbae428d79cb824622cea297fbaf (patch)
treec49e1ad8bf44aeef1e7da757629ffe149a3b4d44 /OpenSim/Region
parentDon't need to check separate physics status in bulletsim update since that me... (diff)
downloadopensim-SC_OLD-0692ebfbc6bfbbae428d79cb824622cea297fbaf.zip
opensim-SC_OLD-0692ebfbc6bfbbae428d79cb824622cea297fbaf.tar.gz
opensim-SC_OLD-0692ebfbc6bfbbae428d79cb824622cea297fbaf.tar.bz2
opensim-SC_OLD-0692ebfbc6bfbbae428d79cb824622cea297fbaf.tar.xz
Start long-lived thread in IRCConnector via watchdog rather than indepedently, so that it can be seen in "show threads" and stats
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Chat/IRCConnector.cs18
1 files changed, 5 insertions, 13 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/Chat/IRCConnector.cs b/OpenSim/Region/OptionalModules/Avatar/Chat/IRCConnector.cs
index f5bd44d..bdd07e0 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Chat/IRCConnector.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Chat/IRCConnector.cs
@@ -109,10 +109,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
109 109
110 internal int m_resetk = 0; 110 internal int m_resetk = 0;
111 111
112 // Working threads
113
114 private Thread m_listener = null;
115
116 private Object msyncConnect = new Object(); 112 private Object msyncConnect = new Object();
117 113
118 internal bool m_randomizeNick = true; // add random suffix 114 internal bool m_randomizeNick = true; // add random suffix
@@ -363,10 +359,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
363 359
364 m_log.InfoFormat("[IRC-Connector-{0}]: Connected to {1}:{2}", idn, m_server, m_port); 360 m_log.InfoFormat("[IRC-Connector-{0}]: Connected to {1}:{2}", idn, m_server, m_port);
365 361
366 m_listener = new Thread(new ThreadStart(ListenerRun)); 362 Watchdog.StartThread(ListenerRun, "IRCConnectionListenerThread", ThreadPriority.Normal, true, false);
367 m_listener.Name = "IRCConnectorListenerThread";
368 m_listener.IsBackground = true;
369 m_listener.Start();
370 363
371 // This is the message order recommended by RFC 2812 364 // This is the message order recommended by RFC 2812
372 if (m_password != null) 365 if (m_password != null)
@@ -510,21 +503,20 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
510 { 503 {
511 while (m_enabled && m_connected) 504 while (m_enabled && m_connected)
512 { 505 {
513
514 if ((inputLine = m_reader.ReadLine()) == null) 506 if ((inputLine = m_reader.ReadLine()) == null)
515 throw new Exception("Listener input socket closed"); 507 throw new Exception("Listener input socket closed");
516 508
509 Watchdog.UpdateThread();
510
517 // m_log.Info("[IRCConnector]: " + inputLine); 511 // m_log.Info("[IRCConnector]: " + inputLine);
518 512
519 if (inputLine.Contains("PRIVMSG")) 513 if (inputLine.Contains("PRIVMSG"))
520 { 514 {
521
522 Dictionary<string, string> data = ExtractMsg(inputLine); 515 Dictionary<string, string> data = ExtractMsg(inputLine);
523 516
524 // Any chat ??? 517 // Any chat ???
525 if (data != null) 518 if (data != null)
526 { 519 {
527
528 OSChatMessage c = new OSChatMessage(); 520 OSChatMessage c = new OSChatMessage();
529 c.Message = data["msg"]; 521 c.Message = data["msg"];
530 c.Type = ChatTypeEnum.Region; 522 c.Type = ChatTypeEnum.Region;
@@ -540,9 +532,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
540 c.Message = String.Format("/me {0}", c.Message.Substring(8, c.Message.Length - 9)); 532 c.Message = String.Format("/me {0}", c.Message.Substring(8, c.Message.Length - 9));
541 533
542 ChannelState.OSChat(this, c, false); 534 ChannelState.OSChat(this, c, false);
543
544 } 535 }
545
546 } 536 }
547 else 537 else
548 { 538 {
@@ -562,6 +552,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
562 552
563 if (m_enabled && (m_resetk == resetk)) 553 if (m_enabled && (m_resetk == resetk))
564 Reconnect(); 554 Reconnect();
555
556 Watchdog.RemoveThread();
565 } 557 }
566 558
567 private Regex RE = new Regex(@":(?<nick>[\w-]*)!(?<user>\S*) PRIVMSG (?<channel>\S+) :(?<msg>.*)", 559 private Regex RE = new Regex(@":(?<nick>[\w-]*)!(?<user>\S*) PRIVMSG (?<channel>\S+) :(?<msg>.*)",