From 3fe6b2280d0b335ef8d9f2b0dc3406a47e6c0b53 Mon Sep 17 00:00:00 2001
From: Teravus Ovares
Date: Mon, 21 Jan 2008 23:04:42 +0000
Subject: * Shutting down child agents properly in neighbor regions.
---
.../Communications/Local/LocalBackEndServices.cs | 25 ++++++---
.../Region/Communications/OGS1/OGS1GridServices.cs | 64 +++++++++++++++++++++-
.../Communications/OGS1/OGS1InterSimComms.cs | 28 ++++++++++
3 files changed, 107 insertions(+), 10 deletions(-)
(limited to 'OpenSim/Region/Communications')
diff --git a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
index 5b16e5a..25452c1 100644
--- a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
+++ b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
@@ -203,7 +203,14 @@ namespace OpenSim.Region.Communications.Local
}
return mapBlocks;
}
-
+ public bool TellRegionToCloseChildConnection(ulong regionHandle, LLUUID agentID)
+ {
+ if (m_regionListeners.ContainsKey(regionHandle))
+ {
+ return m_regionListeners[regionHandle].TriggerTellRegionToCloseChildConnection(regionHandle, agentID);
+ }
+ return false;
+ }
public virtual bool RegionUp(SearializableRegionInfo sregion, ulong regionhandle)
{
@@ -267,6 +274,14 @@ namespace OpenSim.Region.Communications.Local
return false;
}
+ public bool TriggerTellRegionToCloseChildConnection(ulong regionHandle, LLUUID agentID)
+ {
+ if (m_regionListeners.ContainsKey(regionHandle))
+ {
+ return m_regionListeners[regionHandle].TriggerTellRegionToCloseChildConnection(regionHandle, agentID);
+ }
+ return false;
+ }
///
///
///
@@ -328,13 +343,7 @@ namespace OpenSim.Region.Communications.Local
return false;
}
- public void TellRegionToCloseChildConnection(ulong regionHandle, LLUUID agentID)
- {
- if (m_regionListeners.ContainsKey(regionHandle))
- {
- m_regionListeners[regionHandle].TriggerCloseAgentConnection(regionHandle, agentID);
- }
- }
+
public bool AcknowledgeAgentCrossed(ulong regionHandle, LLUUID agentId)
{
diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
index 2ca9022..683fbfb 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
@@ -491,7 +491,8 @@ namespace OpenSim.Region.Communications.OGS1
InterRegionSingleton.Instance.OnPrimGroupNear += TriggerExpectPrimCrossing;
InterRegionSingleton.Instance.OnRegionUp += TriggerRegionUp;
InterRegionSingleton.Instance.OnChildAgentUpdate += TriggerChildAgentUpdate;
- //InterRegionSingleton.Instance.OnRegionUp += RegionUp;
+ InterRegionSingleton.Instance.OnTellRegionToCloseChildConnection += TriggerTellRegionToCloseChildConnection;
+
}
#region Methods called by regions in this instance
@@ -959,8 +960,53 @@ namespace OpenSim.Region.Communications.OGS1
}
}
- public void TellRegionToCloseChildConnection(ulong regionHandle, LLUUID agentID)
+ public bool TellRegionToCloseChildConnection(ulong regionHandle, LLUUID agentID)
{
+ RegionInfo regInfo = null;
+ try
+ {
+ if (m_localBackend.TriggerTellRegionToCloseChildConnection(regionHandle, agentID))
+ {
+ return true;
+ }
+
+ 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.TellRegionToCloseChildConnection(regionHandle, agentID.UUID);
+ }
+ else
+ {
+ Console.WriteLine("remoting object not found");
+ }
+ remObject = null;
+
+ return true;
+ }
+ //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.Warn("Remoting Error: Unable to connect to adjacent region to tell it to close child agents: " + regInfo.RegionName +
+ " " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
+ //MainLog.Instance.Debug(e.ToString());
+ return false;
+ }
+ catch
+ {
+ return false;
+ }
}
public bool AcknowledgeAgentCrossed(ulong regionHandle, LLUUID agentId)
@@ -1086,6 +1132,20 @@ namespace OpenSim.Region.Communications.OGS1
}
}
+ public bool TriggerTellRegionToCloseChildConnection(ulong regionHandle, LLUUID agentID)
+ {
+ try
+ {
+ return m_localBackend.TriggerTellRegionToCloseChildConnection(regionHandle, agentID);
+ }
+ catch (RemotingException)
+ {
+ MainLog.Instance.Verbose("INTERREGION", "Remoting Error: Unable to connect to neighbour to tell it to close a child connection");
+ return false;
+ }
+
+ }
+
#endregion
#endregion
diff --git a/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs b/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs
index a0da07e..b39e0b7 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs
@@ -45,6 +45,8 @@ namespace OpenSim.Region.Communications.OGS1
public delegate bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate childUpdate);
+ public delegate bool TellRegionToCloseChildConnection(ulong regionHandle, LLUUID agentID);
+
public sealed class InterRegionSingleton
{
private static readonly InterRegionSingleton instance = new InterRegionSingleton();
@@ -55,6 +57,8 @@ namespace OpenSim.Region.Communications.OGS1
public event PrimGroupArrival OnPrimGroupArrival;
public event RegionUp OnRegionUp;
public event ChildAgentUpdate OnChildAgentUpdate;
+ public event TellRegionToCloseChildConnection OnTellRegionToCloseChildConnection;
+
static InterRegionSingleton()
@@ -123,6 +127,16 @@ namespace OpenSim.Region.Communications.OGS1
}
return false;
}
+
+ public bool TellRegionToCloseChildConnection(ulong regionHandle, LLUUID agentID)
+ {
+ if (OnTellRegionToCloseChildConnection != null)
+ {
+
+ return OnTellRegionToCloseChildConnection(regionHandle, agentID);
+ }
+ return false;
+ }
}
public class OGS1InterRegionRemoting : MarshalByRefObject
@@ -171,6 +185,7 @@ namespace OpenSim.Region.Communications.OGS1
}
}
+
public bool ExpectAvatarCrossing(ulong regionHandle, Guid agentID, sLLVector3 position, bool isFlying)
{
try
@@ -215,5 +230,18 @@ namespace OpenSim.Region.Communications.OGS1
return false;
}
}
+ public bool TellRegionToCloseChildConnection(ulong regionHandle, Guid agentID)
+ {
+ try
+ {
+ return InterRegionSingleton.Instance.TellRegionToCloseChildConnection(regionHandle, new LLUUID(agentID));
+
+ }
+ catch (RemotingException)
+ {
+ OpenSim.Framework.Console.MainLog.Instance.Verbose("INTERREGION", "Remoting Error: Unable to connect to remote region: " + regionHandle.ToString());
+ return false;
+ }
+ }
}
}
\ No newline at end of file
--
cgit v1.1