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
---
.../Communications/Local/LocalBackEndServices.cs | 15 +++---
.../Communications/Local/LocalLoginService.cs | 2 +-
.../Region/Communications/OGS1/OGS1GridServices.cs | 54 ++++++++++++++--------
3 files changed, 43 insertions(+), 28 deletions(-)
(limited to 'OpenSim/Region/Communications')
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;
}
///
--
cgit v1.1