aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs76
1 files changed, 74 insertions, 2 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
index c6b3f30..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)
@@ -407,6 +410,65 @@ namespace OpenSim.Region.Framework.Scenes
407 //blah.Port = region.RemotingPort; 410 //blah.Port = region.RemotingPort;
408 } 411 }
409 412
413 public List<SimpleRegionInfo> RequestNeighbors(Scene pScene, uint pRegionLocX, uint pRegionLocY)
414 {
415 Border[] northBorders = pScene.NorthBorders.ToArray();
416 Border[] southBorders = pScene.SouthBorders.ToArray();
417 Border[] eastBorders = pScene.EastBorders.ToArray();
418 Border[] westBorders = pScene.WestBorders.ToArray();
419
420 // Legacy one region. Provided for simplicity while testing the all inclusive method in the else statement.
421 if (northBorders.Length <= 1 && southBorders.Length <= 1 && eastBorders.Length <= 1 && westBorders.Length <= 1)
422 {
423 return m_commsProvider.GridService.RequestNeighbours(pRegionLocX, pRegionLocY);
424 }
425 else
426 {
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);
469 }
470 }
471
410 /// <summary> 472 /// <summary>
411 /// This informs all neighboring regions about agent "avatar". 473 /// This informs all neighboring regions about agent "avatar".
412 /// Calls an asynchronous method to do so.. so it doesn't lag the sim. 474 /// Calls an asynchronous method to do so.. so it doesn't lag the sim.
@@ -429,7 +491,7 @@ namespace OpenSim.Region.Framework.Scenes
429 if (m_regionInfo != null) 491 if (m_regionInfo != null)
430 { 492 {
431 neighbours = 493 neighbours =
432 m_commsProvider.GridService.RequestNeighbours(m_regionInfo.RegionLocX, m_regionInfo.RegionLocY); 494 RequestNeighbors(avatar.Scene,m_regionInfo.RegionLocX, m_regionInfo.RegionLocY);
433 } 495 }
434 else 496 else
435 { 497 {
@@ -536,6 +598,16 @@ namespace OpenSim.Region.Framework.Scenes
536 InformClientOfNeighbourCompleted, 598 InformClientOfNeighbourCompleted,
537 d); 599 d);
538 } 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 }
539 catch (Exception e) 611 catch (Exception e)
540 { 612 {
541 m_log.ErrorFormat( 613 m_log.ErrorFormat(