From 175b6115f19f9bad7c81fde625250b3a7f8a33f2 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Mon, 26 Nov 2007 05:02:18 +0000 Subject: * Restarting regions with the estate tools works in sandbox mode. I'm still working on grid mode, however. It doesn't break anything, but that feature doesn't work in grid mode yet either. --- .../Region/Communications/OGS1/OGS1GridServices.cs | 90 ++++++++++++++++++++++ .../Communications/OGS1/OGS1InterSimComms.cs | 26 ++++++- 2 files changed, 115 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Communications/OGS1') diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs index 6b2407a..a0d6bd3 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs @@ -380,6 +380,7 @@ namespace OpenSim.Region.Communications.OGS1 InterRegionSingleton.Instance.OnChildAgent += IncomingChildAgent; InterRegionSingleton.Instance.OnPrimGroupArrival += IncomingPrim; InterRegionSingleton.Instance.OnPrimGroupNear += TriggerExpectPrimCrossing; + InterRegionSingleton.Instance.OnRegionUp += TriggerRegionUp; } @@ -465,6 +466,81 @@ namespace OpenSim.Region.Communications.OGS1 } return true; } + + // UGLY! + public bool RegionUp(RegionInfo region) + { + RegionInfo regInfo = null; + try + { + if (m_localBackend.RegionUp(region)) + { + return true; + } + foreach (RegionInfo remoteInfo in m_remoteRegionInfoCache.Values) + { + regInfo = RequestNeighbourInfo(remoteInfo.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.RegionUp(region); + } + else + { + Console.WriteLine("remoting object not found"); + } + remObject = null; + + } + + } + + + return true; + } + 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; + } + return true; + } /// /// /// @@ -680,6 +756,20 @@ namespace OpenSim.Region.Communications.OGS1 } } + public bool TriggerRegionUp(RegionInfo regionData) + { + try + { + return m_localBackend.TriggerRegionUp(regionData); + } + + 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 70018fd..aa6f59a 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs @@ -41,6 +41,8 @@ namespace OpenSim.Region.Communications.OGS1 public delegate bool PrimGroupArrival(ulong regionHandle, LLUUID primID, string objData); + public delegate bool RegionUP (RegionInfo region); + public sealed class InterRegionSingleton { private static readonly InterRegionSingleton instance = new InterRegionSingleton(); @@ -49,6 +51,8 @@ namespace OpenSim.Region.Communications.OGS1 public event ExpectArrival OnArrival; public event InformRegionPrimGroup OnPrimGroupNear; public event PrimGroupArrival OnPrimGroupArrival; + public event RegionUp OnRegionUp; + static InterRegionSingleton() { @@ -72,6 +76,15 @@ namespace OpenSim.Region.Communications.OGS1 return false; } + public bool RegionUp(RegionInfo region) + { + if (OnRegionUp != null) + { + return OnRegionUp(region); + } + return false; + } + public bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying) { if (OnArrival != null) @@ -116,7 +129,18 @@ namespace OpenSim.Region.Communications.OGS1 return false; } } - + public bool RegionUp(RegionInfo region) + { + try + { + return InterRegionSingleton.Instance.RegionUp(region); + } + catch (RemotingException e) + { + Console.WriteLine("Remoting Error: Unable to connect to remote region.\n" + e.ToString()); + return false; + } + } public bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying) { try -- cgit v1.1