From 81ba94fde8871df86e304a3dad7846059fd32045 Mon Sep 17 00:00:00 2001
From: Teravus Ovares
Date: Thu, 29 Nov 2007 02:07:19 +0000
Subject: * Fixed about 7 issues with restarting sims and resolved interRegion
comms issues. This includes the issue that MW described this morning.
There's a lot of little nit picky changes that make a world of difference.
---
.../Communications/Local/LocalBackEndServices.cs | 29 ++--
.../Region/Communications/OGS1/OGS1GridServices.cs | 183 +++++++++++----------
.../Communications/OGS1/OGS1InterSimComms.cs | 10 +-
3 files changed, 120 insertions(+), 102 deletions(-)
(limited to 'OpenSim/Region/Communications')
diff --git a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
index 0f3ec73..17989d4 100644
--- a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
+++ b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
@@ -194,34 +194,35 @@ namespace OpenSim.Region.Communications.Local
return mapBlocks;
}
- ///
- ///
- ///
- ///
- ///
- ///
- public bool RegionUp(SearializableRegionInfo sregion)
+
+ public bool RegionUp(SearializableRegionInfo sregion, ulong regionhandle)
{
RegionInfo region = new RegionInfo(sregion);
- foreach (RegionCommsListener listener in m_regionListeners.Values)
+ if (m_regionListeners.ContainsKey(regionhandle))
{
- listener.TriggerRegionUp(region);
+ return m_regionListeners[regionhandle].TriggerRegionUp(region);
}
return false;
}
- public bool TriggerRegionUp(RegionInfo region)
+ public bool TriggerRegionUp(RegionInfo region, ulong regionhandle)
{
-
- foreach (RegionCommsListener listener in m_regionListeners.Values)
+
+ if (m_regionListeners.ContainsKey(regionhandle))
{
- listener.TriggerRegionUp(region);
+ return m_regionListeners[regionhandle].TriggerRegionUp(region);
}
- return true;
+ return false;
}
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData)
//should change from agentCircuitData
{
diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
index b0442d2..b91f4c2 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
@@ -248,39 +248,47 @@ namespace OpenSim.Region.Communications.OGS1
}
else
{
- Hashtable requestData = new Hashtable();
- requestData["region_handle"] = regionHandle.ToString();
- requestData["authkey"] = serversInfo.GridSendKey;
- ArrayList SendParams = new ArrayList();
- SendParams.Add(requestData);
- XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams);
- XmlRpcResponse GridResp = GridReq.Send(serversInfo.GridURL, 3000);
+ try
+ {
+ Hashtable requestData = new Hashtable();
+ requestData["region_handle"] = regionHandle.ToString();
+ requestData["authkey"] = serversInfo.GridSendKey;
+ ArrayList SendParams = new ArrayList();
+ SendParams.Add(requestData);
+ XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams);
+ XmlRpcResponse GridResp = GridReq.Send(serversInfo.GridURL, 3000);
- Hashtable responseData = (Hashtable) GridResp.Value;
+ Hashtable responseData = (Hashtable)GridResp.Value;
- if (responseData.ContainsKey("error"))
- {
- Console.WriteLine("error received from grid server" + responseData["error"]);
- return null;
- }
+ if (responseData.ContainsKey("error"))
+ {
+ Console.WriteLine("error received from grid server" + responseData["error"]);
+ return null;
+ }
- uint regX = Convert.ToUInt32((string) responseData["region_locx"]);
- uint regY = Convert.ToUInt32((string) responseData["region_locy"]);
- string internalIpStr = (string) responseData["sim_ip"];
- uint port = Convert.ToUInt32(responseData["sim_port"]);
- string externalUri = (string) responseData["sim_uri"];
+ uint regX = Convert.ToUInt32((string)responseData["region_locx"]);
+ uint regY = Convert.ToUInt32((string)responseData["region_locy"]);
+ string internalIpStr = (string)responseData["sim_ip"];
+ uint port = Convert.ToUInt32(responseData["sim_port"]);
+ string externalUri = (string)responseData["sim_uri"];
- IPEndPoint neighbourInternalEndPoint = new IPEndPoint(IPAddress.Parse(internalIpStr), (int) port);
- string neighbourExternalUri = externalUri;
- regionInfo = new RegionInfo(regX, regY, neighbourInternalEndPoint, internalIpStr);
+ IPEndPoint neighbourInternalEndPoint = new IPEndPoint(IPAddress.Parse(internalIpStr), (int)port);
+ string neighbourExternalUri = externalUri;
+ regionInfo = new RegionInfo(regX, regY, neighbourInternalEndPoint, internalIpStr);
- regionInfo.RemotingPort = Convert.ToUInt32((string) responseData["remoting_port"]);
- regionInfo.RemotingAddress = internalIpStr;
+ regionInfo.RemotingPort = Convert.ToUInt32((string)responseData["remoting_port"]);
+ regionInfo.RemotingAddress = internalIpStr;
- regionInfo.RegionID = new LLUUID((string) responseData["region_UUID"]);
- regionInfo.RegionName = (string) responseData["region_name"];
+ regionInfo.RegionID = new LLUUID((string)responseData["region_UUID"]);
+ regionInfo.RegionName = (string)responseData["region_name"];
- m_remoteRegionInfoCache.Add(regionHandle, regionInfo);
+ m_remoteRegionInfoCache.Add(regionHandle, regionInfo);
+ }
+ catch (System.Net.WebException)
+ {
+ MainLog.Instance.Error("GRID", "Region lookup failed for: " + regionHandle.ToString() + " - Is the GridServer down?");
+ return null;
+ }
}
return regionInfo;
@@ -540,34 +548,33 @@ namespace OpenSim.Region.Communications.OGS1
}
// UGLY!
- public bool RegionUp(SearializableRegionInfo region)
+ public bool RegionUp(SearializableRegionInfo region, ulong regionhandle)
{
-
- // This is stupid. For this to work, when the region registers it must request nearby map blocks.
- // In addition to filling the map blocks, it fills a 'known regions' list.
-
- // This known regions list then gets queried on here to get the remoting data from the neighbors.
- // *Pull yourself up by your bootstraps?*
-
- if (m_localBackend.RegionUp(region))
+ SearializableRegionInfo regInfo = null;
+ try
{
- return true;
- }
-
- foreach (SimpleRegionInfo knownregion in m_knownRegions)
- {
-
- SearializableRegionInfo regInfo = new SearializableRegionInfo(RequestNeighbourInfo(knownregion.RegionID));
-
- try
- {
-
- if ((!(regInfo.Equals(null)) && regInfo.RemotingAddress.Length > 0))
+ // You may ask why this is in here...
+ // The region asking the grid services about itself..
+ // And, surprisingly, the reason is.. it doesn't know
+ // it's own remoting port! How special.
+ region = new SearializableRegionInfo(RequestNeighbourInfo(region.RegionHandle));
+ region.RemotingAddress = region.ExternalHostName;
+ region.RemotingPort = (uint) NetworkServersInfo.RemotingListenerPort;
+ if (m_localBackend.RegionUp(region,regionhandle))
+ {
+ return true;
+ }
+
+ regInfo = new SearializableRegionInfo(RequestNeighbourInfo(regionhandle));
+ if (regInfo != null)
+ {
+ // If we're not trying to remote to ourselves.
+ if (regInfo.RemotingAddress != region.RemotingAddress && region.RemotingAddress != 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 +
@@ -576,49 +583,59 @@ namespace OpenSim.Region.Communications.OGS1
if (remObject != null)
{
- retValue = remObject.RegionUp(region);
+ retValue = remObject.RegionUp(region, regionhandle);
}
else
{
Console.WriteLine("remoting object not found");
}
remObject = null;
- MainLog.Instance.Verbose("INTER", gdebugRegionName + ": OGS1 tried to NotifyRegionUp for " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
+ MainLog.Instance.Verbose("INTER", gdebugRegionName + ": OGS1 tried to inform region I'm up");
+ return retValue;
+ }
+ else
+ {
+ // We're trying to inform ourselves via remoting.
+ // This is here because we're looping over the listeners before we get here.
+ // Odd but it should work.
+ return true;
}
-
- }
- catch (RemotingException e)
- {
- MainLog.Instance.Warn("Remoting Error: Unable to connect to adjacent region: " + 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.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.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.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.RegionLocX + "," + regInfo.RegionLocY);
- MainLog.Instance.Debug(e.ToString());
- //return false;
}
+
+ return false;
+ }
+ catch (RemotingException e)
+ {
+ MainLog.Instance.Warn("Remoting Error: Unable to connect to adjacent region: " + 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.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.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.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.RegionLocX + "," + regInfo.RegionLocY);
+ MainLog.Instance.Debug(e.ToString());
+ return false;
+ }
+
return true;
}
///
@@ -837,13 +854,13 @@ namespace OpenSim.Region.Communications.OGS1
}
}
- public bool TriggerRegionUp(SearializableRegionInfo regionData)
+ public bool TriggerRegionUp(SearializableRegionInfo regionData, ulong regionhandle)
{
MainLog.Instance.Verbose("INTER", gdebugRegionName + ": Incoming OGS1 RegionUpReport: " + regionData.RegionLocX + "," + regionData.RegionLocY);
try
{
- return m_localBackend.TriggerRegionUp(new RegionInfo(regionData));
+ return m_localBackend.TriggerRegionUp(new RegionInfo(regionData), regionhandle);
}
catch (RemotingException e)
diff --git a/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs b/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs
index 2f7e591..d55528c 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs
@@ -41,7 +41,7 @@ namespace OpenSim.Region.Communications.OGS1
public delegate bool PrimGroupArrival(ulong regionHandle, LLUUID primID, string objData);
- public delegate bool RegionUp (SearializableRegionInfo region);
+ public delegate bool RegionUp (SearializableRegionInfo region, ulong regionhandle);
public sealed class InterRegionSingleton
{
@@ -76,12 +76,12 @@ namespace OpenSim.Region.Communications.OGS1
return false;
}
- public bool RegionUp(SearializableRegionInfo sregion)
+ public bool RegionUp(SearializableRegionInfo sregion, ulong regionhandle)
{
if (OnRegionUp != null)
{
- return OnRegionUp(sregion);
+ return OnRegionUp(sregion, regionhandle);
}
return false;
}
@@ -130,11 +130,11 @@ namespace OpenSim.Region.Communications.OGS1
return false;
}
}
- public bool RegionUp(SearializableRegionInfo region)
+ public bool RegionUp(SearializableRegionInfo region, ulong regionhandle)
{
try
{
- return InterRegionSingleton.Instance.RegionUp(region);
+ return InterRegionSingleton.Instance.RegionUp(region, regionhandle);
}
catch (RemotingException e)
{
--
cgit v1.1