mirror of
https://github.com/opensim/opensim.git
synced 2026-08-07 17:55:48 +08:00
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.
This commit is contained in:
@@ -1924,7 +1924,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
|
||||
if (m_regionInfo != null)
|
||||
{
|
||||
neighbours = RequestNeighbours(sp, m_regionInfo.RegionLocX, m_regionInfo.RegionLocY);
|
||||
neighbours = GetNeighbours(sp, m_regionInfo.RegionLocX, m_regionInfo.RegionLocY);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2364,16 +2364,17 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return the list of regions that are considered to be neighbours to the given scene.
|
||||
/// Return the list of online regions that are considered to be neighbours to the given scene.
|
||||
/// </summary>
|
||||
/// <param name="pScene"></param>
|
||||
/// <param name="avatar"></param>
|
||||
/// <param name="pRegionLocX"></param>
|
||||
/// <param name="pRegionLocY"></param>
|
||||
/// <returns></returns>
|
||||
protected List<GridRegion> RequestNeighbours(ScenePresence avatar, uint pRegionLocX, uint pRegionLocY)
|
||||
protected List<GridRegion> GetNeighbours(ScenePresence avatar, uint pRegionLocX, uint pRegionLocY)
|
||||
{
|
||||
Scene pScene = avatar.Scene;
|
||||
RegionInfo m_regionInfo = pScene.RegionInfo;
|
||||
List<GridRegion> neighbours;
|
||||
|
||||
// Leaving this as a "megaregions" computation vs "non-megaregions" computation; it isn't
|
||||
// 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
|
||||
uint endX = Util.RegionToWorldLoc(pRegionLocX) + dd + Constants.RegionSize/2;
|
||||
uint endY = Util.RegionToWorldLoc(pRegionLocY) + dd + Constants.RegionSize/2;
|
||||
|
||||
List<GridRegion> neighbours =
|
||||
avatar.Scene.GridService.GetRegionRange(m_regionInfo.ScopeID, (int)startX, (int)endX, (int)startY, (int)endY);
|
||||
|
||||
neighbours.RemoveAll(delegate(GridRegion r) { return r.RegionID == m_regionInfo.RegionID; });
|
||||
return neighbours;
|
||||
neighbours
|
||||
= avatar.Scene.GridService.GetRegionRange(
|
||||
m_regionInfo.ScopeID, (int)startX, (int)endX, (int)startY, (int)endY);
|
||||
}
|
||||
else
|
||||
{
|
||||
Vector2 swCorner, neCorner;
|
||||
GetMegaregionViewRange(out swCorner, out neCorner);
|
||||
|
||||
List<GridRegion> neighbours
|
||||
neighbours
|
||||
= pScene.GridService.GetRegionRange(
|
||||
m_regionInfo.ScopeID,
|
||||
(int)Util.RegionToWorldLoc((uint)swCorner.X), (int)Util.RegionToWorldLoc((uint)neCorner.X),
|
||||
(int)Util.RegionToWorldLoc((uint)swCorner.Y), (int)Util.RegionToWorldLoc((uint)neCorner.Y) );
|
||||
|
||||
neighbours.RemoveAll(delegate(GridRegion r) { return r.RegionID == m_regionInfo.RegionID; });
|
||||
|
||||
return neighbours;
|
||||
(int)Util.RegionToWorldLoc((uint)swCorner.Y), (int)Util.RegionToWorldLoc((uint)neCorner.Y));
|
||||
}
|
||||
|
||||
// neighbours.ForEach(
|
||||
// n =>
|
||||
// m_log.DebugFormat(
|
||||
// "[ENTITY TRANSFER MODULE]: Region flags for {0} as seen by {1} are {2}",
|
||||
// n.RegionName, Scene.Name, n.RegionFlags != null ? n.RegionFlags.ToString() : "not present"));
|
||||
|
||||
// The r.RegionFlags == null check only needs to be made for simulators before 2015-01-14 (pre 0.8.1).
|
||||
neighbours.RemoveAll(
|
||||
r =>
|
||||
r.RegionID == m_regionInfo.RegionID
|
||||
|| (r.RegionFlags != null && (r.RegionFlags & OpenSim.Framework.RegionFlags.RegionOnline) == 0));
|
||||
|
||||
return neighbours;
|
||||
}
|
||||
|
||||
private List<ulong> NewNeighbours(List<ulong> currentNeighbours, List<ulong> previousNeighbours)
|
||||
|
||||
Reference in New Issue
Block a user