From bafa5a3693ec054670ae19d115a5d0734ef7a68f Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sun, 28 Dec 2008 19:15:20 +0000 Subject: Demonstration code for modular comms. No user functionality --- .../Environment/Interfaces/IInterregionComms.cs | 4 +++ .../Modules/Framework/InterregionComms.cs | 37 +++++++++++++++++++--- 2 files changed, 37 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Environment/Interfaces/IInterregionComms.cs b/OpenSim/Region/Environment/Interfaces/IInterregionComms.cs index d2b5dad..37cf2de 100644 --- a/OpenSim/Region/Environment/Interfaces/IInterregionComms.cs +++ b/OpenSim/Region/Environment/Interfaces/IInterregionComms.cs @@ -31,8 +31,12 @@ using OpenMetaverse; namespace OpenSim.Region.Environment.Interfaces { + public delegate void InterregionDataReceived(InterregionData data); + public interface IInterregionComms : IRegionModule { + event InterregionDataReceived OnInterregionData; + bool SendInterregionData(UUID destination, InterregionData data); } } diff --git a/OpenSim/Region/Environment/Modules/Framework/InterregionComms.cs b/OpenSim/Region/Environment/Modules/Framework/InterregionComms.cs index 9fe17d6..f6bcf88 100644 --- a/OpenSim/Region/Environment/Modules/Framework/InterregionComms.cs +++ b/OpenSim/Region/Environment/Modules/Framework/InterregionComms.cs @@ -47,13 +47,27 @@ namespace OpenSim.Region.Environment.Modules.Framework public class InterregionCommsModule : IInterregionComms { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private Scene m_Scene = null; + private List m_SceneList = new List(); + public event InterregionDataReceived OnInterregionData; + public void Initialise(Scene scene, IConfigSource config) { - m_Scene = scene; + if (m_SceneList.Count == 0) + { + // Do first-time only init here + // + } + + if (!m_SceneList.Contains(scene)) + { + lock(m_SceneList) + { + m_SceneList.Add(scene); + scene.RegisterModuleInterface(this); + } - m_Scene.RegisterModuleInterface(this); + } } public void PostInitialise() @@ -71,11 +85,26 @@ namespace OpenSim.Region.Environment.Modules.Framework public bool IsSharedModule { - get { return false; } + get { return true; } } public bool SendInterregionData(UUID destination, InterregionData data) { + lock(m_SceneList) + { + foreach(Scene s in m_SceneList) + { + if (s.RegionInfo.RegionID == destination) + { + if (OnInterregionData != null) + OnInterregionData(data); + return true; + } + } + } + + // Implement remote sending here + // return false; } } -- cgit v1.1