* Updates RESTInterregionComms and LocalInterregionComms to the new region module interface. This fixes an issue where region references were being added but weren't being deleted,

causing those "unnotified circuit" messages.
* Also fixes tests accordingly

- Fixes Mantis #3452
- Fixes Mantis #3388
- Fixes Mantis #3871
- Related to Mantis #3493
trunk
Arthur Valadares 2009-07-23 16:57:41 +00:00
parent a133e83f3a
commit 7bf59c551e
6 changed files with 102 additions and 58 deletions

View File

@ -30,6 +30,8 @@
<RegionModule id="RemoteNeighbourServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour.RemoteNeighbourServicesConnector" />
<RegionModule id="LocalLandServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Land.LocalLandServicesConnector" />
<RegionModule id="RemoteLandServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Land.RemoteLandServicesConnector" />
<RegionModule id="LocalInterregionComms" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion.LocalInterregionComms" />
<RegionModule id="RESTInterregionComms" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion.RESTInterregionComms" />
<!-- Service connectors IN modules -->
<RegionModule id="AssetServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Asset.AssetServiceInConnectorModule" />
<RegionModule id="InventoryServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Inventory.InventoryServiceInConnectorModule" />

View File

@ -36,7 +36,7 @@ using OpenSim.Region.Framework.Scenes;
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
{
public class LocalInterregionComms : IRegionModule, IInterregionCommsOut, IInterregionCommsIn
public class LocalInterregionComms : ISharedRegionModule, IInterregionCommsOut, IInterregionCommsIn
{
private bool m_enabled = false;
@ -50,7 +50,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
#region IRegionModule
public void Initialise(Scene scene, IConfigSource config)
public void Initialise(IConfigSource config)
{
if (m_sceneList.Count == 0)
{
@ -62,30 +62,61 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
m_enabled = true;
}
}
if (!m_enabled)
return;
Init(scene);
}
public void PostInitialise()
{
}
public void AddRegion(Scene scene)
{
}
public void RemoveRegion(Scene scene)
{
if (m_enabled)
{
RemoveScene(scene);
}
}
public void RegionLoaded(Scene scene)
{
if (m_enabled)
{
Init(scene);
}
}
public void Close()
{
}
public Type ReplacableInterface
{
get { return null; }
}
public string Name
{
get { return "LocalInterregionCommsModule"; }
}
public bool IsSharedModule
/// <summary>
/// Can be called from other modules.
/// </summary>
/// <param name="scene"></param>
public void RemoveScene(Scene scene)
{
get { return true; }
lock (m_sceneList)
{
if (m_sceneList.Contains(scene))
{
m_sceneList.Remove(scene);
}
}
}
/// <summary>
/// Can be called from other modules.
/// </summary>

View File

@ -45,7 +45,7 @@ using OpenSim.Region.Framework.Scenes.Serialization;
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
{
public class RESTInterregionComms : IRegionModule, IInterregionCommsOut
public class RESTInterregionComms : ISharedRegionModule, IInterregionCommsOut
{
private bool initialized = false;
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@ -64,53 +64,65 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
#region IRegionModule
public virtual void Initialise(Scene scene, IConfigSource config)
public virtual void Initialise(IConfigSource config)
{
if (!initialized)
IConfig startupConfig = config.Configs["Communications"];
if ((startupConfig == null) || ((startupConfig != null)
&& (startupConfig.GetString("InterregionComms", "RESTComms") == "RESTComms")))
{
initialized = true;
IConfig startupConfig = config.Configs["Communications"];
if ((startupConfig == null)
|| (startupConfig != null)
&& (startupConfig.GetString("InterregionComms", "RESTComms") == "RESTComms"))
{
m_log.Info("[REST COMMS]: Enabling InterregionComms RESTComms module");
m_enabled = true;
if (config.Configs["Hypergrid"] != null)
m_safemode = config.Configs["Hypergrid"].GetBoolean("safemode", false);
InitOnce(scene);
}
m_log.Info("[REST COMMS]: Enabling InterregionComms RESTComms module");
m_enabled = true;
if (config.Configs["Hypergrid"] != null)
m_safemode = config.Configs["Hypergrid"].GetBoolean("safemode", false);
}
if (!m_enabled)
return;
InitEach(scene);
}
public virtual void PostInitialise()
{
if (m_enabled)
AddHTTPHandlers();
}
public virtual void Close()
{
}
public void AddRegion(Scene scene)
{
}
public void RemoveRegion(Scene scene)
{
if (m_enabled)
{
m_localBackend.RemoveScene(scene);
scene.UnregisterModuleInterface<IInterregionCommsOut>(this);
}
}
public void RegionLoaded(Scene scene)
{
if (m_enabled)
{
if (!initialized)
{
InitOnce(scene);
initialized = true;
AddHTTPHandlers();
}
InitEach(scene);
}
}
public Type ReplacableInterface
{
get { return null; }
}
public virtual string Name
{
get { return "RESTInterregionCommsModule"; }
}
public virtual bool IsSharedModule
{
get { return true; }
}
protected virtual void InitEach(Scene scene)
{
m_localBackend.Init(scene);

View File

@ -71,10 +71,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests
scene2 = SceneSetupHelpers.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000, cm);
scene3 = SceneSetupHelpers.SetupScene("Neighbour x-1", UUID.Random(), 999, 1000, cm);
IRegionModule interregionComms = new RESTInterregionComms();
interregionComms.Initialise(scene, new IniConfigSource());
interregionComms.Initialise(scene2, new IniConfigSource());
interregionComms.Initialise(scene3, new IniConfigSource());
ISharedRegionModule interregionComms = new RESTInterregionComms();
interregionComms.Initialise(new IniConfigSource());
interregionComms.PostInitialise();
SceneSetupHelpers.SetupSceneModules(scene, new IniConfigSource(), interregionComms);
SceneSetupHelpers.SetupSceneModules(scene2, new IniConfigSource(), interregionComms);

View File

@ -65,7 +65,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
TestCommunicationsManager cm = new TestCommunicationsManager();
// shared module
IRegionModule interregionComms = new RESTInterregionComms();
ISharedRegionModule interregionComms = new RESTInterregionComms();
Scene sceneA = SceneSetupHelpers.SetupScene("sceneA", sceneAId, 1000, 1000, cm);
SceneSetupHelpers.SetupSceneModules(sceneA, new IniConfigSource(), interregionComms);

View File

@ -214,6 +214,7 @@ namespace OpenSim.Tests.Common.Setup
foreach (IRegionModuleBase module in newModules)
{
module.AddRegion(scene);
module.RegionLoaded(scene);
scene.AddRegionModule(module.Name, module);
}