aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Scene.cs
diff options
context:
space:
mode:
authorDiva Canto2009-09-27 10:14:10 -0700
committerDiva Canto2009-09-27 10:14:10 -0700
commit5d09c53a1a42b38e1ee35cfbb5571d70b75380f4 (patch)
tree247412b0147ea11f4113413c1fa7d7e91eec0aa5 /OpenSim/Region/Framework/Scenes/Scene.cs
parentPoof! on LocalBackend. CommsManager.GridServices deleted. (diff)
downloadopensim-SC_OLD-5d09c53a1a42b38e1ee35cfbb5571d70b75380f4.zip
opensim-SC_OLD-5d09c53a1a42b38e1ee35cfbb5571d70b75380f4.tar.gz
opensim-SC_OLD-5d09c53a1a42b38e1ee35cfbb5571d70b75380f4.tar.bz2
opensim-SC_OLD-5d09c53a1a42b38e1ee35cfbb5571d70b75380f4.tar.xz
Unpacking the mess with OtherRegionUp, so we can have a real cache of the neighbours in the grid service modules.
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs63
1 files changed, 20 insertions, 43 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 8990f29..55478da 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -587,10 +587,7 @@ namespace OpenSim.Region.Framework.Scenes
587 } 587 }
588 588
589 /// <summary> 589 /// <summary>
590 /// Another region is up. Gets called from Grid Comms: 590 /// Another region is up.
591 /// (OGS1 -> LocalBackEnd -> RegionListened -> SceneCommunicationService)
592 /// We have to tell all our ScenePresences about it, and add it to the
593 /// neighbor list.
594 /// 591 ///
595 /// We only add it to the neighbor list if it's within 1 region from here. 592 /// We only add it to the neighbor list if it's within 1 region from here.
596 /// Agents may have draw distance values that cross two regions though, so 593 /// Agents may have draw distance values that cross two regions though, so
@@ -599,47 +596,27 @@ namespace OpenSim.Region.Framework.Scenes
599 /// </summary> 596 /// </summary>
600 /// <param name="otherRegion">RegionInfo handle for the new region.</param> 597 /// <param name="otherRegion">RegionInfo handle for the new region.</param>
601 /// <returns>True after all operations complete, throws exceptions otherwise.</returns> 598 /// <returns>True after all operations complete, throws exceptions otherwise.</returns>
602 public override bool OtherRegionUp(RegionInfo otherRegion) 599 public override void OtherRegionUp(GridRegion otherRegion)
603 { 600 {
604 m_log.InfoFormat("[SCENE]: Region {0} up in coords {1}-{2}", otherRegion.RegionName, otherRegion.RegionLocX, otherRegion.RegionLocY); 601 uint xcell = (uint)((int)otherRegion.RegionLocX / (int)Constants.RegionSize);
602 uint ycell = (uint)((int)otherRegion.RegionLocY / (int)Constants.RegionSize);
603 m_log.InfoFormat("[SCENE]: (on region {0}): Region {1} up in coords {2}-{3}",
604 RegionInfo.RegionName, otherRegion.RegionName, xcell, ycell);
605 605
606 if (RegionInfo.RegionHandle != otherRegion.RegionHandle) 606 if (RegionInfo.RegionHandle != otherRegion.RegionHandle)
607 { 607 {
608 for (int i = 0; i < m_neighbours.Count; i++)
609 {
610 // The purpose of this loop is to re-update the known neighbors
611 // when another region comes up on top of another one.
612 // The latest region in that location ends up in the
613 // 'known neighbors list'
614 // Additionally, the commFailTF property gets reset to false.
615 if (m_neighbours[i].RegionHandle == otherRegion.RegionHandle)
616 {
617 lock (m_neighbours)
618 {
619 m_neighbours[i] = otherRegion;
620
621 }
622 }
623 }
624
625 // If the value isn't in the neighbours, add it.
626 // If the RegionInfo isn't exact but is for the same XY World location,
627 // then the above loop will fix that.
628
629 if (!(CheckNeighborRegion(otherRegion)))
630 {
631 lock (m_neighbours)
632 {
633 m_neighbours.Add(otherRegion);
634 //m_log.Info("[UP]: " + otherRegion.RegionHandle.ToString());
635 }
636 }
637 608
638 // If these are cast to INT because long + negative values + abs returns invalid data 609 // If these are cast to INT because long + negative values + abs returns invalid data
639 int resultX = Math.Abs((int)otherRegion.RegionLocX - (int)RegionInfo.RegionLocX); 610 int resultX = Math.Abs((int)xcell - (int)RegionInfo.RegionLocX);
640 int resultY = Math.Abs((int)otherRegion.RegionLocY - (int)RegionInfo.RegionLocY); 611 int resultY = Math.Abs((int)ycell - (int)RegionInfo.RegionLocY);
641 if (resultX <= 1 && resultY <= 1) 612 if (resultX <= 1 && resultY <= 1)
642 { 613 {
614 RegionInfo regInfo = new RegionInfo(xcell, ycell, otherRegion.InternalEndPoint, otherRegion.ExternalHostName);
615 regInfo.RegionID = otherRegion.RegionID;
616 regInfo.RegionName = otherRegion.RegionName;
617 regInfo.ScopeID = otherRegion.ScopeID;
618 regInfo.ExternalHostName = otherRegion.ExternalHostName;
619
643 try 620 try
644 { 621 {
645 ForEachScenePresence(delegate(ScenePresence agent) 622 ForEachScenePresence(delegate(ScenePresence agent)
@@ -653,7 +630,7 @@ namespace OpenSim.Region.Framework.Scenes
653 List<ulong> old = new List<ulong>(); 630 List<ulong> old = new List<ulong>();
654 old.Add(otherRegion.RegionHandle); 631 old.Add(otherRegion.RegionHandle);
655 agent.DropOldNeighbours(old); 632 agent.DropOldNeighbours(old);
656 InformClientOfNeighbor(agent, otherRegion); 633 InformClientOfNeighbor(agent, regInfo);
657 } 634 }
658 } 635 }
659 ); 636 );
@@ -672,7 +649,6 @@ namespace OpenSim.Region.Framework.Scenes
672 otherRegion.RegionLocY.ToString() + ")"); 649 otherRegion.RegionLocY.ToString() + ")");
673 } 650 }
674 } 651 }
675 return true;
676 } 652 }
677 653
678 public void AddNeighborRegion(RegionInfo region) 654 public void AddNeighborRegion(RegionInfo region)
@@ -704,9 +680,10 @@ namespace OpenSim.Region.Framework.Scenes
704 } 680 }
705 681
706 // Alias IncomingHelloNeighbour OtherRegionUp, for now 682 // Alias IncomingHelloNeighbour OtherRegionUp, for now
707 public bool IncomingHelloNeighbour(RegionInfo neighbour) 683 public GridRegion IncomingHelloNeighbour(RegionInfo neighbour)
708 { 684 {
709 return OtherRegionUp(neighbour); 685 OtherRegionUp(new GridRegion(neighbour));
686 return new GridRegion(RegionInfo);
710 } 687 }
711 688
712 /// <summary> 689 /// <summary>
@@ -3104,7 +3081,7 @@ namespace OpenSim.Region.Framework.Scenes
3104 m_sceneGridService.OnExpectUser += HandleNewUserConnection; 3081 m_sceneGridService.OnExpectUser += HandleNewUserConnection;
3105 m_sceneGridService.OnAvatarCrossingIntoRegion += AgentCrossing; 3082 m_sceneGridService.OnAvatarCrossingIntoRegion += AgentCrossing;
3106 m_sceneGridService.OnCloseAgentConnection += IncomingCloseAgent; 3083 m_sceneGridService.OnCloseAgentConnection += IncomingCloseAgent;
3107 m_sceneGridService.OnRegionUp += OtherRegionUp; 3084 //m_eventManager.OnRegionUp += OtherRegionUp;
3108 //m_sceneGridService.OnChildAgentUpdate += IncomingChildAgentDataUpdate; 3085 //m_sceneGridService.OnChildAgentUpdate += IncomingChildAgentDataUpdate;
3109 m_sceneGridService.OnExpectPrim += IncomingInterRegionPrimGroup; 3086 m_sceneGridService.OnExpectPrim += IncomingInterRegionPrimGroup;
3110 //m_sceneGridService.OnRemoveKnownRegionFromAvatar += HandleRemoveKnownRegionsFromAvatar; 3087 //m_sceneGridService.OnRemoveKnownRegionFromAvatar += HandleRemoveKnownRegionsFromAvatar;
@@ -3132,7 +3109,7 @@ namespace OpenSim.Region.Framework.Scenes
3132 //m_sceneGridService.OnRemoveKnownRegionFromAvatar -= HandleRemoveKnownRegionsFromAvatar; 3109 //m_sceneGridService.OnRemoveKnownRegionFromAvatar -= HandleRemoveKnownRegionsFromAvatar;
3133 m_sceneGridService.OnExpectPrim -= IncomingInterRegionPrimGroup; 3110 m_sceneGridService.OnExpectPrim -= IncomingInterRegionPrimGroup;
3134 //m_sceneGridService.OnChildAgentUpdate -= IncomingChildAgentDataUpdate; 3111 //m_sceneGridService.OnChildAgentUpdate -= IncomingChildAgentDataUpdate;
3135 m_sceneGridService.OnRegionUp -= OtherRegionUp; 3112 //m_eventManager.OnRegionUp -= OtherRegionUp;
3136 m_sceneGridService.OnExpectUser -= HandleNewUserConnection; 3113 m_sceneGridService.OnExpectUser -= HandleNewUserConnection;
3137 m_sceneGridService.OnAvatarCrossingIntoRegion -= AgentCrossing; 3114 m_sceneGridService.OnAvatarCrossingIntoRegion -= AgentCrossing;
3138 m_sceneGridService.OnCloseAgentConnection -= IncomingCloseAgent; 3115 m_sceneGridService.OnCloseAgentConnection -= IncomingCloseAgent;