aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-05-13 13:36:21 +0000
committerJustin Clarke Casey2008-05-13 13:36:21 +0000
commit550018f02dbe9d725ff9cdd69f3cf17fac727220 (patch)
treea76aa5edb00b826d2809ba118675c15319ceaddf /OpenSim/Grid
parent* Implemented ChildAgentDataUpdate throttle multiplier based on an inaccurate... (diff)
downloadopensim-SC_OLD-550018f02dbe9d725ff9cdd69f3cf17fac727220.zip
opensim-SC_OLD-550018f02dbe9d725ff9cdd69f3cf17fac727220.tar.gz
opensim-SC_OLD-550018f02dbe9d725ff9cdd69f3cf17fac727220.tar.bz2
opensim-SC_OLD-550018f02dbe9d725ff9cdd69f3cf17fac727220.tar.xz
* As part of the region registration process, the grid service now requests the status of the region using the region http uri just passed in
* If the status cannot be retrieved, then the region startup will terminate. * The aim of this is for earlier detection of situations where the region can send messages out but cannot accept incoming requests (often due to firewall issues) * This is currently an extremely simplistic check which completely trusts whatever http uri is given by the region * This contact may be problematic, though since the user service needs to be able to contact the region http uri, it doesn't seem unreasonable for the grid to have to be able to do so too at this stage * This change will require a prebuild
Diffstat (limited to '')
-rw-r--r--OpenSim/Grid/GridServer/GridManager.cs58
-rw-r--r--OpenSim/Grid/GridServer/GridServerBase.cs10
2 files changed, 57 insertions, 11 deletions
diff --git a/OpenSim/Grid/GridServer/GridManager.cs b/OpenSim/Grid/GridServer/GridManager.cs
index 2bb26cf..84a515c 100644
--- a/OpenSim/Grid/GridServer/GridManager.cs
+++ b/OpenSim/Grid/GridServer/GridManager.cs
@@ -28,6 +28,7 @@
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.IO;
31using System.Reflection; 32using System.Reflection;
32using System.Xml; 33using System.Xml;
33using libsecondlife; 34using libsecondlife;
@@ -36,6 +37,7 @@ using Nwc.XmlRpc;
36using OpenSim.Data; 37using OpenSim.Data;
37using OpenSim.Data.MySQL; 38using OpenSim.Data.MySQL;
38using OpenSim.Framework; 39using OpenSim.Framework;
40using OpenSim.Framework.Communications;
39using OpenSim.Framework.Servers; 41using OpenSim.Framework.Servers;
40 42
41namespace OpenSim.Grid.GridServer 43namespace OpenSim.Grid.GridServer
@@ -248,7 +250,7 @@ namespace OpenSim.Grid.GridServer
248 /// </summary> 250 /// </summary>
249 /// <param name="sim"></param> 251 /// <param name="sim"></param>
250 /// <returns></returns> 252 /// <returns></returns>
251 protected virtual void ValidateOverwrite(RegionProfileData sim, RegionProfileData existingSim) 253 protected virtual void ValidateOverwriteKeys(RegionProfileData sim, RegionProfileData existingSim)
252 { 254 {
253 if (!(existingSim.regionRecvKey == sim.regionRecvKey && existingSim.regionSendKey == sim.regionSendKey)) 255 if (!(existingSim.regionRecvKey == sim.regionRecvKey && existingSim.regionSendKey == sim.regionSendKey))
254 { 256 {
@@ -271,7 +273,7 @@ namespace OpenSim.Grid.GridServer
271 /// 273 ///
272 /// <param name="sim"></param> 274 /// <param name="sim"></param>
273 /// <exception cref="LoginException">Thrown if region login failed</exception> 275 /// <exception cref="LoginException">Thrown if region login failed</exception>
274 protected virtual void ValidateNewRegion(RegionProfileData sim) 276 protected virtual void ValidateNewRegionKeys(RegionProfileData sim)
275 { 277 {
276 if (!(sim.regionRecvKey == Config.SimSendKey && sim.regionSendKey == Config.SimRecvKey)) 278 if (!(sim.regionRecvKey == Config.SimSendKey && sim.regionSendKey == Config.SimRecvKey))
277 { 279 {
@@ -282,8 +284,51 @@ namespace OpenSim.Grid.GridServer
282 sim.regionName, sim.regionLocX, sim.regionLocY, 284 sim.regionName, sim.regionLocX, sim.regionLocY,
283 sim.regionSendKey, Config.SimRecvKey, sim.regionRecvKey, Config.SimSendKey), 285 sim.regionSendKey, Config.SimRecvKey, sim.regionRecvKey, Config.SimSendKey),
284 "The keys required to login your region did not match your existing region keys. Please check your grid send and receive keys."); 286 "The keys required to login your region did not match your existing region keys. Please check your grid send and receive keys.");
287 }
288 }
289
290 /// <summary>
291 /// Check that a region's http uri is externally contactable.
292 /// </summary>
293 /// <param name="sim"></param>
294 /// <exception cref="LoginException">Thrown if the region is not contactable</exception>
295 protected virtual void ValidateRegionContactable(RegionProfileData sim)
296 {
297 string regionStatusUrl = String.Format("{0}{1}", sim.httpServerURI, "simstatus/");
298 string regionStatusResponse;
299
300 RestClient rc = new RestClient(regionStatusUrl);
301 rc.RequestMethod = "GET";
302
303 m_log.DebugFormat("[LOGIN]: Contacting {0} for status of region {1}", regionStatusUrl, sim.regionName);
304
305 try
306 {
307 Stream rs = rc.Request();
308 StreamReader sr = new StreamReader(rs);
309 regionStatusResponse = sr.ReadToEnd();
310 sr.Close();
285 } 311 }
286 312 catch (Exception e)
313 {
314 throw new LoginException(
315 String.Format("Region status request to {0} failed", regionStatusUrl),
316 String.Format(
317 "The grid service could not contact the http url {0} at your region. Please make sure this url is reachable by the grid service",
318 regionStatusUrl),
319 e);
320 }
321
322 if (!regionStatusResponse.Equals("OK"))
323 {
324 throw new LoginException(
325 String.Format(
326 "Region {0} at {1} returned status response {2} rather than {3}",
327 sim.regionName, regionStatusUrl, regionStatusResponse, "OK"),
328 String.Format(
329 "When the grid service asked for the status of your region, it received the response {0} rather than {1}. Please check your status",
330 regionStatusResponse, "OK"));
331 }
287 } 332 }
288 333
289 /// <summary> 334 /// <summary>
@@ -332,7 +377,6 @@ namespace OpenSim.Grid.GridServer
332 m_log.InfoFormat("[LOGIN BEGIN]: Received login request from simulator: {0}", sim.regionName); 377 m_log.InfoFormat("[LOGIN BEGIN]: Received login request from simulator: {0}", sim.regionName);
333 378
334 existingSim = GetRegion(sim.regionHandle); 379 existingSim = GetRegion(sim.regionHandle);
335
336 380
337 if (existingSim == null || existingSim.UUID == sim.UUID || sim.UUID != sim.originUUID) 381 if (existingSim == null || existingSim.UUID == sim.UUID || sim.UUID != sim.originUUID)
338 { 382 {
@@ -340,12 +384,14 @@ namespace OpenSim.Grid.GridServer
340 { 384 {
341 if (existingSim == null) 385 if (existingSim == null)
342 { 386 {
343 ValidateNewRegion(sim); 387 ValidateNewRegionKeys(sim);
344 } 388 }
345 else 389 else
346 { 390 {
347 ValidateOverwrite(sim, existingSim); 391 ValidateOverwriteKeys(sim, existingSim);
348 } 392 }
393
394 ValidateRegionContactable(sim);
349 } 395 }
350 catch (LoginException e) 396 catch (LoginException e)
351 { 397 {
diff --git a/OpenSim/Grid/GridServer/GridServerBase.cs b/OpenSim/Grid/GridServer/GridServerBase.cs
index 8adab1a..aeaead5 100644
--- a/OpenSim/Grid/GridServer/GridServerBase.cs
+++ b/OpenSim/Grid/GridServer/GridServerBase.cs
@@ -91,11 +91,11 @@ namespace OpenSim.Grid.GridServer
91 91
92 m_httpServer.Start(); 92 m_httpServer.Start();
93 93
94 m_log.Info("[GRID]: Starting sim status checker"); 94// m_log.Info("[GRID]: Starting sim status checker");
95 95//
96 Timer simCheckTimer = new Timer(3600000 * 3); // 3 Hours between updates. 96// Timer simCheckTimer = new Timer(3600000 * 3); // 3 Hours between updates.
97 simCheckTimer.Elapsed += new ElapsedEventHandler(CheckSims); 97// simCheckTimer.Elapsed += new ElapsedEventHandler(CheckSims);
98 simCheckTimer.Enabled = true; 98// simCheckTimer.Enabled = true;
99 } 99 }
100 100
101 protected void AddHttpHandlers() 101 protected void AddHttpHandlers()