diff options
author | Diva Canto | 2009-09-27 10:14:10 -0700 |
---|---|---|
committer | Diva Canto | 2009-09-27 10:14:10 -0700 |
commit | 5d09c53a1a42b38e1ee35cfbb5571d70b75380f4 (patch) | |
tree | 247412b0147ea11f4113413c1fa7d7e91eec0aa5 /OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs | |
parent | Poof! on LocalBackend. CommsManager.GridServices deleted. (diff) | |
download | opensim-SC-5d09c53a1a42b38e1ee35cfbb5571d70b75380f4.zip opensim-SC-5d09c53a1a42b38e1ee35cfbb5571d70b75380f4.tar.gz opensim-SC-5d09c53a1a42b38e1ee35cfbb5571d70b75380f4.tar.bz2 opensim-SC-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/SceneCommunicationService.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs | 87 |
1 files changed, 37 insertions, 50 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index 9071701..3294ceb 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs | |||
@@ -93,10 +93,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
93 | /// </summary> | 93 | /// </summary> |
94 | public event PrimCrossing OnPrimCrossingIntoRegion; | 94 | public event PrimCrossing OnPrimCrossingIntoRegion; |
95 | 95 | ||
96 | /// <summary> | 96 | ///// <summary> |
97 | /// A New Region is up and available | 97 | ///// A New Region is up and available |
98 | /// </summary> | 98 | ///// </summary> |
99 | public event RegionUp OnRegionUp; | 99 | //public event RegionUp OnRegionUp; |
100 | 100 | ||
101 | /// <summary> | 101 | /// <summary> |
102 | /// We have a child agent for this avatar and we're getting a status update about it | 102 | /// We have a child agent for this avatar and we're getting a status update about it |
@@ -119,7 +119,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
119 | private ExpectPrimDelegate handlerExpectPrim = null; // OnExpectPrim; | 119 | private ExpectPrimDelegate handlerExpectPrim = null; // OnExpectPrim; |
120 | private CloseAgentConnection handlerCloseAgentConnection = null; // OnCloseAgentConnection; | 120 | private CloseAgentConnection handlerCloseAgentConnection = null; // OnCloseAgentConnection; |
121 | private PrimCrossing handlerPrimCrossingIntoRegion = null; // OnPrimCrossingIntoRegion; | 121 | private PrimCrossing handlerPrimCrossingIntoRegion = null; // OnPrimCrossingIntoRegion; |
122 | private RegionUp handlerRegionUp = null; // OnRegionUp; | 122 | //private RegionUp handlerRegionUp = null; // OnRegionUp; |
123 | private ChildAgentUpdate handlerChildAgentUpdate = null; // OnChildAgentUpdate; | 123 | private ChildAgentUpdate handlerChildAgentUpdate = null; // OnChildAgentUpdate; |
124 | //private RemoveKnownRegionsFromAvatarList handlerRemoveKnownRegionFromAvatar = null; // OnRemoveKnownRegionFromAvatar; | 124 | //private RemoveKnownRegionsFromAvatarList handlerRemoveKnownRegionFromAvatar = null; // OnRemoveKnownRegionFromAvatar; |
125 | private LogOffUser handlerLogOffUser = null; | 125 | private LogOffUser handlerLogOffUser = null; |
@@ -239,22 +239,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
239 | } | 239 | } |
240 | 240 | ||
241 | /// <summary> | 241 | /// <summary> |
242 | /// A New Region is now available. Inform the scene that there is a new region available. | ||
243 | /// </summary> | ||
244 | /// <param name="region">Information about the new region that is available</param> | ||
245 | /// <returns>True if the event was handled</returns> | ||
246 | protected bool newRegionUp(RegionInfo region) | ||
247 | { | ||
248 | handlerRegionUp = OnRegionUp; | ||
249 | if (handlerRegionUp != null) | ||
250 | { | ||
251 | //m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: newRegionUp Fired for User:" + region.RegionName); | ||
252 | handlerRegionUp(region); | ||
253 | } | ||
254 | return true; | ||
255 | } | ||
256 | |||
257 | /// <summary> | ||
258 | /// Inform the scene that we've got an update about a child agent that we have | 242 | /// Inform the scene that we've got an update about a child agent that we have |
259 | /// </summary> | 243 | /// </summary> |
260 | /// <param name="cAgentData"></param> | 244 | /// <param name="cAgentData"></param> |
@@ -647,31 +631,23 @@ namespace OpenSim.Region.Framework.Scenes | |||
647 | /// <param name="regionhandle"></param> | 631 | /// <param name="regionhandle"></param> |
648 | private void InformNeighboursThatRegionIsUpAsync(INeighbourService neighbourService, RegionInfo region, ulong regionhandle) | 632 | private void InformNeighboursThatRegionIsUpAsync(INeighbourService neighbourService, RegionInfo region, ulong regionhandle) |
649 | { | 633 | { |
650 | m_log.Info("[INTERGRID]: Starting to inform neighbors that I'm here"); | 634 | uint x = 0, y = 0; |
651 | //RegionUpData regiondata = new RegionUpData(region.RegionLocX, region.RegionLocY, region.ExternalHostName, region.InternalEndPoint.Port); | 635 | Utils.LongToUInts(regionhandle, out x, out y); |
652 | 636 | ||
653 | //bool regionAccepted = | 637 | GridRegion neighbour = null; |
654 | // m_commsProvider.InterRegion.RegionUp(new SerializableRegionInfo(region), regionhandle); | ||
655 | |||
656 | //bool regionAccepted = m_interregionCommsOut.SendHelloNeighbour(regionhandle, region); | ||
657 | bool regionAccepted = false; | ||
658 | if (neighbourService != null) | 638 | if (neighbourService != null) |
659 | regionAccepted = neighbourService.HelloNeighbour(regionhandle, region); | 639 | neighbour = neighbourService.HelloNeighbour(regionhandle, region); |
660 | else | 640 | else |
661 | m_log.DebugFormat("[SCS]: No neighbour service provided for informing neigbhours of this region"); | 641 | m_log.DebugFormat("[SCS]: No neighbour service provided for informing neigbhours of this region"); |
662 | 642 | ||
663 | if (regionAccepted) | 643 | if (neighbour != null) |
664 | { | 644 | { |
665 | m_log.Info("[INTERGRID]: Completed informing neighbors that I'm here"); | 645 | m_log.DebugFormat("[INTERGRID]: Successfully informed neighbour {0}-{1} that I'm here", x / Constants.RegionSize, y / Constants.RegionSize); |
666 | handlerRegionUp = OnRegionUp; | 646 | m_scene.EventManager.TriggerOnRegionUp(neighbour); |
667 | |||
668 | // yes, we're notifying ourselves. | ||
669 | if (handlerRegionUp != null) | ||
670 | handlerRegionUp(region); | ||
671 | } | 647 | } |
672 | else | 648 | else |
673 | { | 649 | { |
674 | m_log.Warn("[INTERGRID]: Failed to inform neighbors that I'm here."); | 650 | m_log.WarnFormat("[INTERGRID]: Failed to inform neighbour {0}-{1} that I'm here.", x / Constants.RegionSize, y / Constants.RegionSize); |
675 | } | 651 | } |
676 | } | 652 | } |
677 | 653 | ||
@@ -680,22 +656,33 @@ namespace OpenSim.Region.Framework.Scenes | |||
680 | { | 656 | { |
681 | //m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: Sending InterRegion Notification that region is up " + region.RegionName); | 657 | //m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: Sending InterRegion Notification that region is up " + region.RegionName); |
682 | 658 | ||
659 | for (int x = (int)region.RegionLocX - 1; x <= region.RegionLocX + 1; x++) | ||
660 | for (int y = (int)region.RegionLocY - 1; y <= region.RegionLocY + 1; y++) | ||
661 | if (!((x == region.RegionLocX) && (y == region.RegionLocY))) // skip this region | ||
662 | { | ||
663 | ulong handle = Utils.UIntsToLong((uint)x * Constants.RegionSize, (uint)y * Constants.RegionSize); | ||
664 | InformNeighbourThatRegionUpDelegate d = InformNeighboursThatRegionIsUpAsync; | ||
683 | 665 | ||
684 | List<GridRegion> neighbours = new List<GridRegion>(); | 666 | d.BeginInvoke(neighbourService, region, handle, |
685 | // This stays uncached because we don't already know about our neighbors at this point. | 667 | InformNeighborsThatRegionisUpCompleted, |
668 | d); | ||
669 | } | ||
686 | 670 | ||
687 | neighbours = m_scene.GridService.GetNeighbours(m_regionInfo.ScopeID, m_regionInfo.RegionID); | 671 | //List<GridRegion> neighbours = new List<GridRegion>(); |
688 | if (neighbours != null) | 672 | //// This stays uncached because we don't already know about our neighbors at this point. |
689 | { | ||
690 | for (int i = 0; i < neighbours.Count; i++) | ||
691 | { | ||
692 | InformNeighbourThatRegionUpDelegate d = InformNeighboursThatRegionIsUpAsync; | ||
693 | 673 | ||
694 | d.BeginInvoke(neighbourService, region, neighbours[i].RegionHandle, | 674 | //neighbours = m_scene.GridService.GetNeighbours(m_regionInfo.ScopeID, m_regionInfo.RegionID); |
695 | InformNeighborsThatRegionisUpCompleted, | 675 | //if (neighbours != null) |
696 | d); | 676 | //{ |
697 | } | 677 | // for (int i = 0; i < neighbours.Count; i++) |
698 | } | 678 | // { |
679 | // InformNeighbourThatRegionUpDelegate d = InformNeighboursThatRegionIsUpAsync; | ||
680 | |||
681 | // d.BeginInvoke(neighbourService, region, neighbours[i].RegionHandle, | ||
682 | // InformNeighborsThatRegionisUpCompleted, | ||
683 | // d); | ||
684 | // } | ||
685 | //} | ||
699 | 686 | ||
700 | //bool val = m_commsProvider.InterRegion.RegionUp(new SerializableRegionInfo(region)); | 687 | //bool val = m_commsProvider.InterRegion.RegionUp(new SerializableRegionInfo(region)); |
701 | } | 688 | } |