From 223550b7e4f9eb534728e7763642a2ba6154be96 Mon Sep 17 00:00:00 2001 From: MW Date: Wed, 27 Jun 2007 15:03:54 +0000 Subject: Some very Preliminary work on .net remoting for interregion comms. a few more classes for CAPS LLSD types. --- .../GridCommsManager.cs | 5 +- .../OGS1GridServices.cs | 77 +++++++++++++++++++--- .../OGSInterSimComms.cs | 53 ++++++++++++++- .../OpenGrid.Framework.Communications.OGS1.csproj | 46 +++++++------ 4 files changed, 151 insertions(+), 30 deletions(-) (limited to 'Common/OpenGrid.Framework.Communications.OGS1') diff --git a/Common/OpenGrid.Framework.Communications.OGS1/GridCommsManager.cs b/Common/OpenGrid.Framework.Communications.OGS1/GridCommsManager.cs index 308e00f..563eaf7 100644 --- a/Common/OpenGrid.Framework.Communications.OGS1/GridCommsManager.cs +++ b/Common/OpenGrid.Framework.Communications.OGS1/GridCommsManager.cs @@ -7,10 +7,11 @@ namespace OpenGrid.Framework.Communications.OGS1 { public class GridCommsManager : CommunicationsManager { + private OGS1GridServices gridInterComms = new OGS1GridServices(); public GridCommsManager(NetworkServersInfo serversInfo) :base(serversInfo) { - GridServer = new OGS1GridServices(); - InterRegion = new OGSInterSimComms(); + GridServer = gridInterComms; + InterRegion = gridInterComms; UserServer = new OGSUserServices(); } } diff --git a/Common/OpenGrid.Framework.Communications.OGS1/OGS1GridServices.cs b/Common/OpenGrid.Framework.Communications.OGS1/OGS1GridServices.cs index a67f55d..db64f0c 100644 --- a/Common/OpenGrid.Framework.Communications.OGS1/OGS1GridServices.cs +++ b/Common/OpenGrid.Framework.Communications.OGS1/OGS1GridServices.cs @@ -2,9 +2,11 @@ using System; using System.Collections.Generic; using System.Collections; using System.Text; +using System.Runtime.Remoting; +using System.Runtime.Remoting.Channels; +using System.Runtime.Remoting.Channels.Tcp; using OpenSim.Servers; - using OpenSim.Framework; using OpenSim.Framework.Types; using OpenGrid.Framework.Communications; @@ -14,7 +16,7 @@ using libsecondlife; namespace OpenGrid.Framework.Communications.OGS1 { - public class OGS1GridServices : IGridServices + public class OGS1GridServices : IGridServices, IInterRegionCommunications { public Dictionary listeners = new Dictionary(); public GridInfo grid; @@ -49,19 +51,19 @@ namespace OpenGrid.Framework.Communications.OGS1 string errorstring = (string)GridRespData["error"]; OpenSim.Framework.Console.MainLog.Instance.Error("Unable to connect to grid: " + errorstring); return null; - } - - // Initialise the background listeners - listeners[regionInfo.RegionHandle] = new RegionCommsListener(); + } - if (!initialised) + if (!this.listeners.ContainsKey(regionInfo.RegionHandle)) { - initialised = true; + // initialised = true; httpListener = new BaseHttpServer(regionInfo.CommsIPListenPort); httpListener.AddXmlRPCHandler("expect_user", this.ExpectUser); httpListener.Start(); } + // Initialise the background listeners + listeners[regionInfo.RegionHandle] = new RegionCommsListener(); + return listeners[regionInfo.RegionHandle]; } @@ -182,6 +184,65 @@ namespace OpenGrid.Framework.Communications.OGS1 return new XmlRpcResponse(); } + #region InterRegion Comms + private void StartRemoting() + { + TcpChannel ch = new TcpChannel(8895); + ChannelServices.RegisterChannel(ch); + + WellKnownServiceTypeEntry wellType = new WellKnownServiceTypeEntry( Type.GetType("OGS1InterRegionRemoting"), "InterRegions", WellKnownObjectMode.Singleton); + RemotingConfiguration.RegisterWellKnownServiceType(wellType); + InterRegionSingleton.Instance.OnArrival += this.IncomingArrival; + InterRegionSingleton.Instance.OnChildAgent += this.IncomingChildAgent; + } + + #region Methods called by regions in this instance + public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) + { + if (this.listeners.ContainsKey(regionHandle)) + { + this.listeners[regionHandle].TriggerExpectUser(regionHandle, agentData); + return true; + } + //TODO need to see if we know about where this region is and use .net remoting + // to inform it. + return false; + } + public bool ExpectAvatarCrossing(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position) + { + if (this.listeners.ContainsKey(regionHandle)) + { + this.listeners[regionHandle].TriggerExpectAvatarCrossing(regionHandle, agentID, position); + return true; + } + //TODO need to see if we know about where this region is and use .net remoting + // to inform it. + return false; + } + #endregion + + #region Methods triggered by calls from external instances + public bool IncomingChildAgent(ulong regionHandle, AgentCircuitData agentData) + { + if (this.listeners.ContainsKey(regionHandle)) + { + this.listeners[regionHandle].TriggerExpectUser(regionHandle, agentData); + return true; + } + return false; + } + + public bool IncomingArrival(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position) + { + if (this.listeners.ContainsKey(regionHandle)) + { + this.listeners[regionHandle].TriggerExpectAvatarCrossing(regionHandle, agentID, position); + return true; + } + return false; + } + #endregion + #endregion } } diff --git a/Common/OpenGrid.Framework.Communications.OGS1/OGSInterSimComms.cs b/Common/OpenGrid.Framework.Communications.OGS1/OGSInterSimComms.cs index 0024d14..3d74e2f 100644 --- a/Common/OpenGrid.Framework.Communications.OGS1/OGSInterSimComms.cs +++ b/Common/OpenGrid.Framework.Communications.OGS1/OGSInterSimComms.cs @@ -5,15 +5,66 @@ using OpenSim.Framework.Types; using OpenGrid.Framework.Communications; namespace OpenGrid.Framework.Communications.OGS1 { - public class OGSInterSimComms : IInterRegionCommunications + public delegate bool InformRegionChild(ulong regionHandle, AgentCircuitData agentData); + public delegate bool ExpectArrival(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position); + + public sealed class InterRegionSingleton { + static readonly InterRegionSingleton instance = new InterRegionSingleton(); + + public event InformRegionChild OnChildAgent; + public event ExpectArrival OnArrival; + + static InterRegionSingleton() + { + } + + InterRegionSingleton() + { + } + + public static InterRegionSingleton Instance + { + get + { + return instance; + } + } + public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) { + if (OnChildAgent != null) + { + return OnChildAgent(regionHandle, agentData); + } return false; } + public bool ExpectAvatarCrossing(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position) { + if (OnArrival != null) + { + return OnArrival(regionHandle, agentID, position); + } return false; } } + + public class OGS1InterRegionRemoting : MarshalByRefObject + { + + public OGS1InterRegionRemoting() + { + } + + public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) + { + return InterRegionSingleton.Instance.InformRegionOfChildAgent(regionHandle, agentData); + } + + public bool ExpectAvatarCrossing(ulong regionHandle, libsecondlife.LLUUID agentID, libsecondlife.LLVector3 position) + { + return InterRegionSingleton.Instance.ExpectAvatarCrossing(regionHandle, agentID, position); + } + } } diff --git a/Common/OpenGrid.Framework.Communications.OGS1/OpenGrid.Framework.Communications.OGS1.csproj b/Common/OpenGrid.Framework.Communications.OGS1/OpenGrid.Framework.Communications.OGS1.csproj index 3f4f22d..00246e1 100644 --- a/Common/OpenGrid.Framework.Communications.OGS1/OpenGrid.Framework.Communications.OGS1.csproj +++ b/Common/OpenGrid.Framework.Communications.OGS1/OpenGrid.Framework.Communications.OGS1.csproj @@ -1,4 +1,4 @@ - + Local 8.0.50727 @@ -6,7 +6,8 @@ {17442AF1-0000-0000-0000-000000000000} Debug AnyCPU - + + OpenGrid.Framework.Communications.OGS1 @@ -15,9 +16,11 @@ IE50 false Library - + + OpenGrid.Framework.Communications.OGS1 - + + @@ -28,7 +31,8 @@ TRACE;DEBUG - + + True 4096 False @@ -37,7 +41,8 @@ False False 4 - + + False @@ -46,7 +51,8 @@ TRACE - + + False 4096 True @@ -55,22 +61,24 @@ False False 4 - + + - + ..\..\bin\libsecondlife.dll False - + System.dll False - + System.Data.dll False - + + System.Xml.dll False @@ -80,37 +88,37 @@ OpenGrid.Framework.Communications {683344D5-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenGrid.Framework.Data {62CDF671-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework {8ACA2445-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Framework.Console {A7CD0630-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False OpenSim.Servers {8BB20F0A-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False XMLRPC {8E81D43C-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False @@ -137,4 +145,4 @@ - + \ No newline at end of file -- cgit v1.1