diff options
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs | 58 |
1 files changed, 56 insertions, 2 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index 08563d0..0827672 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs | |||
@@ -367,6 +367,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
367 | string reason = String.Empty; | 367 | string reason = String.Empty; |
368 | 368 | ||
369 | //bool regionAccepted = m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, a); | 369 | //bool regionAccepted = m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, a); |
370 | |||
370 | bool regionAccepted = m_interregionCommsOut.SendCreateChildAgent(reg.RegionHandle, a, out reason); | 371 | bool regionAccepted = m_interregionCommsOut.SendCreateChildAgent(reg.RegionHandle, a, out reason); |
371 | 372 | ||
372 | if (regionAccepted && newAgent) | 373 | if (regionAccepted && newAgent) |
@@ -384,7 +385,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
384 | 385 | ||
385 | eq.EnableSimulator(reg.RegionHandle, endPoint, avatar.UUID); | 386 | eq.EnableSimulator(reg.RegionHandle, endPoint, avatar.UUID); |
386 | eq.EstablishAgentCommunication(avatar.UUID, endPoint, capsPath); | 387 | eq.EstablishAgentCommunication(avatar.UUID, endPoint, capsPath); |
387 | m_log.DebugFormat("[CAPS]: Sending new CAPS seed url {0} to client {1} in region {2}", | 388 | m_log.DebugFormat("[CAPS]: Sending new CAPS seed url {0} to client {1} in region {2}", |
388 | capsPath, avatar.UUID, avatar.Scene.RegionInfo.RegionName); | 389 | capsPath, avatar.UUID, avatar.Scene.RegionInfo.RegionName); |
389 | } | 390 | } |
390 | else | 391 | else |
@@ -394,7 +395,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
394 | } | 395 | } |
395 | 396 | ||
396 | m_log.Info("[INTERGRID]: Completed inform client about neighbour " + endPoint.ToString()); | 397 | m_log.Info("[INTERGRID]: Completed inform client about neighbour " + endPoint.ToString()); |
398 | |||
397 | } | 399 | } |
400 | |||
398 | } | 401 | } |
399 | 402 | ||
400 | public void RequestNeighbors(RegionInfo region) | 403 | public void RequestNeighbors(RegionInfo region) |
@@ -421,7 +424,48 @@ namespace OpenSim.Region.Framework.Scenes | |||
421 | } | 424 | } |
422 | else | 425 | else |
423 | { | 426 | { |
424 | return m_commsProvider.GridService.RequestNeighbours(pRegionLocX, pRegionLocY); | 427 | Vector2 extent = Vector2.Zero; |
428 | for (int i=0;i<eastBorders.Length;i++) | ||
429 | { | ||
430 | extent.X = (eastBorders[i].BorderLine.Z > extent.X) ? eastBorders[i].BorderLine.Z : extent.X; | ||
431 | } | ||
432 | for (int i=0;i<northBorders.Length;i++) | ||
433 | { | ||
434 | extent.Y = (northBorders[i].BorderLine.Z > extent.Y) ? northBorders[i].BorderLine.Z : extent.Y; | ||
435 | } | ||
436 | |||
437 | List<SimpleRegionInfo> neighbourList = new List<SimpleRegionInfo>(); | ||
438 | |||
439 | // Loss of fraction on purpose | ||
440 | extent.X = ((int)extent.X / (int)Constants.RegionSize) + 1; | ||
441 | extent.Y = ((int)extent.Y / (int)Constants.RegionSize) + 1; | ||
442 | |||
443 | int startX = (int) pRegionLocX - 1; | ||
444 | int startY = (int) pRegionLocY - 1; | ||
445 | |||
446 | int endX = (int) pRegionLocX + (int)extent.X + 1; | ||
447 | int endY = (int) pRegionLocY + (int)extent.Y + 1; | ||
448 | |||
449 | for (int i=startX;i<endX;i++) | ||
450 | { | ||
451 | for (int j=startY;j<endY;j++) | ||
452 | { | ||
453 | // Skip CurrentRegion | ||
454 | if (i == (int)pRegionLocX && j == (int)pRegionLocY) | ||
455 | continue; | ||
456 | |||
457 | ulong regionHandle = Util.UIntsToLong((uint)(i * Constants.RegionSize), | ||
458 | (uint)(j * Constants.RegionSize)); | ||
459 | RegionInfo neighborreg = m_commsProvider.GridService.RequestNeighbourInfo(regionHandle); | ||
460 | if (neighborreg != null) | ||
461 | { | ||
462 | neighbourList.Add(neighborreg); | ||
463 | } | ||
464 | } | ||
465 | } | ||
466 | return neighbourList; | ||
467 | //SimpleRegionInfo regionData = m_commsProvider.GridService.RequestNeighbourInfo() | ||
468 | //return m_commsProvider.GridService.RequestNeighbours(pRegionLocX, pRegionLocY); | ||
425 | } | 469 | } |
426 | } | 470 | } |
427 | 471 | ||
@@ -554,6 +598,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
554 | InformClientOfNeighbourCompleted, | 598 | InformClientOfNeighbourCompleted, |
555 | d); | 599 | d); |
556 | } | 600 | } |
601 | |||
602 | catch (ArgumentOutOfRangeException) | ||
603 | { | ||
604 | m_log.ErrorFormat( | ||
605 | "[REGIONINFO]: Neighbour Regions response included the current region in the neighbor list. The following region will not display to the client: {0} for region {1} ({2}, {3}).", | ||
606 | neighbour.ExternalHostName, | ||
607 | neighbour.RegionHandle, | ||
608 | neighbour.RegionLocX, | ||
609 | neighbour.RegionLocY); | ||
610 | } | ||
557 | catch (Exception e) | 611 | catch (Exception e) |
558 | { | 612 | { |
559 | m_log.ErrorFormat( | 613 | m_log.ErrorFormat( |