* If a region running in grid mode fails to login to the grid service, startup will now terminate instead of carrying on (and thus burying the error message)

0.6.0-stable
Justin Clarke Casey 2008-05-12 16:57:56 +00:00
parent 690294c578
commit d3fb6039ca
7 changed files with 40 additions and 19 deletions

View File

@ -38,6 +38,7 @@ namespace OpenSim.Framework.Communications
/// </summary>
/// <param name="regionInfos"> </param>
/// <returns></returns>
/// <exception cref="System.Exception">Thrown if region registration failed</exception>
RegionCommsListener RegisterRegion(RegionInfo regionInfos);
bool DeregisterRegion(RegionInfo regionInfo);

View File

@ -388,7 +388,7 @@ namespace OpenSim.Grid.GridServer
" " + sim.regionLocY + " currently occupied by " + existingSim.regionName);
}
return ErrorResponse("The key required to login your region did not match. Please check your send and receive keys.");
return ErrorResponse("The key required to login your region did not match. Please check your grid send and receive keys.");
}
}
else

View File

@ -569,7 +569,18 @@ namespace OpenSim
//moved these here as the terrain texture has to be created after the modules are initialized
// and has to happen before the region is registered with the grid.
scene.CreateTerrainTexture(true);
scene.RegisterRegionWithGrid();
try
{
scene.RegisterRegionWithGrid();
}
catch (Exception e)
{
m_log.ErrorFormat("[STARTUP]: Registration of region with grid failed, aborting startup - {0}", e);
// Carrying on now causes a lot of confusion down the line - we need to get the user's attention
System.Environment.Exit(1);
}
// We need to do this after we've initialized the scripting engines.
scene.StartScripts();

View File

@ -129,10 +129,6 @@ namespace OpenSim.Region.ClientStack
scene.LoadWorldMap();
//moved to opensimMain as these have to happen after modules are initialised
// scene.CreateTerrainTexture(true);
// scene.RegisterRegionWithGrid();
scene.PhysicsScene = GetPhysicsScene();
scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
scene.PhysicsScene.SetWaterLevel(regionInfo.EstateSettings.waterHeight);
@ -171,4 +167,4 @@ namespace OpenSim.Region.ClientStack
protected abstract Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager,
AgentCircuitManager circuitManager);
}
}
}

View File

@ -94,7 +94,7 @@ namespace OpenSim.Region.Communications.OGS1
// see IGridServices
public RegionCommsListener RegisterRegion(RegionInfo regionInfo)
{
m_log.DebugFormat(
m_log.InfoFormat(
"[OGS1 GRID SERVICES]: Attempting to register region {0} with grid at {1}",
regionInfo.RegionName, serversInfo.GridURL);
@ -137,14 +137,16 @@ namespace OpenSim.Region.Communications.OGS1
XmlRpcRequest GridReq = new XmlRpcRequest("simulator_login", SendParams);
GridResp = GridReq.Send(serversInfo.GridURL, 30000);
}
catch (Exception ex)
catch (Exception e)
{
m_log.ErrorFormat(
"[OGS1 GRID SERVICES]: Unable to connect to grid at {0}. Grid server not running? Exception {1}",
serversInfo.GridURL, ex);
Exception e2
= new Exception(
String.Format("Unable to connect to grid at {0}. Grid service not running?", serversInfo.GridURL),
e);
throw(ex);
throw(e2);
}
Hashtable GridRespData = (Hashtable)GridResp.Value;
Hashtable griddatahash = GridRespData;
@ -152,11 +154,10 @@ namespace OpenSim.Region.Communications.OGS1
if (GridRespData.ContainsKey("error"))
{
string errorstring = (string) GridRespData["error"];
m_log.ErrorFormat(
"[OGS1 GRID SERVICES]: Unable to connect to grid at {0}: {1}",
serversInfo.GridURL, errorstring);
return null;
Exception e = new Exception(String.Format("Unable to connect to grid at {0}: {1}", serversInfo.GridURL, errorstring));
throw e;
}
else
{
@ -292,7 +293,7 @@ namespace OpenSim.Region.Communications.OGS1
if (responseData.ContainsKey("error"))
{
Console.WriteLine("error received from grid server" + responseData["error"]);
m_log.WarnFormat("[OGS1 GRID SERVICES]: Error received from grid server: {0}", responseData["error"]);
return null;
}
@ -355,7 +356,7 @@ namespace OpenSim.Region.Communications.OGS1
if (responseData.ContainsKey("error"))
{
m_log.Error("[OGS1 GRID SERVICES]: Error received from grid server" + responseData["error"]);
m_log.Error("[OGS1 GRID SERVICES]: Error received from grid server: " + responseData["error"]);
return null;
}

View File

@ -924,13 +924,20 @@ namespace OpenSim.Region.Environment.Scenes
}
}
/// <summary>
/// Register this region with a grid service
/// </summary>
/// <exception cref="System.Exception">Thrown if registration of the region itself fails.</exception>
public void RegisterRegionWithGrid()
{
RegisterCommsEvents();
// These two 'commands' *must be* next to each other or sim rebooting fails.
m_sceneGridService.RegisterRegion(RegionInfo);
m_sceneGridService.InformNeighborsThatRegionisUp(RegionInfo);
Dictionary<string, string> dGridSettings = m_sceneGridService.GetGridSettings();
if (dGridSettings.ContainsKey("allow_forceful_banlines"))
{
if (dGridSettings["allow_forceful_banlines"] != "TRUE")

View File

@ -84,6 +84,11 @@ namespace OpenSim.Region.Environment.Scenes
m_commsProvider.InterRegion.rdebugRegionName = _debugRegionName;
}
/// <summary>
/// Register a region with the grid
/// </summary>
/// <param name="regionInfos"></param>
/// <exception cref="System.Exception">Thrown if region registration fails.</exception>
public void RegisterRegion(RegionInfo regionInfos)
{
m_regionInfo = regionInfos;