aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment
diff options
context:
space:
mode:
authorDr Scofield2008-05-30 12:29:30 +0000
committerDr Scofield2008-05-30 12:29:30 +0000
commit9590e671e6efc5c8da74f22b7038f1ce10501620 (patch)
treeb9a84a11f2c48c9d43dd3de1fc9a9111ff32c5ab /OpenSim/Region/Environment
parent* This is Melanie's XEngine script engine. I've not tested this real well, h... (diff)
downloadopensim-SC_OLD-9590e671e6efc5c8da74f22b7038f1ce10501620.zip
opensim-SC_OLD-9590e671e6efc5c8da74f22b7038f1ce10501620.tar.gz
opensim-SC_OLD-9590e671e6efc5c8da74f22b7038f1ce10501620.tar.bz2
opensim-SC_OLD-9590e671e6efc5c8da74f22b7038f1ce10501620.tar.xz
while investigating why IRCBridgeModule.Close() was having no effect, i
noticed that Scene.Close() will only call Close on non-shared region modules. i've now added code to SceneManager.Close() to collect all shared region module from each scene before calling Scene.Close() on it and then, once, all Scenes are closed, go through the list of collected shared region modules and close them as well. SceneManager.Close() is only called when we initiate a shutdown --- i've verified that a Scene restart does not trigger the shutdown of shared modules :-) also, this adds a couple of bug fixes to the IRCBridgeModule (which after all didn't take kindly to being closed) as well as a check to InterregionModule's Close() call. finally, this fixes the RestPlugin's XmlWriter so that it no longer includes the "xsd=..." and "xsi=..." junk.
Diffstat (limited to 'OpenSim/Region/Environment')
-rw-r--r--OpenSim/Region/Environment/Modules/Avatar/Chat/IRCBridgeModule.cs39
-rw-r--r--OpenSim/Region/Environment/Modules/Grid/Interregion/InterregionModule.cs3
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs6
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneManager.cs18
4 files changed, 51 insertions, 15 deletions
diff --git a/OpenSim/Region/Environment/Modules/Avatar/Chat/IRCBridgeModule.cs b/OpenSim/Region/Environment/Modules/Avatar/Chat/IRCBridgeModule.cs
index 85262f5..befa89f 100644
--- a/OpenSim/Region/Environment/Modules/Avatar/Chat/IRCBridgeModule.cs
+++ b/OpenSim/Region/Environment/Modules/Avatar/Chat/IRCBridgeModule.cs
@@ -151,6 +151,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
151 public void Close() 151 public void Close()
152 { 152 {
153 m_irc.Close(); 153 m_irc.Close();
154 m_log.Info("[IRC] closed connection to IRC server");
154 } 155 }
155 156
156 public string Name 157 public string Name
@@ -324,9 +325,9 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
324 // if IRC is enabled then just keep trying using a monitor thread 325 // if IRC is enabled then just keep trying using a monitor thread
325 public void IRCConnectRun() 326 public void IRCConnectRun()
326 { 327 {
327 while (true) 328 while (m_irc.Enabled)
328 { 329 {
329 if ((m_irc.Enabled) && (!m_irc.Connected)) 330 if (!m_irc.Connected)
330 { 331 {
331 m_irc.Connect(m_scenes); 332 m_irc.Connect(m_scenes);
332 } 333 }
@@ -538,7 +539,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
538 m_log.Info("[IRC]: ExtractMsg: " + input); 539 m_log.Info("[IRC]: ExtractMsg: " + input);
539 Dictionary<string, string> result = null; 540 Dictionary<string, string> result = null;
540 //string regex = @":(?<nick>\w*)!~(?<user>\S*) PRIVMSG (?<channel>\S+) :(?<msg>.*)"; 541 //string regex = @":(?<nick>\w*)!~(?<user>\S*) PRIVMSG (?<channel>\S+) :(?<msg>.*)";
541 string regex = @":(?<nick>\w*)!(?<user>\S*) PRIVMSG (?<channel>\S+) :(?<msg>.*)"; 542 string regex = @":(?<nick>[\w-]*)!(?<user>\S*) PRIVMSG (?<channel>\S+) :(?<msg>.*)";
542 Regex RE = new Regex(regex, RegexOptions.Multiline); 543 Regex RE = new Regex(regex, RegexOptions.Multiline);
543 MatchCollection matches = RE.Matches(input); 544 MatchCollection matches = RE.Matches(input);
544 545
@@ -566,7 +567,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
566 { 567 {
567 // IRC keep alive thread 568 // IRC keep alive thread
568 // send PING ever 15 seconds 569 // send PING ever 15 seconds
569 while (true) 570 while (m_enabled)
570 { 571 {
571 try 572 try
572 { 573 {
@@ -579,8 +580,11 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
579 } 580 }
580 catch (IOException) 581 catch (IOException)
581 { 582 {
582 m_log.Error("[IRC]: Disconnected from IRC server.(PingRun)"); 583 if (m_enabled)
583 Reconnect(); 584 {
585 m_log.Error("[IRC]: Disconnected from IRC server.(PingRun)");
586 Reconnect();
587 }
584 } 588 }
585 catch (Exception ex) 589 catch (Exception ex)
586 { 590 {
@@ -593,7 +597,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
593 { 597 {
594 string inputLine; 598 string inputLine;
595 LLVector3 pos = new LLVector3(128, 128, 20); 599 LLVector3 pos = new LLVector3(128, 128, 20);
596 while (true) 600 while (m_enabled)
597 { 601 {
598 try 602 try
599 { 603 {
@@ -637,8 +641,11 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
637 } 641 }
638 catch (IOException) 642 catch (IOException)
639 { 643 {
640 m_log.Error("[IRC]: ListenerRun IOException. Disconnected from IRC server ??? (ListenerRun)"); 644 if (m_enabled)
641 Reconnect(); 645 {
646 m_log.Error("[IRC]: ListenerRun IOException. Disconnected from IRC server ??? (ListenerRun)");
647 Reconnect();
648 }
642 } 649 }
643 catch (Exception ex) 650 catch (Exception ex)
644 { 651 {
@@ -838,13 +845,19 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
838 845
839 public void Close() 846 public void Close()
840 { 847 {
841 m_connected = false; 848 m_writer.WriteLine(String.Format("QUIT :{0} to {1} wormhole to {2} closing",
842 m_writer.WriteLine(String.Format("QUIT :{0} to {1} wormhole with {2} closing", m_nick, m_channel, m_server)); 849 m_nick, m_channel, m_server));
843 m_writer.Flush(); 850 m_writer.Flush();
844 listener.Abort(); 851
845 pingSender.Abort(); 852 m_connected = false;
853 m_enabled = false;
854
855 // listener.Abort();
856 // pingSender.Abort();
857
846 m_writer.Close(); 858 m_writer.Close();
847 m_reader.Close(); 859 m_reader.Close();
860
848 m_tcp.Close(); 861 m_tcp.Close();
849 } 862 }
850 } 863 }
diff --git a/OpenSim/Region/Environment/Modules/Grid/Interregion/InterregionModule.cs b/OpenSim/Region/Environment/Modules/Grid/Interregion/InterregionModule.cs
index 89ee61a..40d07de 100644
--- a/OpenSim/Region/Environment/Modules/Grid/Interregion/InterregionModule.cs
+++ b/OpenSim/Region/Environment/Modules/Grid/Interregion/InterregionModule.cs
@@ -169,7 +169,8 @@ namespace OpenSim.Region.Environment.Modules.Grid.Interregion
169 169
170 public void Close() 170 public void Close()
171 { 171 {
172 ChannelServices.UnregisterChannel(m_tcpChannel); 172 if (null != m_tcpChannel)
173 ChannelServices.UnregisterChannel(m_tcpChannel);
173 } 174 }
174 175
175 public string Name 176 public string Name
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 2b667c9..c1e8602 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -103,7 +103,11 @@ namespace OpenSim.Region.Environment.Scenes
103 103
104 protected BaseHttpServer m_httpListener; 104 protected BaseHttpServer m_httpListener;
105 105
106 protected Dictionary<string, IRegionModule> Modules = new Dictionary<string, IRegionModule>(); 106 protected Dictionary<string, IRegionModule> m_modules = new Dictionary<string, IRegionModule>();
107 public Dictionary<string, IRegionModule> Modules
108 {
109 get { return m_modules; }
110 }
107 protected Dictionary<Type, object> ModuleInterfaces = new Dictionary<Type, object>(); 111 protected Dictionary<Type, object> ModuleInterfaces = new Dictionary<Type, object>();
108 protected Dictionary<string, object> ModuleAPIMethods = new Dictionary<string, object>(); 112 protected Dictionary<string, object> ModuleAPIMethods = new Dictionary<string, object>();
109 protected Dictionary<string, ICommander> m_moduleCommanders = new Dictionary<string, ICommander>(); 113 protected Dictionary<string, ICommander> m_moduleCommanders = new Dictionary<string, ICommander>();
diff --git a/OpenSim/Region/Environment/Scenes/SceneManager.cs b/OpenSim/Region/Environment/Scenes/SceneManager.cs
index c596f6e..dc9ac37 100644
--- a/OpenSim/Region/Environment/Scenes/SceneManager.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneManager.cs
@@ -32,6 +32,7 @@ using System.Reflection;
32using libsecondlife; 32using libsecondlife;
33using log4net; 33using log4net;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Region.Environment.Interfaces;
35 36
36namespace OpenSim.Region.Environment.Scenes 37namespace OpenSim.Region.Environment.Scenes
37{ 38{
@@ -78,10 +79,27 @@ namespace OpenSim.Region.Environment.Scenes
78 79
79 public void Close() 80 public void Close()
80 { 81 {
82 // collect known shared modules in sharedModules
83 Dictionary<string, IRegionModule> sharedModules = new Dictionary<string, IRegionModule>();
81 for (int i = 0; i < m_localScenes.Count; i++) 84 for (int i = 0; i < m_localScenes.Count; i++)
82 { 85 {
86 // extract known shared modules from scene
87 foreach(string k in m_localScenes[i].Modules.Keys)
88 {
89 if (m_localScenes[i].Modules[k].IsSharedModule &&
90 !sharedModules.ContainsKey(k))
91 sharedModules[k] = m_localScenes[i].Modules[k];
92 }
93 // close scene/region
83 m_localScenes[i].Close(); 94 m_localScenes[i].Close();
84 } 95 }
96
97 // all regions/scenes are now closed, we can now safely
98 // close all shared modules
99 foreach(IRegionModule mod in sharedModules.Values)
100 {
101 mod.Close();
102 }
85 } 103 }
86 104
87 public void Close(Scene cscene) 105 public void Close(Scene cscene)