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
---
.../ClientStack/ClientView.ProcessPackets.cs | 2 +-
.../Communications/Local/LocalBackEndServices.cs | 15 +++---
.../Communications/Local/LocalLoginService.cs | 2 +-
.../Region/Communications/OGS1/OGS1GridServices.cs | 54 ++++++++++++++--------
.../Environment/Modules/DynamicTextureModule.cs | 4 +-
.../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 +-
.../Compiler/Server_API/LSL_BuiltIn_Commands.cs | 2 +-
10 files changed, 78 insertions(+), 42 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
index e526f73..d92127f 100644
--- a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
+++ b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
@@ -519,7 +519,7 @@ namespace OpenSim.Region.ClientStack
{
AssetLandmark lm = new AssetLandmark(lma);
- if (lm.RegionID == m_scene.RegionInfo.SimUUID)
+ if (lm.RegionID == m_scene.RegionInfo.RegionID)
{
TeleportLocalPacket tpLocal = new TeleportLocalPacket();
diff --git a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
index 9a6bc82..fdc3994 100644
--- a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
+++ b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
@@ -72,20 +72,20 @@ namespace OpenSim.Region.Communications.Local
///
///
///
- public List RequestNeighbours(RegionInfo regionInfo)
+ public List RequestNeighbours(uint x, uint y)
{
// Console.WriteLine("Finding Neighbours to " + regionInfo.RegionHandle);
- List neighbours = new List();
+ List neighbours = new List();
- foreach (RegionInfo reg in this.m_regions.Values)
+ foreach (RegionInfo reg in m_regions.Values)
{
// Console.WriteLine("CommsManager- RequestNeighbours() checking region " + reg.RegionLocX + " , "+ reg.RegionLocY);
- if (reg.RegionHandle != regionInfo.RegionHandle)
+ if (reg.RegionLocX != x || reg.RegionLocY != y)
{
//Console.WriteLine("CommsManager- RequestNeighbours() - found a different region in list, checking location");
- if ((reg.RegionLocX > (regionInfo.RegionLocX - 2)) && (reg.RegionLocX < (regionInfo.RegionLocX + 2)))
+ if ((reg.RegionLocX > (x - 2)) && (reg.RegionLocX < (x + 2)))
{
- if ((reg.RegionLocY > (regionInfo.RegionLocY - 2)) && (reg.RegionLocY < (regionInfo.RegionLocY + 2)))
+ if ((reg.RegionLocY > (x - 2)) && (reg.RegionLocY < (x + 2)))
{
neighbours.Add(reg);
}
@@ -223,7 +223,7 @@ namespace OpenSim.Region.Communications.Local
regData["status"] = "active";
regData["handle"] = region.ToString();
- respData[reg.SimUUID.ToStringHyphenated()] = regData;
+ respData[reg.RegionID.ToStringHyphenated()] = regData;
}
}
@@ -254,3 +254,4 @@ namespace OpenSim.Region.Communications.Local
}
}
+
diff --git a/OpenSim/Region/Communications/Local/LocalLoginService.cs b/OpenSim/Region/Communications/Local/LocalLoginService.cs
index 1a92aaa..9c10d04 100644
--- a/OpenSim/Region/Communications/Local/LocalLoginService.cs
+++ b/OpenSim/Region/Communications/Local/LocalLoginService.cs
@@ -127,7 +127,7 @@ namespace OpenSim.Region.Communications.Local
response.SeedCapability = "http://" + reg.ExternalHostName + ":" + this.serversInfo.HttpListenerPort.ToString() + "/CAPS/" + capsPath + "0000/";
// response.SeedCapability = "http://" + reg.ExternalHostName + ":" + this.serversInfo.HttpListenerPort.ToString() + "/CapsSeed/" + capsPath + "0000/";
- theUser.currentAgent.currentRegion = reg.SimUUID;
+ theUser.currentAgent.currentRegion = reg.RegionID;
theUser.currentAgent.currentHandle = reg.RegionHandle;
Login _login = new Login();
diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
index 1264052..1a9584a 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
@@ -30,9 +30,12 @@ using System;
using System.Collections;
using System.Collections.Generic;
using System.Net;
+using System.Net.Sockets;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;
+using System.Security.Authentication;
+
using libsecondlife;
using Nwc.XmlRpc;
using OpenSim.Framework;
@@ -78,7 +81,7 @@ namespace OpenSim.Region.Communications.OGS1
// Login / Authentication
GridParams["authkey"] = serversInfo.GridSendKey;
- GridParams["UUID"] = regionInfo.SimUUID.ToStringHyphenated();
+ GridParams["UUID"] = regionInfo.RegionID.ToStringHyphenated();
GridParams["sim_ip"] = regionInfo.ExternalHostName;
GridParams["sim_port"] = regionInfo.InternalEndPoint.Port.ToString();
GridParams["region_locx"] = regionInfo.RegionLocX.ToString();
@@ -115,12 +118,12 @@ namespace OpenSim.Region.Communications.OGS1
///
///
///
- public List RequestNeighbours(RegionInfo regionInfo)
+ public List RequestNeighbours(uint x, uint y)
{
- Hashtable respData = MapBlockQuery((int)regionInfo.RegionLocX - 1, (int)regionInfo.RegionLocY - 1, (int)regionInfo.RegionLocX + 1, (int)regionInfo.RegionLocY + 1);
+ Hashtable respData = MapBlockQuery((int)x - 1, (int)y - 1, (int)x + 1, (int)y + 1);
- List neighbours = new List();
+ List neighbours = new List();
foreach (ArrayList neighboursList in respData.Values)
{
@@ -128,27 +131,20 @@ namespace OpenSim.Region.Communications.OGS1
{
uint regX = Convert.ToUInt32(neighbourData["x"]);
uint regY = Convert.ToUInt32(neighbourData["y"]);
- if ((regionInfo.RegionLocX != regX) || (regionInfo.RegionLocY != regY))
+ if ((x != regX) || (y != regY))
{
+
string simIp = (string)neighbourData["sim_ip"];
- uint port = Convert.ToUInt32(neighbourData["sim_port"]);
+ int port = Convert.ToInt32(neighbourData["sim_port"]);
string externalUri = (string)neighbourData["sim_uri"];
string externalIpStr = OpenSim.Framework.Utilities.Util.GetHostFromDNS(simIp).ToString();
- IPEndPoint neighbourInternalEndPoint = new IPEndPoint(IPAddress.Parse(externalIpStr), (int)port);
- string neighbourExternalUri = externalUri;
- RegionInfo neighbour = new RegionInfo(regX, regY, neighbourInternalEndPoint, externalIpStr);
-
- //OGS1
- //neighbour.RegionHandle = (ulong)n["regionhandle"]; is now calculated locally
-
- neighbour.RegionName = (string)neighbourData["name"];
+ SimpleRegionInfo sri = new SimpleRegionInfo(regX, regY, simIp, port);
+ sri.RemotingPort = Convert.ToUInt32(neighbourData["remoting_port"]);
+ sri.RegionID = new LLUUID((string)neighbourData["uuid"]);
- //OGS1+
- neighbour.SimUUID = new LLUUID((string)neighbourData["uuid"]);
-
- neighbours.Add(neighbour);
+ neighbours.Add(sri);
}
}
}
@@ -199,7 +195,7 @@ namespace OpenSim.Region.Communications.OGS1
regionInfo.RemotingPort = Convert.ToUInt32((string)responseData["remoting_port"]);
regionInfo.RemotingAddress = internalIpStr;
- regionInfo.SimUUID = new LLUUID((string)responseData["region_UUID"]);
+ regionInfo.RegionID = new LLUUID((string)responseData["region_UUID"]);
regionInfo.RegionName = (string)responseData["region_name"];
return regionInfo;
@@ -365,6 +361,7 @@ namespace OpenSim.Region.Communications.OGS1
OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject(
typeof(OGS1InterRegionRemoting),
"tcp://" + regInfo.RemotingAddress + ":" + regInfo.RemotingPort + "/InterRegions");
+
if (remObject != null)
{
retValue = remObject.InformRegionOfChildAgent(regionHandle, agentData);
@@ -386,10 +383,27 @@ namespace OpenSim.Region.Communications.OGS1
MainLog.Instance.Error("Remoting Error: Unable to connect to remote region.\n" + e.ToString());
return false;
}
- catch
+ catch (SocketException e)
+ {
+ MainLog.Instance.Error("Socket Error: Unable to connect to remote region.\n" + e.ToString());
+ return false;
+ }
+ catch (InvalidCredentialException e)
+ {
+ MainLog.Instance.Error("Invalid Credentials: Unable to connect to remote region.\n" + e.ToString());
+ return false;
+ }
+ catch (AuthenticationException e)
+ {
+ MainLog.Instance.Error("Authentication exception: Unable to connect to remote region.\n" + e.ToString());
+ return false;
+ }
+ catch (Exception e)
{
+ MainLog.Instance.Error("Unknown exception: Unable to connect to remote region.\n" + e.ToString());
return false;
}
+ return true;
}
///
diff --git a/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs b/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs
index bac0d59..e776717 100644
--- a/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs
+++ b/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs
@@ -47,9 +47,9 @@ namespace OpenSim.Region.Environment.Modules
public void Initialise(Scene scene)
{
- if (!RegisteredScenes.ContainsKey(scene.RegionInfo.SimUUID))
+ if (!RegisteredScenes.ContainsKey(scene.RegionInfo.RegionID))
{
- RegisteredScenes.Add(scene.RegionInfo.SimUUID, scene);
+ RegisteredScenes.Add(scene.RegionInfo.RegionID, scene);
scene.RegisterModuleInterface(this);
}
}
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)
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs
index 05811e2..4388b31 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs
@@ -1221,7 +1221,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
if (dynamicID == "")
{
IDynamicTextureManager textureManager = this.World.RequestModuleInterface();
- LLUUID createdTexture = textureManager.AddDynamicTextureURL(World.RegionInfo.SimUUID, this.m_host.UUID, contentType, url, extraParams, timer);
+ LLUUID createdTexture = textureManager.AddDynamicTextureURL(World.RegionInfo.RegionID, this.m_host.UUID, contentType, url, extraParams, timer);
return createdTexture.ToStringHyphenated();
}
else
--
cgit v1.1