diff options
author | Justin Clark-Casey (justincc) | 2015-01-14 19:40:17 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2015-01-14 19:45:19 +0000 |
commit | beef41f24cfdc57e584d19beed423cba83b7f829 (patch) | |
tree | 7bbf881eb3cc4ce5fd9d8d8c39c2dbc82126ed9d /OpenSim/Region | |
parent | Also deleted the option of setting Cap_WebFetchInventoryDescendents from Open... (diff) | |
download | opensim-SC_OLD-beef41f24cfdc57e584d19beed423cba83b7f829.zip opensim-SC_OLD-beef41f24cfdc57e584d19beed423cba83b7f829.tar.gz opensim-SC_OLD-beef41f24cfdc57e584d19beed423cba83b7f829.tar.bz2 opensim-SC_OLD-beef41f24cfdc57e584d19beed423cba83b7f829.tar.xz |
Stop simulators attempting to contact registered but offline regions (RegionFlags.Persistent but not RegioNFlags.RegionOnline) on startup and when an avatar completes a teleport.
This eliminates spurious network calls and failure reporting.
This is done by adding RegionFlags to the GridRegion returned data in a backward compatible way as an alternative to multiple IGridService.GetRegionFlags() calls
Using a simulator or a grid service older than this commit will just see previous behaviour.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | 37 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs | 27 |
2 files changed, 49 insertions, 15 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index cb32eec..089bd4f 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -1924,7 +1924,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1924 | 1924 | ||
1925 | if (m_regionInfo != null) | 1925 | if (m_regionInfo != null) |
1926 | { | 1926 | { |
1927 | neighbours = RequestNeighbours(sp, m_regionInfo.RegionLocX, m_regionInfo.RegionLocY); | 1927 | neighbours = GetNeighbours(sp, m_regionInfo.RegionLocX, m_regionInfo.RegionLocY); |
1928 | } | 1928 | } |
1929 | else | 1929 | else |
1930 | { | 1930 | { |
@@ -2364,16 +2364,17 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2364 | } | 2364 | } |
2365 | 2365 | ||
2366 | /// <summary> | 2366 | /// <summary> |
2367 | /// Return the list of regions that are considered to be neighbours to the given scene. | 2367 | /// Return the list of online regions that are considered to be neighbours to the given scene. |
2368 | /// </summary> | 2368 | /// </summary> |
2369 | /// <param name="pScene"></param> | 2369 | /// <param name="avatar"></param> |
2370 | /// <param name="pRegionLocX"></param> | 2370 | /// <param name="pRegionLocX"></param> |
2371 | /// <param name="pRegionLocY"></param> | 2371 | /// <param name="pRegionLocY"></param> |
2372 | /// <returns></returns> | 2372 | /// <returns></returns> |
2373 | protected List<GridRegion> RequestNeighbours(ScenePresence avatar, uint pRegionLocX, uint pRegionLocY) | 2373 | protected List<GridRegion> GetNeighbours(ScenePresence avatar, uint pRegionLocX, uint pRegionLocY) |
2374 | { | 2374 | { |
2375 | Scene pScene = avatar.Scene; | 2375 | Scene pScene = avatar.Scene; |
2376 | RegionInfo m_regionInfo = pScene.RegionInfo; | 2376 | RegionInfo m_regionInfo = pScene.RegionInfo; |
2377 | List<GridRegion> neighbours; | ||
2377 | 2378 | ||
2378 | // Leaving this as a "megaregions" computation vs "non-megaregions" computation; it isn't | 2379 | // Leaving this as a "megaregions" computation vs "non-megaregions" computation; it isn't |
2379 | // clear what should be done with a "far view" given that megaregions already extended the | 2380 | // clear what should be done with a "far view" given that megaregions already extended the |
@@ -2391,27 +2392,35 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2391 | uint endX = Util.RegionToWorldLoc(pRegionLocX) + dd + Constants.RegionSize/2; | 2392 | uint endX = Util.RegionToWorldLoc(pRegionLocX) + dd + Constants.RegionSize/2; |
2392 | uint endY = Util.RegionToWorldLoc(pRegionLocY) + dd + Constants.RegionSize/2; | 2393 | uint endY = Util.RegionToWorldLoc(pRegionLocY) + dd + Constants.RegionSize/2; |
2393 | 2394 | ||
2394 | List<GridRegion> neighbours = | 2395 | neighbours |
2395 | avatar.Scene.GridService.GetRegionRange(m_regionInfo.ScopeID, (int)startX, (int)endX, (int)startY, (int)endY); | 2396 | = avatar.Scene.GridService.GetRegionRange( |
2396 | 2397 | m_regionInfo.ScopeID, (int)startX, (int)endX, (int)startY, (int)endY); | |
2397 | neighbours.RemoveAll(delegate(GridRegion r) { return r.RegionID == m_regionInfo.RegionID; }); | ||
2398 | return neighbours; | ||
2399 | } | 2398 | } |
2400 | else | 2399 | else |
2401 | { | 2400 | { |
2402 | Vector2 swCorner, neCorner; | 2401 | Vector2 swCorner, neCorner; |
2403 | GetMegaregionViewRange(out swCorner, out neCorner); | 2402 | GetMegaregionViewRange(out swCorner, out neCorner); |
2404 | 2403 | ||
2405 | List<GridRegion> neighbours | 2404 | neighbours |
2406 | = pScene.GridService.GetRegionRange( | 2405 | = pScene.GridService.GetRegionRange( |
2407 | m_regionInfo.ScopeID, | 2406 | m_regionInfo.ScopeID, |
2408 | (int)Util.RegionToWorldLoc((uint)swCorner.X), (int)Util.RegionToWorldLoc((uint)neCorner.X), | 2407 | (int)Util.RegionToWorldLoc((uint)swCorner.X), (int)Util.RegionToWorldLoc((uint)neCorner.X), |
2409 | (int)Util.RegionToWorldLoc((uint)swCorner.Y), (int)Util.RegionToWorldLoc((uint)neCorner.Y) ); | 2408 | (int)Util.RegionToWorldLoc((uint)swCorner.Y), (int)Util.RegionToWorldLoc((uint)neCorner.Y)); |
2409 | } | ||
2410 | 2410 | ||
2411 | neighbours.RemoveAll(delegate(GridRegion r) { return r.RegionID == m_regionInfo.RegionID; }); | 2411 | // neighbours.ForEach( |
2412 | // n => | ||
2413 | // m_log.DebugFormat( | ||
2414 | // "[ENTITY TRANSFER MODULE]: Region flags for {0} as seen by {1} are {2}", | ||
2415 | // n.RegionName, Scene.Name, n.RegionFlags != null ? n.RegionFlags.ToString() : "not present")); | ||
2412 | 2416 | ||
2413 | return neighbours; | 2417 | // The r.RegionFlags == null check only needs to be made for simulators before 2015-01-14 (pre 0.8.1). |
2414 | } | 2418 | neighbours.RemoveAll( |
2419 | r => | ||
2420 | r.RegionID == m_regionInfo.RegionID | ||
2421 | || (r.RegionFlags != null && (r.RegionFlags & OpenSim.Framework.RegionFlags.RegionOnline) == 0)); | ||
2422 | |||
2423 | return neighbours; | ||
2415 | } | 2424 | } |
2416 | 2425 | ||
2417 | private List<ulong> NewNeighbours(List<ulong> currentNeighbours, List<ulong> previousNeighbours) | 2426 | private List<ulong> NewNeighbours(List<ulong> currentNeighbours, List<ulong> previousNeighbours) |
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index 9db5309..8101768 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs | |||
@@ -109,10 +109,35 @@ namespace OpenSim.Region.Framework.Scenes | |||
109 | List<GridRegion> neighbours | 109 | List<GridRegion> neighbours |
110 | = m_scene.GridService.GetNeighbours(m_scene.RegionInfo.ScopeID, m_scene.RegionInfo.RegionID); | 110 | = m_scene.GridService.GetNeighbours(m_scene.RegionInfo.ScopeID, m_scene.RegionInfo.RegionID); |
111 | 111 | ||
112 | m_log.DebugFormat("{0} Informing {1} neighbours that region {2} is up", LogHeader, neighbours.Count, m_scene.Name); | 112 | List<GridRegion> onlineNeighbours = new List<GridRegion>(); |
113 | 113 | ||
114 | foreach (GridRegion n in neighbours) | 114 | foreach (GridRegion n in neighbours) |
115 | { | 115 | { |
116 | OpenSim.Framework.RegionFlags? regionFlags = n.RegionFlags; | ||
117 | |||
118 | // m_log.DebugFormat( | ||
119 | // "{0}: Region flags for {1} as seen by {2} are {3}", | ||
120 | // LogHeader, n.RegionName, m_scene.Name, regionFlags != null ? regionFlags.ToString() : "not present"); | ||
121 | |||
122 | // Robust services before 2015-01-14 do not return the regionFlags information. In this case, we could | ||
123 | // make a separate RegionFlags call but this would involve a network call for each neighbour. | ||
124 | if (regionFlags != null) | ||
125 | { | ||
126 | if ((regionFlags & OpenSim.Framework.RegionFlags.RegionOnline) != 0) | ||
127 | onlineNeighbours.Add(n); | ||
128 | } | ||
129 | else | ||
130 | { | ||
131 | onlineNeighbours.Add(n); | ||
132 | } | ||
133 | } | ||
134 | |||
135 | m_log.DebugFormat( | ||
136 | "{0} Informing {1} neighbours that region {2} is up", | ||
137 | LogHeader, onlineNeighbours.Count, m_scene.Name); | ||
138 | |||
139 | foreach (GridRegion n in onlineNeighbours) | ||
140 | { | ||
116 | InformNeighbourThatRegionUpDelegate d = InformNeighboursThatRegionIsUpAsync; | 141 | InformNeighbourThatRegionUpDelegate d = InformNeighboursThatRegionIsUpAsync; |
117 | d.BeginInvoke(neighbourService, region, n.RegionHandle, | 142 | d.BeginInvoke(neighbourService, region, n.RegionHandle, |
118 | InformNeighborsThatRegionisUpCompleted, | 143 | InformNeighborsThatRegionisUpCompleted, |