diff options
-rw-r--r-- | OpenSim/Region/OptionalModules/Avatar/Chat/IRCConnector.cs | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/Chat/IRCConnector.cs b/OpenSim/Region/OptionalModules/Avatar/Chat/IRCConnector.cs index 5123ef5..ca85817 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Chat/IRCConnector.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Chat/IRCConnector.cs | |||
@@ -96,6 +96,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat | |||
96 | 96 | ||
97 | internal int depends = 0; | 97 | internal int depends = 0; |
98 | 98 | ||
99 | // This variable counts the number of resets that have been performed | ||
100 | // on the connector. When a listener thread terminates, it checks to | ||
101 | // see of the reset count has changed before it schedules another | ||
102 | // reset. | ||
103 | |||
104 | internal int m_resetk = 0; | ||
105 | |||
99 | // Working threads | 106 | // Working threads |
100 | 107 | ||
101 | private Thread m_listener = null; | 108 | private Thread m_listener = null; |
@@ -229,7 +236,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat | |||
229 | 236 | ||
230 | // Add the newly created connector to the known connectors list | 237 | // Add the newly created connector to the known connectors list |
231 | 238 | ||
232 | m_connectors.Add(this); | 239 | // m_connectors.Add(this); |
233 | 240 | ||
234 | m_log.InfoFormat("[IRC-Connector-{0}]: Initialization complete", idn); | 241 | m_log.InfoFormat("[IRC-Connector-{0}]: Initialization complete", idn); |
235 | 242 | ||
@@ -393,6 +400,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat | |||
393 | 400 | ||
394 | if (m_connected) | 401 | if (m_connected) |
395 | { | 402 | { |
403 | |||
396 | m_log.InfoFormat("[IRC-Connector-{0}] Resetting connector", idn); | 404 | m_log.InfoFormat("[IRC-Connector-{0}] Resetting connector", idn); |
397 | 405 | ||
398 | // Mark as disconnected. This will allow the listener thread | 406 | // Mark as disconnected. This will allow the listener thread |
@@ -410,6 +418,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat | |||
410 | 418 | ||
411 | m_connected = false; | 419 | m_connected = false; |
412 | m_pending = false; | 420 | m_pending = false; |
421 | m_resetk++; | ||
413 | 422 | ||
414 | } | 423 | } |
415 | 424 | ||
@@ -478,7 +487,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat | |||
478 | 487 | ||
479 | public void ListenerRun() | 488 | public void ListenerRun() |
480 | { | 489 | { |
490 | |||
481 | string inputLine; | 491 | string inputLine; |
492 | int resetk = m_resetk; | ||
482 | 493 | ||
483 | try | 494 | try |
484 | { | 495 | { |
@@ -534,7 +545,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat | |||
534 | // The connection is marked as not connected the first time | 545 | // The connection is marked as not connected the first time |
535 | // through reconnect. | 546 | // through reconnect. |
536 | 547 | ||
537 | if (m_enabled) Reconnect(); | 548 | if (m_enabled && (m_resetk == resetk)) |
549 | Reconnect(); | ||
538 | 550 | ||
539 | } | 551 | } |
540 | 552 | ||
@@ -830,6 +842,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat | |||
830 | 842 | ||
831 | foreach (IRCConnector connector in m_connectors) | 843 | foreach (IRCConnector connector in m_connectors) |
832 | { | 844 | { |
845 | // m_log.InfoFormat("[IRC-Watchdog] Scanning {0}", connector); | ||
833 | if (connector.Enabled) | 846 | if (connector.Enabled) |
834 | { | 847 | { |
835 | if (!connector.Connected) | 848 | if (!connector.Connected) |
@@ -851,7 +864,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat | |||
851 | { | 864 | { |
852 | if (connector.m_timeout == 0) | 865 | if (connector.m_timeout == 0) |
853 | { | 866 | { |
854 | m_log.ErrorFormat("[IRC-Watchdog] Login timed-out for connector {0}, reconnecting", connector.idn); | 867 | // m_log.ErrorFormat("[IRC-Watchdog] Login timed-out for connector {0}, reconnecting", connector.idn); |
855 | connector.Reconnect(); | 868 | connector.Reconnect(); |
856 | } | 869 | } |
857 | else | 870 | else |
@@ -865,10 +878,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat | |||
865 | connector.m_writer.WriteLine(String.Format("PING :{0}", connector.m_server)); | 878 | connector.m_writer.WriteLine(String.Format("PING :{0}", connector.m_server)); |
866 | connector.m_writer.Flush(); | 879 | connector.m_writer.Flush(); |
867 | } | 880 | } |
868 | catch (Exception /*e*/) | 881 | catch (Exception e) |
869 | { | 882 | { |
870 | // m_log.ErrorFormat("[IRC-PingRun] Exception on connector {0}: {1} ", connector.idn, e.Message); | 883 | m_log.ErrorFormat("[IRC-PingRun] Exception on connector {0}: {1} ", connector.idn, e.Message); |
871 | // m_log.Debug(e); | 884 | m_log.Debug(e); |
872 | connector.Reconnect(); | 885 | connector.Reconnect(); |
873 | } | 886 | } |
874 | } | 887 | } |