From 7cb38712d5ad6781e672e4f1c8500ecd88d85f3e Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Wed, 21 Nov 2007 02:17:24 +0000 Subject: * Did some initial work for prim crossing. Just glue so far. * Added the child_get_tasks OpenSim.ini flag for testing the UDP packet sending code and packet throttler. This flag gets purposely disabled in grid mode. This flag also has the consequence that you can see the prim in neighboring regions without going into them. Be warned, this causes tons of dropped packets. --- .../Region/Communications/OGS1/OGS1GridServices.cs | 164 +++++++++++++++++++++ .../Communications/OGS1/OGS1InterSimComms.cs | 48 ++++++ 2 files changed, 212 insertions(+) (limited to 'OpenSim/Region/Communications/OGS1') diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs index d355f92..fe46632 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs @@ -63,6 +63,7 @@ namespace OpenSim.Region.Communications.OGS1 { serversInfo = servers_info; httpServer = httpServe; + //Respond to Grid Services requests httpServer.AddXmlRPCHandler("expect_user", ExpectUser); httpServer.AddXmlRPCHandler("check", PingCheckReply); @@ -340,7 +341,12 @@ namespace OpenSim.Region.Communications.OGS1 return new XmlRpcResponse(); } + + + + + #region m_interRegion Comms /// @@ -357,16 +363,22 @@ namespace OpenSim.Region.Communications.OGS1 RemotingConfiguration.RegisterWellKnownServiceType(wellType); InterRegionSingleton.Instance.OnArrival += TriggerExpectAvatarCrossing; InterRegionSingleton.Instance.OnChildAgent += IncomingChildAgent; + InterRegionSingleton.Instance.OnPrimGroupArrival += IncomingPrim; + InterRegionSingleton.Instance.OnPrimGroupNear += TriggerExpectPrimCrossing; + } #region Methods called by regions in this instance + + /// /// /// /// /// /// + public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) { try @@ -432,7 +444,78 @@ namespace OpenSim.Region.Communications.OGS1 } return true; } + /// + /// + /// + /// + /// + /// + + public bool InformRegionOfPrimCrossing(ulong regionHandle, LLUUID primID, string objData) + { + try + { + if (m_localBackend.InformRegionOfPrimCrossing(regionHandle,primID, objData)) + { + return true; + } + RegionInfo regInfo = RequestNeighbourInfo(regionHandle); + if (regInfo != null) + { + //don't want to be creating a new link to the remote instance every time like we are here + bool retValue = false; + + + OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting) Activator.GetObject( + typeof (OGS1InterRegionRemoting), + "tcp://" + regInfo.RemotingAddress + + ":" + regInfo.RemotingPort + + "/InterRegions"); + + if (remObject != null) + { + retValue = remObject.InformRegionOfPrimCrossing(regionHandle,primID, objData); + } + else + { + Console.WriteLine("remoting object not found"); + } + remObject = null; + + + return retValue; + } + + return false; + } + catch (RemotingException e) + { + MainLog.Instance.Error("Remoting Error: Unable to connect to remote region.\n" + e.ToString()); + return false; + } + catch (SocketException e) + { + MainLog.Instance.Error("Socket Error: Unable to connect to remote region.\n" + e.ToString()); + return false; + } + catch (InvalidCredentialException e) + { + MainLog.Instance.Error("Invalid Credentials: Unable to connect to remote region.\n" + e.ToString()); + return false; + } + catch (AuthenticationException e) + { + MainLog.Instance.Error("Authentication exception: Unable to connect to remote region.\n" + e.ToString()); + return false; + } + catch (Exception e) + { + MainLog.Instance.Error("Unknown exception: Unable to connect to remote region.\n" + e.ToString()); + return false; + } + return true; + } /// /// /// @@ -484,6 +567,50 @@ namespace OpenSim.Region.Communications.OGS1 return false; } } + public bool ExpectPrimCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isPhysical) + { + try + { + if (m_localBackend.TriggerExpectPrimCrossing(regionHandle, agentID, position, isPhysical)) + { + return true; + } + + RegionInfo regInfo = RequestNeighbourInfo(regionHandle); + if (regInfo != null) + { + bool retValue = false; + OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( + typeof(OGS1InterRegionRemoting), + "tcp://" + regInfo.RemotingAddress + + ":" + regInfo.RemotingPort + + "/InterRegions"); + if (remObject != null) + { + retValue = remObject.ExpectAvatarCrossing(regionHandle, agentID, position, isPhysical); + } + else + { + Console.WriteLine("remoting object not found"); + } + remObject = null; + + return retValue; + } + //TODO need to see if we know about where this region is and use .net remoting + // to inform it. + return false; + } + catch (RemotingException e) + { + MainLog.Instance.Error("Remoting Error: Unable to connect to remote region.\n" + e.ToString()); + return false; + } + catch + { + return false; + } + } public void TellRegionToCloseChildConnection(ulong regionHandle, LLUUID agentID) { @@ -495,6 +622,10 @@ namespace OpenSim.Region.Communications.OGS1 return m_localBackend.AcknowledgeAgentCrossed(regionHandle, agentId); } + public bool AcknowledgePrimCrossed(ulong regionHandle, LLUUID primId) + { + return m_localBackend.AcknowledgePrimCrossed(regionHandle, primId); + } #endregion #region Methods triggered by calls from external instances @@ -522,6 +653,27 @@ namespace OpenSim.Region.Communications.OGS1 /// /// /// + /// + /// + public bool IncomingPrim(ulong regionHandle, LLUUID primID, string objData) + { + // Is this necessary? + try + { + //return m_localBackend.TriggerExpectPrim(regionHandle,primID, objData); + //m_localBackend. + return false; + } + catch (RemotingException e) + { + MainLog.Instance.Error("Remoting Error: Unable to connect to remote region.\n" + e.ToString()); + return false; + } + } + /// + /// + /// + /// /// /// /// @@ -537,6 +689,18 @@ namespace OpenSim.Region.Communications.OGS1 return false; } } + public bool TriggerExpectPrimCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isPhysical) + { + try + { + return m_localBackend.TriggerExpectPrimCrossing(regionHandle, agentID, position, isPhysical); + } + catch (RemotingException e) + { + MainLog.Instance.Error("Remoting Error: Unable to connect to remote region.\n" + e.ToString()); + return false; + } + } #endregion diff --git a/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs b/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs index a127010..70018fd 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs @@ -37,12 +37,18 @@ namespace OpenSim.Region.Communications.OGS1 public delegate bool ExpectArrival(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying); + public delegate bool InformRegionPrimGroup(ulong regionHandle, LLUUID primID, LLVector3 Positon, bool isPhysical); + + public delegate bool PrimGroupArrival(ulong regionHandle, LLUUID primID, string objData); + public sealed class InterRegionSingleton { private static readonly InterRegionSingleton instance = new InterRegionSingleton(); public event InformRegionChild OnChildAgent; public event ExpectArrival OnArrival; + public event InformRegionPrimGroup OnPrimGroupNear; + public event PrimGroupArrival OnPrimGroupArrival; static InterRegionSingleton() { @@ -74,6 +80,22 @@ namespace OpenSim.Region.Communications.OGS1 } return false; } + public bool InformRegionPrim(ulong regionHandle, LLUUID primID, LLVector3 position, bool isPhysical) + { + if (OnPrimGroupNear != null) + { + return OnPrimGroupNear(regionHandle, primID, position, isPhysical); + } + return false; + } + public bool ExpectPrimCrossing(ulong regionHandle, LLUUID primID, string objData) + { + if (OnPrimGroupArrival != null) + { + return OnPrimGroupArrival(regionHandle, primID, objData); + } + return false; + } } public class OGS1InterRegionRemoting : MarshalByRefObject @@ -107,5 +129,31 @@ namespace OpenSim.Region.Communications.OGS1 return false; } } + public bool InformRegionPrim(ulong regionHandle, LLUUID SceneObjectGroupID, LLVector3 position, bool isPhysical) + { + try + { + return InterRegionSingleton.Instance.InformRegionPrim(regionHandle, SceneObjectGroupID, position, isPhysical); + } + catch (RemotingException e) + { + Console.WriteLine("Remoting Error: Unable to connect to remote region.\n" + e.ToString()); + return false; + } + + } + public bool InformRegionOfPrimCrossing(ulong regionHandle,LLUUID primID, string objData) + { + try + { + return InterRegionSingleton.Instance.ExpectPrimCrossing(regionHandle, primID, objData); + } + catch (RemotingException e) + { + Console.WriteLine("Remoting Error: Unable to connect to remote region.\n" + e.ToString()); + return false; + } + } + } } \ No newline at end of file -- cgit v1.1