diff --git a/OpenSim/Framework/Communications/IGridServices.cs b/OpenSim/Framework/Communications/IGridServices.cs index 9e34672462..39f04c3082 100644 --- a/OpenSim/Framework/Communications/IGridServices.cs +++ b/OpenSim/Framework/Communications/IGridServices.cs @@ -38,6 +38,7 @@ namespace OpenSim.Framework.Communications /// /// /// + /// Thrown if region registration failed RegionCommsListener RegisterRegion(RegionInfo regionInfos); bool DeregisterRegion(RegionInfo regionInfo); diff --git a/OpenSim/Grid/GridServer/GridManager.cs b/OpenSim/Grid/GridServer/GridManager.cs index 8ed619ca4e..284ac0c6c0 100644 --- a/OpenSim/Grid/GridServer/GridManager.cs +++ b/OpenSim/Grid/GridServer/GridManager.cs @@ -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 diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index d910dc41bc..c7094c79af 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs @@ -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(); diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs index 1dcab20275..5e0e07484b 100644 --- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs +++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs @@ -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); } -} \ No newline at end of file +} diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs index eada868634..03fd44833a 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs @@ -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; } diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index e8a6c45e37..e18c467117 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -924,13 +924,20 @@ namespace OpenSim.Region.Environment.Scenes } } + /// + /// Register this region with a grid service + /// + /// Thrown if registration of the region itself fails. 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 dGridSettings = m_sceneGridService.GetGridSettings(); + if (dGridSettings.ContainsKey("allow_forceful_banlines")) { if (dGridSettings["allow_forceful_banlines"] != "TRUE") diff --git a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs index 91bbdb7c77..5ef4a7d9ab 100644 --- a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs @@ -84,6 +84,11 @@ namespace OpenSim.Region.Environment.Scenes m_commsProvider.InterRegion.rdebugRegionName = _debugRegionName; } + /// + /// Register a region with the grid + /// + /// + /// Thrown if region registration fails. public void RegisterRegion(RegionInfo regionInfos) { m_regionInfo = regionInfos;