From 59d7165f40d01b0df5d28a2654da844a9abcd2db Mon Sep 17 00:00:00 2001 From: Brian McBee Date: Sun, 20 Jan 2008 21:11:55 +0000 Subject: Graceful failure of teleport to unavailable regions might actually work now. I blame all bugs on the age of my brain cells. --- .../Communications/IInterRegionCommunications.cs | 2 ++ .../Region/Communications/Local/LocalBackEndServices.cs | 12 ++++++++++++ OpenSim/Region/Communications/OGS1/OGS1GridServices.cs | 14 ++++++-------- .../Environment/Scenes/SceneCommunicationService.cs | 16 ++++++++++++++-- 4 files changed, 34 insertions(+), 10 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/Communications/IInterRegionCommunications.cs b/OpenSim/Framework/Communications/IInterRegionCommunications.cs index e2a96f6..13ae21f 100644 --- a/OpenSim/Framework/Communications/IInterRegionCommunications.cs +++ b/OpenSim/Framework/Communications/IInterRegionCommunications.cs @@ -32,6 +32,8 @@ namespace OpenSim.Framework.Communications public interface IInterRegionCommunications { string rdebugRegionName { get; set; } + bool Available { get; } + void CheckRegion(string address, uint port); bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData); bool InformRegionOfPrimCrossing(ulong regionHandle, LLUUID primID, string objData); bool RegionUp(SearializableRegionInfo region, ulong regionhandle); diff --git a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs index 8cba6fd..5b16e5a 100644 --- a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs +++ b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs @@ -47,6 +47,18 @@ namespace OpenSim.Region.Communications.Local public string _gdebugRegionName = System.String.Empty; + bool m_bAvailable=true; + + public void CheckRegion(string address, uint port) + { + m_bAvailable = true; + } + + public bool Available + { + get { return m_bAvailable; } + } + public string gdebugRegionName { get { return _gdebugRegionName; } diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs index 78dca09..7cd77db 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs @@ -594,9 +594,7 @@ namespace OpenSim.Region.Communications.OGS1 //don't want to be creating a new link to the remote instance every time like we are here bool retValue = false; - checkRegion(regInfo.RemotingAddress, regInfo.RemotingPort); - if (Available) - { + OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( typeof(OGS1InterRegionRemoting), "tcp://" + regInfo.RemotingAddress + @@ -618,7 +616,7 @@ namespace OpenSim.Region.Communications.OGS1 retValue.ToString()); return retValue; - } + } return false; @@ -1091,18 +1089,18 @@ namespace OpenSim.Region.Communications.OGS1 // helper to see if remote region is up bool m_bAvailable = false; - int timeOut = 15000; //15 seconds + int timeOut = 10; //10 seconds - public void checkRegion(string address, uint port) + public void CheckRegion(string address, uint port) { + m_bAvailable = false; IPAddress ia = null; IPAddress.TryParse(address, out ia); IPEndPoint m_EndPoint = new IPEndPoint(ia, (int)port); AsyncCallback ConnectedMethodCallback = new AsyncCallback(ConnectedMethod); Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); IAsyncResult ar = socket.BeginConnect(m_EndPoint, ConnectedMethodCallback, socket); - ar.AsyncWaitHandle.WaitOne(timeOut, false); - socket.Close(); + ar.AsyncWaitHandle.WaitOne(timeOut*1000, false); } public bool Available diff --git a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs index 640cb3b..666edb1 100644 --- a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs @@ -403,6 +403,7 @@ namespace OpenSim.Region.Environment.Scenes public virtual void RequestTeleportToLocation(ScenePresence avatar, ulong regionHandle, LLVector3 position, LLVector3 lookAt, uint flags) { + bool destRegionUp = false; if (regionHandle == m_regionInfo.RegionHandle) { avatar.ControllingClient.SendTeleportLocationStart(); @@ -421,10 +422,21 @@ namespace OpenSim.Region.Environment.Scenes agent.startpos = position; agent.child = true; - - if(m_commsProvider.InterRegion.InformRegionOfChildAgent(regionHandle, agent)) + if (reg.RemotingAddress != "" && reg.RemotingPort != 0) + { + // region is remote. see if it is up + m_commsProvider.InterRegion.CheckRegion(reg.RemotingAddress, reg.RemotingPort); + destRegionUp = m_commsProvider.InterRegion.Available; + } + else + { + // assume local regions are always up + destRegionUp = true; + } + if(destRegionUp) { avatar.Close(); + m_commsProvider.InterRegion.InformRegionOfChildAgent(regionHandle, agent); m_commsProvider.InterRegion.ExpectAvatarCrossing(regionHandle, avatar.ControllingClient.AgentId, position, false); AgentCircuitData circuitdata = avatar.ControllingClient.RequestClientInfo(); -- cgit v1.1