diff options
Merge branch 'master' into careminster
Diffstat (limited to 'OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs')
-rw-r--r-- | OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs | 81 |
1 files changed, 56 insertions, 25 deletions
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs index feea196..0e4d794 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs | |||
@@ -352,26 +352,54 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
352 | 352 | ||
353 | public List<GridRegion> GetHyperlinks(UUID scopeID) | 353 | public List<GridRegion> GetHyperlinks(UUID scopeID) |
354 | { | 354 | { |
355 | // Hypergrid/linked regions are not supported | 355 | List<GridRegion> foundRegions = new List<GridRegion>(); |
356 | return new List<GridRegion>(); | 356 | |
357 | NameValueCollection requestArgs = new NameValueCollection | ||
358 | { | ||
359 | { "RequestMethod", "GetScenes" }, | ||
360 | { "HyperGrid", "true" }, | ||
361 | { "Enabled", "1" } | ||
362 | }; | ||
363 | |||
364 | OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs); | ||
365 | if (response["Success"].AsBoolean()) | ||
366 | { | ||
367 | // m_log.DebugFormat("[SIMIAN GRID CONNECTOR] found regions with name {0}",name); | ||
368 | |||
369 | OSDArray array = response["Scenes"] as OSDArray; | ||
370 | if (array != null) | ||
371 | { | ||
372 | for (int i = 0; i < array.Count; i++) | ||
373 | { | ||
374 | GridRegion region = ResponseToGridRegion(array[i] as OSDMap); | ||
375 | if (region != null) | ||
376 | foundRegions.Add(region); | ||
377 | } | ||
378 | } | ||
379 | } | ||
380 | |||
381 | return foundRegions; | ||
357 | } | 382 | } |
358 | 383 | ||
359 | public int GetRegionFlags(UUID scopeID, UUID regionID) | 384 | public int GetRegionFlags(UUID scopeID, UUID regionID) |
360 | { | 385 | { |
361 | const int REGION_ONLINE = 4; | ||
362 | |||
363 | NameValueCollection requestArgs = new NameValueCollection | 386 | NameValueCollection requestArgs = new NameValueCollection |
364 | { | 387 | { |
365 | { "RequestMethod", "GetScene" }, | 388 | { "RequestMethod", "GetScene" }, |
366 | { "SceneID", regionID.ToString() } | 389 | { "SceneID", regionID.ToString() } |
367 | }; | 390 | }; |
368 | 391 | ||
369 | // m_log.DebugFormat("[SIMIAN GRID CONNECTOR] request region flags for {0}",regionID.ToString()); | 392 | m_log.DebugFormat("[SIMIAN GRID CONNECTOR] request region flags for {0}",regionID.ToString()); |
370 | 393 | ||
371 | OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs); | 394 | OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs); |
372 | if (response["Success"].AsBoolean()) | 395 | if (response["Success"].AsBoolean()) |
373 | { | 396 | { |
374 | return response["Enabled"].AsBoolean() ? REGION_ONLINE : 0; | 397 | OSDMap extraData = response["ExtraData"] as OSDMap; |
398 | int enabled = response["Enabled"].AsBoolean() ? (int) OpenSim.Data.RegionFlags.RegionOnline : 0; | ||
399 | int hypergrid = extraData["HyperGrid"].AsBoolean() ? (int) OpenSim.Data.RegionFlags.Hyperlink : 0; | ||
400 | int flags = enabled | hypergrid; | ||
401 | m_log.DebugFormat("[SGGC] enabled - {0} hg - {1} flags - {2}", enabled, hypergrid, flags); | ||
402 | return flags; | ||
375 | } | 403 | } |
376 | else | 404 | else |
377 | { | 405 | { |
@@ -499,24 +527,27 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
499 | Vector3d minPosition = response["MinPosition"].AsVector3d(); | 527 | Vector3d minPosition = response["MinPosition"].AsVector3d(); |
500 | region.RegionLocX = (int)minPosition.X; | 528 | region.RegionLocX = (int)minPosition.X; |
501 | region.RegionLocY = (int)minPosition.Y; | 529 | region.RegionLocY = (int)minPosition.Y; |
502 | 530 | ||
503 | Uri httpAddress = response["Address"].AsUri(); | 531 | if ( ! extraData["HyperGrid"] ) { |
504 | region.ExternalHostName = httpAddress.Host; | 532 | Uri httpAddress = response["Address"].AsUri(); |
505 | region.HttpPort = (uint)httpAddress.Port; | 533 | region.ExternalHostName = httpAddress.Host; |
506 | 534 | region.HttpPort = (uint)httpAddress.Port; | |
507 | region.ServerURI = extraData["ServerURI"].AsString(); | 535 | |
508 | 536 | IPAddress internalAddress; | |
509 | IPAddress internalAddress; | 537 | IPAddress.TryParse(extraData["InternalAddress"].AsString(), out internalAddress); |
510 | IPAddress.TryParse(extraData["InternalAddress"].AsString(), out internalAddress); | 538 | if (internalAddress == null) |
511 | if (internalAddress == null) | 539 | internalAddress = IPAddress.Any; |
512 | internalAddress = IPAddress.Any; | 540 | |
513 | 541 | region.InternalEndPoint = new IPEndPoint(internalAddress, extraData["InternalPort"].AsInteger()); | |
514 | region.InternalEndPoint = new IPEndPoint(internalAddress, extraData["InternalPort"].AsInteger()); | 542 | region.TerrainImage = extraData["MapTexture"].AsUUID(); |
515 | region.TerrainImage = extraData["MapTexture"].AsUUID(); | 543 | region.Access = (byte)extraData["Access"].AsInteger(); |
516 | region.Access = (byte)extraData["Access"].AsInteger(); | 544 | region.RegionSecret = extraData["RegionSecret"].AsString(); |
517 | region.RegionSecret = extraData["RegionSecret"].AsString(); | 545 | region.EstateOwner = extraData["EstateOwner"].AsUUID(); |
518 | region.EstateOwner = extraData["EstateOwner"].AsUUID(); | 546 | region.Token = extraData["Token"].AsString(); |
519 | region.Token = extraData["Token"].AsString(); | 547 | region.ServerURI = extraData["ServerURI"].AsString(); |
548 | } else { | ||
549 | region.ServerURI = response["Address"]; | ||
550 | } | ||
520 | 551 | ||
521 | return region; | 552 | return region; |
522 | } | 553 | } |