From 05df8571323c535b5c1ce1b0532e88236b143b7e Mon Sep 17 00:00:00 2001 From: Tleiades Hax Date: Thu, 18 Oct 2007 15:10:43 +0000 Subject: Possible fix for: Remoting exceptions with adjacent non-running sims. Bugs 449, 454, 408, 244, 197 implemented InformClientOfNeighbours as an asynchroneous process, handling timeouts without blocking the main thread. Improved logging of errors, removed catch all in try catch --- .../Region/Environment/Scenes/Scene.Inventory.cs | 2 +- OpenSim/Region/Environment/Scenes/Scene.cs | 33 ++++++++++++++++++---- .../Region/Environment/Scenes/SceneObjectGroup.cs | 4 +-- OpenSim/Region/Environment/Scenes/ScenePresence.cs | 2 +- 4 files changed, 31 insertions(+), 10 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes') diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index 567fbd9..ee515ea 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs @@ -403,7 +403,7 @@ namespace OpenSim.Region.Environment.Scenes } storageManager.DataStore.RemoveObject(((SceneObjectGroup) selectedEnt).UUID, - m_regInfo.SimUUID); + m_regInfo.RegionID); ((SceneObjectGroup) selectedEnt).DeleteGroup(); lock (Entities) diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index b0f0b9a..ab8a48a 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -26,6 +26,7 @@ * */ using System; +using System.Net; using System.Collections.Generic; using System.IO; using System.Threading; @@ -529,7 +530,7 @@ namespace OpenSim.Region.Environment.Scenes public virtual void LoadPrimsFromStorage() { MainLog.Instance.Verbose("Loading objects from datastore"); - List PrimsFromDB = storageManager.DataStore.LoadObjects(m_regInfo.SimUUID); + List PrimsFromDB = storageManager.DataStore.LoadObjects(m_regInfo.RegionID); foreach (SceneObjectGroup prim in PrimsFromDB) { AddEntityFromStorage(prim); @@ -964,7 +965,7 @@ namespace OpenSim.Region.Environment.Scenes if (Entities.ContainsKey(entID)) { Entities.Remove(entID); - storageManager.DataStore.RemoveObject(entID, m_regInfo.SimUUID); + storageManager.DataStore.RemoveObject(entID, m_regInfo.RegionID); return true; } return false; @@ -1062,13 +1063,32 @@ namespace OpenSim.Region.Environment.Scenes } } + delegate void InformClientOfNeighbourDelegate(IClientAPI remoteClient, AgentCircuitData a, ulong regionHandle, IPEndPoint endPoint); + + /// + /// Async compnent for informing client of which neighbours exists + /// + /// + /// This needs to run asynchronesously, as a network timeout may block the thread for a long while + /// + /// + /// + /// + /// + public void InformClientOfNeighbourAsync(IClientAPI remoteClient, AgentCircuitData a, ulong regionHandle, IPEndPoint endPoint) + { + bool regionAccepted = commsManager.InterRegion.InformRegionOfChildAgent(regionHandle, a); + + if (regionAccepted) + remoteClient.InformClientOfNeighbour(regionHandle, endPoint); + } + /// /// /// public void InformClientOfNeighbours(IClientAPI remoteClient) { - List neighbours = commsManager.GridService.RequestNeighbours(m_regInfo); - + List neighbours = commsManager.GridService.RequestNeighbours(m_regInfo.RegionLocX, m_regInfo.RegionLocY); if (neighbours != null) { for (int i = 0; i < neighbours.Count; i++) @@ -1078,8 +1098,9 @@ namespace OpenSim.Region.Environment.Scenes agent.InventoryFolder = LLUUID.Zero; agent.startpos = new LLVector3(128, 128, 70); agent.child = true; - commsManager.InterRegion.InformRegionOfChildAgent(neighbours[i].RegionHandle, agent); - remoteClient.InformClientOfNeighbour(neighbours[i].RegionHandle, neighbours[i].ExternalEndPoint); + + InformClientOfNeighbourDelegate d = new InformClientOfNeighbourDelegate(InformClientOfNeighbourAsync); + IAsyncResult asyncInform = d.BeginInvoke(remoteClient, agent, neighbours[i].RegionHandle, neighbours[i].ExternalEndPoint, null, null); //this.capsHandlers[remoteClient.AgentId].CreateEstablishAgentComms("", System.Net.IPAddress.Parse(neighbours[i].CommsIPListenAddr) + ":" + neighbours[i].CommsIPListenPort); } } diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 9f8ea0c..21edbac 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs @@ -197,7 +197,7 @@ namespace OpenSim.Region.Environment.Scenes { if (m_scene != null) { - return m_scene.RegionInfo.SimUUID; + return m_scene.RegionInfo.RegionID; } return LLUUID.Zero; } @@ -1173,7 +1173,7 @@ namespace OpenSim.Region.Environment.Scenes { if (HasChanged) { - datastore.StoreObject(this, m_scene.RegionInfo.SimUUID); + datastore.StoreObject(this, m_scene.RegionInfo.RegionID); HasChanged = false; } } diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 22a0754..2f5829a 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs @@ -770,7 +770,7 @@ namespace OpenSim.Region.Environment.Scenes protected void CheckForSignificantMovement() { - if (Helpers.VecDist(AbsolutePosition, posLastSignificantMove) > 2.0) + if (AbsolutePosition.GetDistanceTo(posLastSignificantMove) > 2.0) { posLastSignificantMove = AbsolutePosition; if (OnSignificantClientMovement != null) -- cgit v1.1