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.
0.6.0-stable
Dr Scofield 2008-05-30 12:29:30 +00:00
parent 1a47ff8094
commit 9590e671e6
6 changed files with 65 additions and 18 deletions

View File

@ -57,6 +57,12 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
public partial class RestRegionPlugin : RestPlugin
{
private static XmlSerializerNamespaces _xmlNs;
static RestRegionPlugin()
{
_xmlNs = new XmlSerializerNamespaces();
_xmlNs.Add(String.Empty, String.Empty);
}
#region overriding properties
public override string Name
@ -91,9 +97,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
}
m_log.InfoFormat("{0} REST region plugin enabled", MsgID);
_xmlNs = new XmlSerializerNamespaces();
_xmlNs.Add(String.Empty, String.Empty);
// add REST method handlers
AddRestStreamHandler("GET", "/regions/", GetHandler);
AddRestStreamHandler("POST", "/regions/", PostHandler);

View File

@ -135,6 +135,14 @@ namespace OpenSim.ApplicationPlugins.Rest
get { return _prefix; }
}
/// <summary>
/// Access to GOD password string
/// </summary>
protected string GodKey
{
get { return _godkey; }
}
/// <summary>
/// Configuration of the plugin
/// </summary>

View File

@ -151,6 +151,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
public void Close()
{
m_irc.Close();
m_log.Info("[IRC] closed connection to IRC server");
}
public string Name
@ -324,9 +325,9 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
// if IRC is enabled then just keep trying using a monitor thread
public void IRCConnectRun()
{
while (true)
while (m_irc.Enabled)
{
if ((m_irc.Enabled) && (!m_irc.Connected))
if (!m_irc.Connected)
{
m_irc.Connect(m_scenes);
}
@ -538,7 +539,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
m_log.Info("[IRC]: ExtractMsg: " + input);
Dictionary<string, string> result = null;
//string regex = @":(?<nick>\w*)!~(?<user>\S*) PRIVMSG (?<channel>\S+) :(?<msg>.*)";
string regex = @":(?<nick>\w*)!(?<user>\S*) PRIVMSG (?<channel>\S+) :(?<msg>.*)";
string regex = @":(?<nick>[\w-]*)!(?<user>\S*) PRIVMSG (?<channel>\S+) :(?<msg>.*)";
Regex RE = new Regex(regex, RegexOptions.Multiline);
MatchCollection matches = RE.Matches(input);
@ -566,7 +567,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
{
// IRC keep alive thread
// send PING ever 15 seconds
while (true)
while (m_enabled)
{
try
{
@ -579,8 +580,11 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
}
catch (IOException)
{
m_log.Error("[IRC]: Disconnected from IRC server.(PingRun)");
Reconnect();
if (m_enabled)
{
m_log.Error("[IRC]: Disconnected from IRC server.(PingRun)");
Reconnect();
}
}
catch (Exception ex)
{
@ -593,7 +597,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
{
string inputLine;
LLVector3 pos = new LLVector3(128, 128, 20);
while (true)
while (m_enabled)
{
try
{
@ -637,8 +641,11 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
}
catch (IOException)
{
m_log.Error("[IRC]: ListenerRun IOException. Disconnected from IRC server ??? (ListenerRun)");
Reconnect();
if (m_enabled)
{
m_log.Error("[IRC]: ListenerRun IOException. Disconnected from IRC server ??? (ListenerRun)");
Reconnect();
}
}
catch (Exception ex)
{
@ -838,13 +845,19 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
public void Close()
{
m_connected = false;
m_writer.WriteLine(String.Format("QUIT :{0} to {1} wormhole with {2} closing", m_nick, m_channel, m_server));
m_writer.WriteLine(String.Format("QUIT :{0} to {1} wormhole to {2} closing",
m_nick, m_channel, m_server));
m_writer.Flush();
listener.Abort();
pingSender.Abort();
m_connected = false;
m_enabled = false;
// listener.Abort();
// pingSender.Abort();
m_writer.Close();
m_reader.Close();
m_tcp.Close();
}
}

View File

@ -169,7 +169,8 @@ namespace OpenSim.Region.Environment.Modules.Grid.Interregion
public void Close()
{
ChannelServices.UnregisterChannel(m_tcpChannel);
if (null != m_tcpChannel)
ChannelServices.UnregisterChannel(m_tcpChannel);
}
public string Name

View File

@ -103,7 +103,11 @@ namespace OpenSim.Region.Environment.Scenes
protected BaseHttpServer m_httpListener;
protected Dictionary<string, IRegionModule> Modules = new Dictionary<string, IRegionModule>();
protected Dictionary<string, IRegionModule> m_modules = new Dictionary<string, IRegionModule>();
public Dictionary<string, IRegionModule> Modules
{
get { return m_modules; }
}
protected Dictionary<Type, object> ModuleInterfaces = new Dictionary<Type, object>();
protected Dictionary<string, object> ModuleAPIMethods = new Dictionary<string, object>();
protected Dictionary<string, ICommander> m_moduleCommanders = new Dictionary<string, ICommander>();

View File

@ -32,6 +32,7 @@ using System.Reflection;
using libsecondlife;
using log4net;
using OpenSim.Framework;
using OpenSim.Region.Environment.Interfaces;
namespace OpenSim.Region.Environment.Scenes
{
@ -78,10 +79,27 @@ namespace OpenSim.Region.Environment.Scenes
public void Close()
{
// collect known shared modules in sharedModules
Dictionary<string, IRegionModule> sharedModules = new Dictionary<string, IRegionModule>();
for (int i = 0; i < m_localScenes.Count; i++)
{
// extract known shared modules from scene
foreach(string k in m_localScenes[i].Modules.Keys)
{
if (m_localScenes[i].Modules[k].IsSharedModule &&
!sharedModules.ContainsKey(k))
sharedModules[k] = m_localScenes[i].Modules[k];
}
// close scene/region
m_localScenes[i].Close();
}
// all regions/scenes are now closed, we can now safely
// close all shared modules
foreach(IRegionModule mod in sharedModules.Values)
{
mod.Close();
}
}
public void Close(Scene cscene)