* 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>
@ -110,21 +141,21 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
#region IInterregionComms
/**
* Agent-related communications
* Agent-related communications
*/
public bool SendCreateChildAgent(ulong regionHandle, AgentCircuitData aCircuit, out string reason)
{
foreach (Scene s in m_sceneList)
{
{
if (s.RegionInfo.RegionHandle == regionHandle)
{
// m_log.DebugFormat("[LOCAL COMMS]: Found region {0} to send SendCreateChildAgent", regionHandle);
return s.NewUserConnection(aCircuit, out reason);
}
}
// m_log.DebugFormat("[LOCAL COMMS]: Did not find region {0} for SendCreateChildAgent", regionHandle);
reason = "Did not find region.";
return false;
@ -137,14 +168,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
if (s.RegionInfo.RegionHandle == regionHandle)
{
//m_log.DebugFormat(
// "[LOCAL COMMS]: Found region {0} {1} to send ChildAgentUpdate",
// "[LOCAL COMMS]: Found region {0} {1} to send ChildAgentUpdate",
// s.RegionInfo.RegionName, regionHandle);
s.IncomingChildAgentDataUpdate(cAgentData);
return true;
}
}
// m_log.DebugFormat("[LOCAL COMMS]: Did not find region {0} for ChildAgentUpdate", regionHandle);
return false;
}
@ -218,7 +249,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
}
/**
* Object-related communications
* Object-related communications
*/
public bool SendCreateObject(ulong regionHandle, SceneObjectGroup sog, bool isLocalCall)

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);
@ -137,7 +149,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
#region IInterregionComms
/**
* Agent-related communications
* Agent-related communications
*/
public bool SendCreateChildAgent(ulong regionHandle, AgentCircuitData aCircuit, out string reason)
@ -257,7 +269,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
}
/**
* Object-related communications
* Object-related communications
*/
public bool SendCreateObject(ulong regionHandle, SceneObjectGroup sog, bool isLocalCall)
@ -527,7 +539,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
protected virtual void DoAgentDelete(Hashtable request, Hashtable responsedata, UUID id, string action, ulong regionHandle)
{
//m_log.Debug(" >>> DoDelete action:" + action + "; regionHandle:" + regionHandle);
if (action.Equals("release"))
m_localBackend.SendReleaseAgent(regionHandle, id, "");
else
@ -613,7 +625,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
extraStr = args["extra"].AsString();
UUID regionID = m_localBackend.GetRegionID(regionhandle);
SceneObjectGroup sog = null;
SceneObjectGroup sog = null;
try
{
sog = SceneObjectSerializer.FromXml2Format(sogXmlStr);
@ -675,7 +687,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
responsedata["str_response_string"] = result.ToString();
}
#endregion
#endregion
#region Misc
@ -707,7 +719,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
UInt64.TryParse(parts[2], out regionHandle);
if (parts.Length >= 4)
action = parts[3];
return true;
}
}
@ -759,7 +771,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
}
#endregion Misc
#endregion Misc
protected class RegionToRegionClient : RegionClient
{

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);
}