diff options
author | Justin Clark-Casey (justincc) | 2015-01-14 19:40:17 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2015-01-14 19:45:19 +0000 |
commit | beef41f24cfdc57e584d19beed423cba83b7f829 (patch) | |
tree | 7bbf881eb3cc4ce5fd9d8d8c39c2dbc82126ed9d /OpenSim/Services | |
parent | Also deleted the option of setting Cap_WebFetchInventoryDescendents from Open... (diff) | |
download | opensim-SC-beef41f24cfdc57e584d19beed423cba83b7f829.zip opensim-SC-beef41f24cfdc57e584d19beed423cba83b7f829.tar.gz opensim-SC-beef41f24cfdc57e584d19beed423cba83b7f829.tar.bz2 opensim-SC-beef41f24cfdc57e584d19beed423cba83b7f829.tar.xz |
Stop simulators attempting to contact registered but offline regions (RegionFlags.Persistent but not RegioNFlags.RegionOnline) on startup and when an avatar completes a teleport.
This eliminates spurious network calls and failure reporting.
This is done by adding RegionFlags to the GridRegion returned data in a backward compatible way as an alternative to multiple IGridService.GetRegionFlags() calls
Using a simulator or a grid service older than this commit will just see previous behaviour.
Diffstat (limited to 'OpenSim/Services')
-rw-r--r-- | OpenSim/Services/Interfaces/IGridService.cs | 216 |
1 files changed, 118 insertions, 98 deletions
diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs index ce50ab0..0b318b3 100644 --- a/OpenSim/Services/Interfaces/IGridService.cs +++ b/OpenSim/Services/Interfaces/IGridService.cs | |||
@@ -179,6 +179,17 @@ namespace OpenSim.Services.Interfaces | |||
179 | } | 179 | } |
180 | protected string m_regionName = String.Empty; | 180 | protected string m_regionName = String.Empty; |
181 | 181 | ||
182 | /// <summary> | ||
183 | /// Region flags. | ||
184 | /// </summary> | ||
185 | /// <remarks> | ||
186 | /// If not set (chiefly if a robust service is running code pre OpenSim 0.8.1) then this will be null and | ||
187 | /// should be ignored. If you require flags information please use the separate IGridService.GetRegionFlags() call | ||
188 | /// XXX: This field is currently ignored when used in RegisterRegion, but could potentially be | ||
189 | /// used to set flags at this point. | ||
190 | /// </remarks> | ||
191 | public OpenSim.Framework.RegionFlags? RegionFlags { get; set; } | ||
192 | |||
182 | protected string m_externalHostName; | 193 | protected string m_externalHostName; |
183 | 194 | ||
184 | protected IPEndPoint m_internalEndPoint; | 195 | protected IPEndPoint m_internalEndPoint; |
@@ -299,6 +310,7 @@ namespace OpenSim.Services.Interfaces | |||
299 | public GridRegion(GridRegion ConvertFrom) | 310 | public GridRegion(GridRegion ConvertFrom) |
300 | { | 311 | { |
301 | m_regionName = ConvertFrom.RegionName; | 312 | m_regionName = ConvertFrom.RegionName; |
313 | RegionFlags = ConvertFrom.RegionFlags; | ||
302 | m_regionLocX = ConvertFrom.RegionLocX; | 314 | m_regionLocX = ConvertFrom.RegionLocX; |
303 | m_regionLocY = ConvertFrom.RegionLocY; | 315 | m_regionLocY = ConvertFrom.RegionLocY; |
304 | RegionSizeX = ConvertFrom.RegionSizeX; | 316 | RegionSizeX = ConvertFrom.RegionSizeX; |
@@ -315,8 +327,112 @@ namespace OpenSim.Services.Interfaces | |||
315 | RegionSecret = ConvertFrom.RegionSecret; | 327 | RegionSecret = ConvertFrom.RegionSecret; |
316 | EstateOwner = ConvertFrom.EstateOwner; | 328 | EstateOwner = ConvertFrom.EstateOwner; |
317 | } | 329 | } |
330 | |||
331 | public GridRegion(Dictionary<string, object> kvp) | ||
332 | { | ||
333 | if (kvp.ContainsKey("uuid")) | ||
334 | RegionID = new UUID((string)kvp["uuid"]); | ||
335 | |||
336 | if (kvp.ContainsKey("locX")) | ||
337 | RegionLocX = Convert.ToInt32((string)kvp["locX"]); | ||
338 | |||
339 | if (kvp.ContainsKey("locY")) | ||
340 | RegionLocY = Convert.ToInt32((string)kvp["locY"]); | ||
341 | |||
342 | if (kvp.ContainsKey("sizeX")) | ||
343 | RegionSizeX = Convert.ToInt32((string)kvp["sizeX"]); | ||
344 | else | ||
345 | RegionSizeX = (int)Constants.RegionSize; | ||
346 | |||
347 | if (kvp.ContainsKey("sizeY")) | ||
348 | RegionSizeY = Convert.ToInt32((string)kvp["sizeY"]); | ||
349 | else | ||
350 | RegionSizeX = (int)Constants.RegionSize; | ||
351 | |||
352 | if (kvp.ContainsKey("regionName")) | ||
353 | RegionName = (string)kvp["regionName"]; | ||
354 | |||
355 | if (kvp.ContainsKey("flags") && kvp["flags"] != null) | ||
356 | RegionFlags = (OpenSim.Framework.RegionFlags?)Convert.ToInt32((string)kvp["flags"]); | ||
357 | |||
358 | if (kvp.ContainsKey("serverIP")) | ||
359 | { | ||
360 | //int port = 0; | ||
361 | //Int32.TryParse((string)kvp["serverPort"], out port); | ||
362 | //IPEndPoint ep = new IPEndPoint(IPAddress.Parse((string)kvp["serverIP"]), port); | ||
363 | ExternalHostName = (string)kvp["serverIP"]; | ||
364 | } | ||
365 | else | ||
366 | ExternalHostName = "127.0.0.1"; | ||
367 | |||
368 | if (kvp.ContainsKey("serverPort")) | ||
369 | { | ||
370 | Int32 port = 0; | ||
371 | Int32.TryParse((string)kvp["serverPort"], out port); | ||
372 | InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), port); | ||
373 | } | ||
374 | |||
375 | if (kvp.ContainsKey("serverHttpPort")) | ||
376 | { | ||
377 | UInt32 port = 0; | ||
378 | UInt32.TryParse((string)kvp["serverHttpPort"], out port); | ||
379 | HttpPort = port; | ||
380 | } | ||
381 | |||
382 | if (kvp.ContainsKey("serverURI")) | ||
383 | ServerURI = (string)kvp["serverURI"]; | ||
384 | |||
385 | if (kvp.ContainsKey("regionMapTexture")) | ||
386 | UUID.TryParse((string)kvp["regionMapTexture"], out TerrainImage); | ||
387 | |||
388 | if (kvp.ContainsKey("parcelMapTexture")) | ||
389 | UUID.TryParse((string)kvp["parcelMapTexture"], out ParcelImage); | ||
390 | |||
391 | if (kvp.ContainsKey("access")) | ||
392 | Access = Byte.Parse((string)kvp["access"]); | ||
393 | |||
394 | if (kvp.ContainsKey("regionSecret")) | ||
395 | RegionSecret =(string)kvp["regionSecret"]; | ||
396 | |||
397 | if (kvp.ContainsKey("owner_uuid")) | ||
398 | EstateOwner = new UUID(kvp["owner_uuid"].ToString()); | ||
399 | |||
400 | if (kvp.ContainsKey("Token")) | ||
401 | Token = kvp["Token"].ToString(); | ||
402 | |||
403 | // m_log.DebugFormat("{0} New GridRegion. id={1}, loc=<{2},{3}>, size=<{4},{5}>", | ||
404 | // LogHeader, RegionID, RegionLocX, RegionLocY, RegionSizeX, RegionSizeY); | ||
405 | } | ||
406 | |||
407 | public Dictionary<string, object> ToKeyValuePairs() | ||
408 | { | ||
409 | Dictionary<string, object> kvp = new Dictionary<string, object>(); | ||
410 | kvp["uuid"] = RegionID.ToString(); | ||
411 | kvp["locX"] = RegionLocX.ToString(); | ||
412 | kvp["locY"] = RegionLocY.ToString(); | ||
413 | kvp["sizeX"] = RegionSizeX.ToString(); | ||
414 | kvp["sizeY"] = RegionSizeY.ToString(); | ||
415 | kvp["regionName"] = RegionName; | ||
318 | 416 | ||
319 | # region Definition of equality | 417 | if (RegionFlags != null) |
418 | kvp["flags"] = ((int)RegionFlags).ToString(); | ||
419 | |||
420 | kvp["serverIP"] = ExternalHostName; //ExternalEndPoint.Address.ToString(); | ||
421 | kvp["serverHttpPort"] = HttpPort.ToString(); | ||
422 | kvp["serverURI"] = ServerURI; | ||
423 | kvp["serverPort"] = InternalEndPoint.Port.ToString(); | ||
424 | kvp["regionMapTexture"] = TerrainImage.ToString(); | ||
425 | kvp["parcelMapTexture"] = ParcelImage.ToString(); | ||
426 | kvp["access"] = Access.ToString(); | ||
427 | kvp["regionSecret"] = RegionSecret; | ||
428 | kvp["owner_uuid"] = EstateOwner.ToString(); | ||
429 | kvp["Token"] = Token.ToString(); | ||
430 | // Maturity doesn't seem to exist in the DB | ||
431 | |||
432 | return kvp; | ||
433 | } | ||
434 | |||
435 | #region Definition of equality | ||
320 | 436 | ||
321 | /// <summary> | 437 | /// <summary> |
322 | /// Define equality as two regions having the same, non-zero UUID. | 438 | /// Define equality as two regions having the same, non-zero UUID. |
@@ -403,101 +519,5 @@ namespace OpenSim.Services.Interfaces | |||
403 | { | 519 | { |
404 | get { return Util.UIntsToLong((uint)RegionLocX, (uint)RegionLocY); } | 520 | get { return Util.UIntsToLong((uint)RegionLocX, (uint)RegionLocY); } |
405 | } | 521 | } |
406 | |||
407 | public Dictionary<string, object> ToKeyValuePairs() | ||
408 | { | ||
409 | Dictionary<string, object> kvp = new Dictionary<string, object>(); | ||
410 | kvp["uuid"] = RegionID.ToString(); | ||
411 | kvp["locX"] = RegionLocX.ToString(); | ||
412 | kvp["locY"] = RegionLocY.ToString(); | ||
413 | kvp["sizeX"] = RegionSizeX.ToString(); | ||
414 | kvp["sizeY"] = RegionSizeY.ToString(); | ||
415 | kvp["regionName"] = RegionName; | ||
416 | kvp["serverIP"] = ExternalHostName; //ExternalEndPoint.Address.ToString(); | ||
417 | kvp["serverHttpPort"] = HttpPort.ToString(); | ||
418 | kvp["serverURI"] = ServerURI; | ||
419 | kvp["serverPort"] = InternalEndPoint.Port.ToString(); | ||
420 | kvp["regionMapTexture"] = TerrainImage.ToString(); | ||
421 | kvp["parcelMapTexture"] = ParcelImage.ToString(); | ||
422 | kvp["access"] = Access.ToString(); | ||
423 | kvp["regionSecret"] = RegionSecret; | ||
424 | kvp["owner_uuid"] = EstateOwner.ToString(); | ||
425 | kvp["Token"] = Token.ToString(); | ||
426 | // Maturity doesn't seem to exist in the DB | ||
427 | return kvp; | ||
428 | } | ||
429 | |||
430 | public GridRegion(Dictionary<string, object> kvp) | ||
431 | { | ||
432 | if (kvp.ContainsKey("uuid")) | ||
433 | RegionID = new UUID((string)kvp["uuid"]); | ||
434 | |||
435 | if (kvp.ContainsKey("locX")) | ||
436 | RegionLocX = Convert.ToInt32((string)kvp["locX"]); | ||
437 | |||
438 | if (kvp.ContainsKey("locY")) | ||
439 | RegionLocY = Convert.ToInt32((string)kvp["locY"]); | ||
440 | |||
441 | if (kvp.ContainsKey("sizeX")) | ||
442 | RegionSizeX = Convert.ToInt32((string)kvp["sizeX"]); | ||
443 | else | ||
444 | RegionSizeX = (int)Constants.RegionSize; | ||
445 | |||
446 | if (kvp.ContainsKey("sizeY")) | ||
447 | RegionSizeY = Convert.ToInt32((string)kvp["sizeY"]); | ||
448 | else | ||
449 | RegionSizeX = (int)Constants.RegionSize; | ||
450 | |||
451 | if (kvp.ContainsKey("regionName")) | ||
452 | RegionName = (string)kvp["regionName"]; | ||
453 | |||
454 | if (kvp.ContainsKey("serverIP")) | ||
455 | { | ||
456 | //int port = 0; | ||
457 | //Int32.TryParse((string)kvp["serverPort"], out port); | ||
458 | //IPEndPoint ep = new IPEndPoint(IPAddress.Parse((string)kvp["serverIP"]), port); | ||
459 | ExternalHostName = (string)kvp["serverIP"]; | ||
460 | } | ||
461 | else | ||
462 | ExternalHostName = "127.0.0.1"; | ||
463 | |||
464 | if (kvp.ContainsKey("serverPort")) | ||
465 | { | ||
466 | Int32 port = 0; | ||
467 | Int32.TryParse((string)kvp["serverPort"], out port); | ||
468 | InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), port); | ||
469 | } | ||
470 | |||
471 | if (kvp.ContainsKey("serverHttpPort")) | ||
472 | { | ||
473 | UInt32 port = 0; | ||
474 | UInt32.TryParse((string)kvp["serverHttpPort"], out port); | ||
475 | HttpPort = port; | ||
476 | } | ||
477 | |||
478 | if (kvp.ContainsKey("serverURI")) | ||
479 | ServerURI = (string)kvp["serverURI"]; | ||
480 | |||
481 | if (kvp.ContainsKey("regionMapTexture")) | ||
482 | UUID.TryParse((string)kvp["regionMapTexture"], out TerrainImage); | ||
483 | |||
484 | if (kvp.ContainsKey("parcelMapTexture")) | ||
485 | UUID.TryParse((string)kvp["parcelMapTexture"], out ParcelImage); | ||
486 | |||
487 | if (kvp.ContainsKey("access")) | ||
488 | Access = Byte.Parse((string)kvp["access"]); | ||
489 | |||
490 | if (kvp.ContainsKey("regionSecret")) | ||
491 | RegionSecret =(string)kvp["regionSecret"]; | ||
492 | |||
493 | if (kvp.ContainsKey("owner_uuid")) | ||
494 | EstateOwner = new UUID(kvp["owner_uuid"].ToString()); | ||
495 | |||
496 | if (kvp.ContainsKey("Token")) | ||
497 | Token = kvp["Token"].ToString(); | ||
498 | |||
499 | // m_log.DebugFormat("{0} New GridRegion. id={1}, loc=<{2},{3}>, size=<{4},{5}>", | ||
500 | // LogHeader, RegionID, RegionLocX, RegionLocY, RegionSizeX, RegionSizeY); | ||
501 | } | ||
502 | } | 522 | } |
503 | } | 523 | } \ No newline at end of file |