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
parent
1a47ff8094
commit
9590e671e6
|
@ -58,6 +58,12 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
|
||||||
{
|
{
|
||||||
private static XmlSerializerNamespaces _xmlNs;
|
private static XmlSerializerNamespaces _xmlNs;
|
||||||
|
|
||||||
|
static RestRegionPlugin()
|
||||||
|
{
|
||||||
|
_xmlNs = new XmlSerializerNamespaces();
|
||||||
|
_xmlNs.Add(String.Empty, String.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
#region overriding properties
|
#region overriding properties
|
||||||
public override string Name
|
public override string Name
|
||||||
{
|
{
|
||||||
|
@ -91,9 +97,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
|
||||||
}
|
}
|
||||||
m_log.InfoFormat("{0} REST region plugin enabled", MsgID);
|
m_log.InfoFormat("{0} REST region plugin enabled", MsgID);
|
||||||
|
|
||||||
_xmlNs = new XmlSerializerNamespaces();
|
|
||||||
_xmlNs.Add(String.Empty, String.Empty);
|
|
||||||
|
|
||||||
// add REST method handlers
|
// add REST method handlers
|
||||||
AddRestStreamHandler("GET", "/regions/", GetHandler);
|
AddRestStreamHandler("GET", "/regions/", GetHandler);
|
||||||
AddRestStreamHandler("POST", "/regions/", PostHandler);
|
AddRestStreamHandler("POST", "/regions/", PostHandler);
|
||||||
|
|
|
@ -135,6 +135,14 @@ namespace OpenSim.ApplicationPlugins.Rest
|
||||||
get { return _prefix; }
|
get { return _prefix; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Access to GOD password string
|
||||||
|
/// </summary>
|
||||||
|
protected string GodKey
|
||||||
|
{
|
||||||
|
get { return _godkey; }
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Configuration of the plugin
|
/// Configuration of the plugin
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -151,6 +151,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
|
||||||
public void Close()
|
public void Close()
|
||||||
{
|
{
|
||||||
m_irc.Close();
|
m_irc.Close();
|
||||||
|
m_log.Info("[IRC] closed connection to IRC server");
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Name
|
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
|
// if IRC is enabled then just keep trying using a monitor thread
|
||||||
public void IRCConnectRun()
|
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);
|
m_irc.Connect(m_scenes);
|
||||||
}
|
}
|
||||||
|
@ -538,7 +539,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
|
||||||
m_log.Info("[IRC]: ExtractMsg: " + input);
|
m_log.Info("[IRC]: ExtractMsg: " + input);
|
||||||
Dictionary<string, string> result = null;
|
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>.*)";
|
string regex = @":(?<nick>[\w-]*)!(?<user>\S*) PRIVMSG (?<channel>\S+) :(?<msg>.*)";
|
||||||
Regex RE = new Regex(regex, RegexOptions.Multiline);
|
Regex RE = new Regex(regex, RegexOptions.Multiline);
|
||||||
MatchCollection matches = RE.Matches(input);
|
MatchCollection matches = RE.Matches(input);
|
||||||
|
|
||||||
|
@ -566,7 +567,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
|
||||||
{
|
{
|
||||||
// IRC keep alive thread
|
// IRC keep alive thread
|
||||||
// send PING ever 15 seconds
|
// send PING ever 15 seconds
|
||||||
while (true)
|
while (m_enabled)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -578,10 +579,13 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (IOException)
|
catch (IOException)
|
||||||
|
{
|
||||||
|
if (m_enabled)
|
||||||
{
|
{
|
||||||
m_log.Error("[IRC]: Disconnected from IRC server.(PingRun)");
|
m_log.Error("[IRC]: Disconnected from IRC server.(PingRun)");
|
||||||
Reconnect();
|
Reconnect();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[IRC]: PingRun exception trap: {0}\n{1}", ex.ToString(), ex.StackTrace);
|
m_log.ErrorFormat("[IRC]: PingRun exception trap: {0}\n{1}", ex.ToString(), ex.StackTrace);
|
||||||
|
@ -593,7 +597,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
|
||||||
{
|
{
|
||||||
string inputLine;
|
string inputLine;
|
||||||
LLVector3 pos = new LLVector3(128, 128, 20);
|
LLVector3 pos = new LLVector3(128, 128, 20);
|
||||||
while (true)
|
while (m_enabled)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -636,10 +640,13 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (IOException)
|
catch (IOException)
|
||||||
|
{
|
||||||
|
if (m_enabled)
|
||||||
{
|
{
|
||||||
m_log.Error("[IRC]: ListenerRun IOException. Disconnected from IRC server ??? (ListenerRun)");
|
m_log.Error("[IRC]: ListenerRun IOException. Disconnected from IRC server ??? (ListenerRun)");
|
||||||
Reconnect();
|
Reconnect();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[IRC]: ListenerRun exception trap: {0}\n{1}", ex.ToString(), ex.StackTrace);
|
m_log.ErrorFormat("[IRC]: ListenerRun exception trap: {0}\n{1}", ex.ToString(), ex.StackTrace);
|
||||||
|
@ -838,13 +845,19 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
|
||||||
|
|
||||||
public void Close()
|
public void Close()
|
||||||
{
|
{
|
||||||
m_connected = false;
|
m_writer.WriteLine(String.Format("QUIT :{0} to {1} wormhole to {2} closing",
|
||||||
m_writer.WriteLine(String.Format("QUIT :{0} to {1} wormhole with {2} closing", m_nick, m_channel, m_server));
|
m_nick, m_channel, m_server));
|
||||||
m_writer.Flush();
|
m_writer.Flush();
|
||||||
listener.Abort();
|
|
||||||
pingSender.Abort();
|
m_connected = false;
|
||||||
|
m_enabled = false;
|
||||||
|
|
||||||
|
// listener.Abort();
|
||||||
|
// pingSender.Abort();
|
||||||
|
|
||||||
m_writer.Close();
|
m_writer.Close();
|
||||||
m_reader.Close();
|
m_reader.Close();
|
||||||
|
|
||||||
m_tcp.Close();
|
m_tcp.Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -169,6 +169,7 @@ namespace OpenSim.Region.Environment.Modules.Grid.Interregion
|
||||||
|
|
||||||
public void Close()
|
public void Close()
|
||||||
{
|
{
|
||||||
|
if (null != m_tcpChannel)
|
||||||
ChannelServices.UnregisterChannel(m_tcpChannel);
|
ChannelServices.UnregisterChannel(m_tcpChannel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -103,7 +103,11 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
protected BaseHttpServer m_httpListener;
|
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<Type, object> ModuleInterfaces = new Dictionary<Type, object>();
|
||||||
protected Dictionary<string, object> ModuleAPIMethods = new Dictionary<string, object>();
|
protected Dictionary<string, object> ModuleAPIMethods = new Dictionary<string, object>();
|
||||||
protected Dictionary<string, ICommander> m_moduleCommanders = new Dictionary<string, ICommander>();
|
protected Dictionary<string, ICommander> m_moduleCommanders = new Dictionary<string, ICommander>();
|
||||||
|
|
|
@ -32,6 +32,7 @@ using System.Reflection;
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
using log4net;
|
using log4net;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
|
using OpenSim.Region.Environment.Interfaces;
|
||||||
|
|
||||||
namespace OpenSim.Region.Environment.Scenes
|
namespace OpenSim.Region.Environment.Scenes
|
||||||
{
|
{
|
||||||
|
@ -78,10 +79,27 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
public void Close()
|
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++)
|
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();
|
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)
|
public void Close(Scene cscene)
|
||||||
|
|
Loading…
Reference in New Issue