From f2b175ef08066649a13b6a42f0a59d9bee503638 Mon Sep 17 00:00:00 2001
From: Teravus Ovares
Date: Sun, 9 Dec 2007 05:59:49 +0000
Subject: * Added some inter-region comms glue for allowing sims to chat
amongst themsevles about an agent behind the agent's back. * Will be using
this glue Tomorrow/today to tell other regions what the agent's draw distance
is and what region they're actually in so the region can make decisions on
what prim to send, if any.
---
OpenSim/Framework/ChildAgentDataUpdate.cs | 23 ++++++
.../Communications/IInterRegionCommunications.cs | 1 +
OpenSim/Framework/IRegionCommsListener.cs | 3 +
OpenSim/Framework/RegionCommsListener.cs | 11 +++
.../Communications/Local/LocalBackEndServices.cs | 22 ++++++
.../Region/Communications/OGS1/OGS1GridServices.cs | 86 ++++++++++++++++++++++
.../Communications/OGS1/OGS1InterSimComms.cs | 26 +++++++
7 files changed, 172 insertions(+)
create mode 100644 OpenSim/Framework/ChildAgentDataUpdate.cs
(limited to 'OpenSim')
diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs
new file mode 100644
index 0000000..c48f53a
--- /dev/null
+++ b/OpenSim/Framework/ChildAgentDataUpdate.cs
@@ -0,0 +1,23 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace OpenSim.Framework
+{
+ [Serializable]
+ public class ChildAgentDataUpdate
+ {
+ public ChildAgentDataUpdate()
+ {
+
+ }
+ public sLLVector3 Position;
+ public ulong regionHandle;
+ public float drawdistance;
+ public sLLVector3 cameraPosition;
+ public sLLVector3 Velocity;
+ public float AVHeight;
+ public Guid AgentID;
+ public float godlevel;
+ }
+}
diff --git a/OpenSim/Framework/Communications/IInterRegionCommunications.cs b/OpenSim/Framework/Communications/IInterRegionCommunications.cs
index e025223..e20c627 100644
--- a/OpenSim/Framework/Communications/IInterRegionCommunications.cs
+++ b/OpenSim/Framework/Communications/IInterRegionCommunications.cs
@@ -36,6 +36,7 @@ namespace OpenSim.Framework.Communications
bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData);
bool InformRegionOfPrimCrossing(ulong regionHandle, LLUUID primID, string objData);
bool RegionUp(SearializableRegionInfo region, ulong regionhandle);
+ bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData);
bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying);
bool ExpectPrimCrossing(ulong regionHandle, LLUUID primID, LLVector3 position, bool isFlying);
diff --git a/OpenSim/Framework/IRegionCommsListener.cs b/OpenSim/Framework/IRegionCommsListener.cs
index 53d0059..5f20362 100644
--- a/OpenSim/Framework/IRegionCommsListener.cs
+++ b/OpenSim/Framework/IRegionCommsListener.cs
@@ -48,6 +48,8 @@ namespace OpenSim.Framework
public delegate bool RegionUp(RegionInfo region);
+ public delegate bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData);
+
public interface IRegionCommsListener
@@ -62,6 +64,7 @@ namespace OpenSim.Framework
event UpdateNeighbours OnNeighboursUpdate;
event CloseAgentConnection OnCloseAgentConnection;
event RegionUp OnRegionUp;
+ event ChildAgentUpdate OnChildAgentUpdate;
}
}
\ No newline at end of file
diff --git a/OpenSim/Framework/RegionCommsListener.cs b/OpenSim/Framework/RegionCommsListener.cs
index d209ff4..62c477b 100644
--- a/OpenSim/Framework/RegionCommsListener.cs
+++ b/OpenSim/Framework/RegionCommsListener.cs
@@ -43,6 +43,7 @@ namespace OpenSim.Framework
public event AcknowledgePrimCross OnAcknowledgePrimCrossed;
public event CloseAgentConnection OnCloseAgentConnection;
public event RegionUp OnRegionUp;
+ public event ChildAgentUpdate OnChildAgentUpdate;
public string debugRegionName="";
@@ -81,6 +82,16 @@ namespace OpenSim.Framework
return false;
}
+ public virtual bool TriggerChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData)
+ {
+ if (OnChildAgentUpdate != null)
+ {
+ OnChildAgentUpdate(regionHandle, cAgentData);
+ return true;
+ }
+ return false;
+ }
+
public virtual bool TriggerExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position,
bool isFlying)
{
diff --git a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
index 9d390e4..1bf9801 100644
--- a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
+++ b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
@@ -205,6 +205,19 @@ namespace OpenSim.Region.Communications.Local
return false;
}
+ public virtual bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData)
+ {
+ if (m_regionListeners.ContainsKey(regionHandle))
+ {
+ // Console.WriteLine("CommsManager- Informing a region to expect child agent");
+ m_regionListeners[regionHandle].TriggerChildAgentUpdate(regionHandle, cAgentData);
+ //MainLog.Instance.Verbose("INTER", rdebugRegionName + ":Local BackEnd: Got Listener trigginering local event: " + agentData.firstname + " " + agentData.lastname);
+
+ return true;
+ }
+ return false;
+ }
+
public bool TriggerRegionUp(RegionInfo region, ulong regionhandle)
{
if (m_regionListeners.ContainsKey(regionhandle))
@@ -215,6 +228,15 @@ namespace OpenSim.Region.Communications.Local
return false;
}
+ public bool TriggerChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData)
+ {
+ if (m_regionListeners.ContainsKey(regionHandle))
+ {
+ return m_regionListeners[regionHandle].TriggerChildAgentUpdate(regionHandle,cAgentData);
+ }
+ return false;
+ }
+
///
///
///
diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
index 978111f..c556188 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
@@ -462,12 +462,83 @@ namespace OpenSim.Region.Communications.OGS1
InterRegionSingleton.Instance.OnPrimGroupArrival += IncomingPrim;
InterRegionSingleton.Instance.OnPrimGroupNear += TriggerExpectPrimCrossing;
InterRegionSingleton.Instance.OnRegionUp += TriggerRegionUp;
+ InterRegionSingleton.Instance.OnChildAgentUpdate += TriggerChildAgentUpdate;
//InterRegionSingleton.Instance.OnRegionUp += RegionUp;
}
#region Methods called by regions in this instance
+ public bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData)
+ {
+ RegionInfo regInfo = null;
+ try
+ {
+ if (m_localBackend.ChildAgentUpdate(regionHandle, cAgentData))
+ {
+ return true;
+ }
+
+ 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.ChildAgentUpdate(regionHandle, cAgentData);
+ }
+ else
+ {
+ Console.WriteLine("remoting object not found");
+ }
+ remObject = null;
+ MainLog.Instance.Verbose("INTER", gdebugRegionName + ": OGS1 tried to Update Child Agent data on outside region and got " + retValue.ToString());
+
+ return retValue;
+ }
+
+ return false;
+ }
+ catch (RemotingException e)
+ {
+ MainLog.Instance.Warn("Remoting Error: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
+ MainLog.Instance.Debug(e.ToString());
+ return false;
+ }
+ catch (SocketException e)
+ {
+ MainLog.Instance.Warn("Socket Error: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
+ MainLog.Instance.Debug(e.ToString());
+ return false;
+ }
+ catch (InvalidCredentialException e)
+ {
+ MainLog.Instance.Warn("Invalid Credentials: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
+ MainLog.Instance.Debug(e.ToString());
+ return false;
+ }
+ catch (AuthenticationException e)
+ {
+ MainLog.Instance.Warn("Authentication exception: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
+ MainLog.Instance.Debug(e.ToString());
+ return false;
+ }
+ catch (Exception e)
+ {
+ MainLog.Instance.Warn("Unknown exception: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
+ MainLog.Instance.Debug(e.ToString());
+ return false;
+ }
+ }
///
///
@@ -877,6 +948,21 @@ namespace OpenSim.Region.Communications.OGS1
return false;
}
}
+ public bool TriggerChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData)
+ {
+ MainLog.Instance.Verbose("INTER", "Incoming OGS1 Child Agent Data Update");
+
+ try
+ {
+ return m_localBackend.TriggerChildAgentUpdate(regionHandle, cAgentData);
+ }
+ catch (RemotingException e)
+ {
+ MainLog.Instance.Error("Remoting Error: Unable to connect to adjacent region.\n" + e.ToString());
+ return false;
+ }
+
+ }
///
///
diff --git a/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs b/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs
index a7636da..683c471 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs
@@ -43,6 +43,8 @@ namespace OpenSim.Region.Communications.OGS1
public delegate bool RegionUp (SearializableRegionInfo region, ulong regionhandle);
+ public delegate bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate childUpdate);
+
public sealed class InterRegionSingleton
{
private static readonly InterRegionSingleton instance = new InterRegionSingleton();
@@ -52,6 +54,7 @@ namespace OpenSim.Region.Communications.OGS1
public event InformRegionPrimGroup OnPrimGroupNear;
public event PrimGroupArrival OnPrimGroupArrival;
public event RegionUp OnRegionUp;
+ public event ChildAgentUpdate OnChildAgentUpdate;
static InterRegionSingleton()
@@ -86,6 +89,15 @@ namespace OpenSim.Region.Communications.OGS1
return false;
}
+ public bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentUpdate)
+ {
+ if (OnChildAgentUpdate != null)
+ {
+ return OnChildAgentUpdate(regionHandle, cAgentUpdate);
+ }
+ return false;
+ }
+
public bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying)
{
if (OnArrival != null)
@@ -143,6 +155,20 @@ namespace OpenSim.Region.Communications.OGS1
}
}
+ public bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData)
+ {
+ try
+ {
+ return InterRegionSingleton.Instance.ChildAgentUpdate(regionHandle,cAgentData);
+ }
+ catch (RemotingException e)
+ {
+ Console.WriteLine("Remoting Error: Unable to send Child agent update to remote region.\n" + e.ToString());
+ return false;
+ }
+
+ }
+
public bool ExpectAvatarCrossing(ulong regionHandle, Guid agentID, sLLVector3 position, bool isFlying)
{
try
--
cgit v1.1