Tell hypergridders when their teleports fail because of the 4096 limit rather than just saying "destination not found"
Instead of performing the 4096 check when the region is linked (and subsequently removing the link), leave the link in place and perform the check in the entity transfer module This allows us to explicitly tell the hypergridder why the teleport failed (region out of range). It also allows people on regions that are within range (on a large source grid) to teleport. The Check4096 config parameter in the [GridService] section is replaced by a max_distance paramter in a new [EntityTransfer] section in OpenSimDefaults.ini Since the parameter is in OpenSimDefaults.ini no action needs to be taken unless you want to increase this limit. It could also be decreased. The check is being made in the base entity transfer module, since I believe the viewer problem occurs both on extremely large grids and while hypergridding.bulletsim
parent
7819b4a794
commit
de20f0603f
|
@ -50,6 +50,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The maximum distance, in standard region units (256m) that an agent is allowed to transfer.
|
||||||
|
/// </summary>
|
||||||
|
public int MaxTransferDistance { get; set; }
|
||||||
|
|
||||||
protected bool m_Enabled = false;
|
protected bool m_Enabled = false;
|
||||||
protected Scene m_aScene;
|
protected Scene m_aScene;
|
||||||
protected List<Scene> m_Scenes = new List<Scene>();
|
protected List<Scene> m_Scenes = new List<Scene>();
|
||||||
|
@ -78,11 +83,24 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
string name = moduleConfig.GetString("EntityTransferModule", "");
|
string name = moduleConfig.GetString("EntityTransferModule", "");
|
||||||
if (name == Name)
|
if (name == Name)
|
||||||
{
|
{
|
||||||
|
InitialiseCommon(source);
|
||||||
|
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: {0} enabled.", Name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initialize config common for this module and any descendents.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="source"></param>
|
||||||
|
protected virtual void InitialiseCommon(IConfigSource source)
|
||||||
|
{
|
||||||
|
IConfig transferConfig = source.Configs["EntityTransfer"];
|
||||||
|
if (transferConfig != null)
|
||||||
|
MaxTransferDistance = transferConfig.GetInt("max_distance", 4095);
|
||||||
|
|
||||||
m_agentsInTransit = new List<UUID>();
|
m_agentsInTransit = new List<UUID>();
|
||||||
m_Enabled = true;
|
m_Enabled = true;
|
||||||
m_log.InfoFormat("[ENTITY TRANSFER MODULE]: {0} enabled.", Name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void PostInitialise()
|
public virtual void PostInitialise()
|
||||||
|
@ -114,7 +132,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public virtual void RemoveRegion(Scene scene)
|
public virtual void RemoveRegion(Scene scene)
|
||||||
{
|
{
|
||||||
if (!m_Enabled)
|
if (!m_Enabled)
|
||||||
|
@ -129,7 +146,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
{
|
{
|
||||||
if (!m_Enabled)
|
if (!m_Enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -204,8 +220,18 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
sp.ControllingClient.SendTeleportFailed("Problem at destination");
|
sp.ControllingClient.SendTeleportFailed("Problem at destination");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Final destination is x={0} y={1} {2}@{3}",
|
|
||||||
finalDestination.RegionLocX / Constants.RegionSize, finalDestination.RegionLocY / Constants.RegionSize, finalDestination.RegionID, finalDestination.ServerURI);
|
uint curX = 0, curY = 0;
|
||||||
|
Utils.LongToUInts(sp.Scene.RegionInfo.RegionHandle, out curX, out curY);
|
||||||
|
int curCellX = (int)(curX / Constants.RegionSize);
|
||||||
|
int curCellY = (int)(curY / Constants.RegionSize);
|
||||||
|
int destCellX = (int)(finalDestination.RegionLocX / Constants.RegionSize);
|
||||||
|
int destCellY = (int)(finalDestination.RegionLocY / Constants.RegionSize);
|
||||||
|
|
||||||
|
// m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Source co-ords are x={0} y={1}", curRegionX, curRegionY);
|
||||||
|
//
|
||||||
|
// m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Final dest is x={0} y={1} {2}@{3}",
|
||||||
|
// destRegionX, destRegionY, finalDestination.RegionID, finalDestination.ServerURI);
|
||||||
|
|
||||||
// Check that these are not the same coordinates
|
// Check that these are not the same coordinates
|
||||||
if (finalDestination.RegionLocX == sp.Scene.RegionInfo.RegionLocX &&
|
if (finalDestination.RegionLocX == sp.Scene.RegionInfo.RegionLocX &&
|
||||||
|
@ -216,6 +242,18 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Math.Abs(curCellX - destCellX) > MaxTransferDistance || Math.Abs(curCellY - destCellY) > MaxTransferDistance)
|
||||||
|
{
|
||||||
|
sp.ControllingClient.SendTeleportFailed(
|
||||||
|
string.Format(
|
||||||
|
"Can't teleport to {0} ({1},{2}) from {3} ({4},{5}), destination is more than {6} regions way",
|
||||||
|
finalDestination.RegionName, destCellX, destCellY,
|
||||||
|
sp.Scene.RegionInfo.RegionName, curCellX, curCellY,
|
||||||
|
MaxTransferDistance));
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// This is it
|
// This is it
|
||||||
//
|
//
|
||||||
|
|
|
@ -67,10 +67,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
string name = moduleConfig.GetString("EntityTransferModule", "");
|
string name = moduleConfig.GetString("EntityTransferModule", "");
|
||||||
if (name == Name)
|
if (name == Name)
|
||||||
{
|
{
|
||||||
m_agentsInTransit = new List<UUID>();
|
InitialiseCommon(source);
|
||||||
|
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: {0} enabled.", Name);
|
||||||
m_Enabled = true;
|
|
||||||
m_log.InfoFormat("[HG ENTITY TRANSFER MODULE]: {0} enabled.", Name);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,6 +92,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_log.DebugFormat("MAP NAME=({0})", mapName);
|
||||||
|
|
||||||
// try to fetch from GridServer
|
// try to fetch from GridServer
|
||||||
List<GridRegion> regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20);
|
List<GridRegion> regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20);
|
||||||
if (regionInfos == null)
|
if (regionInfos == null)
|
||||||
|
@ -103,7 +105,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
||||||
if (info != null)
|
if (info != null)
|
||||||
regionInfos.Add(info);
|
regionInfos.Add(info);
|
||||||
}
|
}
|
||||||
else if (regionInfos.Count == 0 && mapName.StartsWith("http://"))
|
else if (regionInfos.Count == 0)
|
||||||
remoteClient.SendAlertMessage("Hyperlink could not be established.");
|
remoteClient.SendAlertMessage("Hyperlink could not be established.");
|
||||||
|
|
||||||
m_log.DebugFormat("[MAPSEARCHMODULE]: search {0} returned {1} regions. Flags={2}", mapName, regionInfos.Count, flags);
|
m_log.DebugFormat("[MAPSEARCHMODULE]: search {0} returned {1} regions. Flags={2}", mapName, regionInfos.Count, flags);
|
||||||
|
|
|
@ -417,9 +417,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
|
||||||
public string ParcelVoiceInfoRequest(Scene scene, string request, string path, string param,
|
public string ParcelVoiceInfoRequest(Scene scene, string request, string path, string param,
|
||||||
UUID agentID, Caps caps)
|
UUID agentID, Caps caps)
|
||||||
{
|
{
|
||||||
// m_log.DebugFormat(
|
m_log.DebugFormat(
|
||||||
// "[FreeSwitchVoice][PARCELVOICE]: ParcelVoiceInfoRequest() on {0} for {1}",
|
"[FreeSwitchVoice][PARCELVOICE]: ParcelVoiceInfoRequest() on {0} for {1}",
|
||||||
// scene.RegionInfo.RegionName, agentID);
|
scene.RegionInfo.RegionName, agentID);
|
||||||
|
|
||||||
ScenePresence avatar = scene.GetScenePresence(agentID);
|
ScenePresence avatar = scene.GetScenePresence(agentID);
|
||||||
string avatarName = avatar.Name;
|
string avatarName = avatar.Name;
|
||||||
|
|
|
@ -63,7 +63,7 @@ namespace OpenSim.Services.GridService
|
||||||
protected GatekeeperServiceConnector m_GatekeeperConnector;
|
protected GatekeeperServiceConnector m_GatekeeperConnector;
|
||||||
|
|
||||||
protected UUID m_ScopeID = UUID.Zero;
|
protected UUID m_ScopeID = UUID.Zero;
|
||||||
protected bool m_Check4096 = true;
|
// protected bool m_Check4096 = true;
|
||||||
protected string m_MapTileDirectory = string.Empty;
|
protected string m_MapTileDirectory = string.Empty;
|
||||||
protected string m_ThisGatekeeper = string.Empty;
|
protected string m_ThisGatekeeper = string.Empty;
|
||||||
protected Uri m_ThisGatekeeperURI = null;
|
protected Uri m_ThisGatekeeperURI = null;
|
||||||
|
@ -121,7 +121,7 @@ namespace OpenSim.Services.GridService
|
||||||
if (scope != string.Empty)
|
if (scope != string.Empty)
|
||||||
UUID.TryParse(scope, out m_ScopeID);
|
UUID.TryParse(scope, out m_ScopeID);
|
||||||
|
|
||||||
m_Check4096 = gridConfig.GetBoolean("Check4096", true);
|
// m_Check4096 = gridConfig.GetBoolean("Check4096", true);
|
||||||
|
|
||||||
m_MapTileDirectory = gridConfig.GetString("MapTileDirectory", "maptiles");
|
m_MapTileDirectory = gridConfig.GetString("MapTileDirectory", "maptiles");
|
||||||
|
|
||||||
|
@ -347,14 +347,18 @@ namespace OpenSim.Services.GridService
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint x, y;
|
// We are now performing this check for each individual teleport in the EntityTransferModule instead. This
|
||||||
if (m_Check4096 && !Check4096(handle, out x, out y))
|
// allows us to give better feedback when teleports fail because of the distance reason (which can't be
|
||||||
{
|
// done here) and it also hypergrid teleports that are within range (possibly because the source grid
|
||||||
RemoveHyperlinkRegion(regInfo.RegionID);
|
// itself has regions that are very far apart).
|
||||||
reason = "Region is too far (" + x + ", " + y + ")";
|
// uint x, y;
|
||||||
m_log.Info("[HYPERGRID LINKER]: Unable to link, region is too far (" + x + ", " + y + ")");
|
// if (m_Check4096 && !Check4096(handle, out x, out y))
|
||||||
return false;
|
// {
|
||||||
}
|
// //RemoveHyperlinkRegion(regInfo.RegionID);
|
||||||
|
// reason = "Region is too far (" + x + ", " + y + ")";
|
||||||
|
// m_log.Info("[HYPERGRID LINKER]: Unable to link, region is too far (" + x + ", " + y + ")");
|
||||||
|
// //return false;
|
||||||
|
// }
|
||||||
|
|
||||||
regInfo.RegionID = regionID;
|
regInfo.RegionID = regionID;
|
||||||
|
|
||||||
|
@ -405,60 +409,59 @@ namespace OpenSim.Services.GridService
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
// Not currently used
|
||||||
/// Cope with this viewer limitation.
|
// /// <summary>
|
||||||
/// </summary>
|
// /// Cope with this viewer limitation.
|
||||||
/// <param name="regInfo"></param>
|
// /// </summary>
|
||||||
/// <returns></returns>
|
// /// <param name="regInfo"></param>
|
||||||
public bool Check4096(ulong realHandle, out uint x, out uint y)
|
// /// <returns></returns>
|
||||||
{
|
// public bool Check4096(ulong realHandle, out uint x, out uint y)
|
||||||
uint ux = 0, uy = 0;
|
// {
|
||||||
Utils.LongToUInts(realHandle, out ux, out uy);
|
// uint ux = 0, uy = 0;
|
||||||
x = ux / Constants.RegionSize;
|
// Utils.LongToUInts(realHandle, out ux, out uy);
|
||||||
y = uy / Constants.RegionSize;
|
// x = ux / Constants.RegionSize;
|
||||||
|
// y = uy / Constants.RegionSize;
|
||||||
const uint limit = (4096 - 1) * Constants.RegionSize;
|
//
|
||||||
uint xmin = ux - limit;
|
// const uint limit = (4096 - 1) * Constants.RegionSize;
|
||||||
uint xmax = ux + limit;
|
// uint xmin = ux - limit;
|
||||||
uint ymin = uy - limit;
|
// uint xmax = ux + limit;
|
||||||
uint ymax = uy + limit;
|
// uint ymin = uy - limit;
|
||||||
// World map boundary checks
|
// uint ymax = uy + limit;
|
||||||
if (xmin < 0 || xmin > ux)
|
// // World map boundary checks
|
||||||
xmin = 0;
|
// if (xmin < 0 || xmin > ux)
|
||||||
if (xmax > int.MaxValue || xmax < ux)
|
// xmin = 0;
|
||||||
xmax = int.MaxValue;
|
// if (xmax > int.MaxValue || xmax < ux)
|
||||||
if (ymin < 0 || ymin > uy)
|
// xmax = int.MaxValue;
|
||||||
ymin = 0;
|
// if (ymin < 0 || ymin > uy)
|
||||||
if (ymax > int.MaxValue || ymax < uy)
|
// ymin = 0;
|
||||||
ymax = int.MaxValue;
|
// if (ymax > int.MaxValue || ymax < uy)
|
||||||
|
// ymax = int.MaxValue;
|
||||||
// Check for any regions that are within the possible teleport range to the linked region
|
//
|
||||||
List<GridRegion> regions = m_GridService.GetRegionRange(m_ScopeID, (int)xmin, (int)xmax, (int)ymin, (int)ymax);
|
// // Check for any regions that are within the possible teleport range to the linked region
|
||||||
if (regions.Count == 0)
|
// List<GridRegion> regions = m_GridService.GetRegionRange(m_ScopeID, (int)xmin, (int)xmax, (int)ymin, (int)ymax);
|
||||||
{
|
// if (regions.Count == 0)
|
||||||
return false;
|
// {
|
||||||
}
|
// return false;
|
||||||
else
|
// }
|
||||||
{
|
// else
|
||||||
// Check for regions which are not linked regions
|
// {
|
||||||
List<GridRegion> hyperlinks = m_GridService.GetHyperlinks(m_ScopeID);
|
// // Check for regions which are not linked regions
|
||||||
IEnumerable<GridRegion> availableRegions = regions.Except(hyperlinks);
|
// List<GridRegion> hyperlinks = m_GridService.GetHyperlinks(m_ScopeID);
|
||||||
if (availableRegions.Count() == 0)
|
// IEnumerable<GridRegion> availableRegions = regions.Except(hyperlinks);
|
||||||
return false;
|
// if (availableRegions.Count() == 0)
|
||||||
}
|
// return false;
|
||||||
|
// }
|
||||||
return true;
|
//
|
||||||
}
|
// return true;
|
||||||
|
// }
|
||||||
|
|
||||||
private void AddHyperlinkRegion(GridRegion regionInfo, ulong regionHandle)
|
private void AddHyperlinkRegion(GridRegion regionInfo, ulong regionHandle)
|
||||||
{
|
{
|
||||||
|
|
||||||
RegionData rdata = m_GridService.RegionInfo2RegionData(regionInfo);
|
RegionData rdata = m_GridService.RegionInfo2RegionData(regionInfo);
|
||||||
int flags = (int)OpenSim.Data.RegionFlags.Hyperlink + (int)OpenSim.Data.RegionFlags.NoDirectLogin + (int)OpenSim.Data.RegionFlags.RegionOnline;
|
int flags = (int)OpenSim.Data.RegionFlags.Hyperlink + (int)OpenSim.Data.RegionFlags.NoDirectLogin + (int)OpenSim.Data.RegionFlags.RegionOnline;
|
||||||
rdata.Data["flags"] = flags.ToString();
|
rdata.Data["flags"] = flags.ToString();
|
||||||
|
|
||||||
m_Database.Store(rdata);
|
m_Database.Store(rdata);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RemoveHyperlinkRegion(UUID regionID)
|
private void RemoveHyperlinkRegion(UUID regionID)
|
||||||
|
|
|
@ -504,6 +504,10 @@
|
||||||
; Distance in meters that shouts should travel. Default is 100m
|
; Distance in meters that shouts should travel. Default is 100m
|
||||||
shout_distance = 100
|
shout_distance = 100
|
||||||
|
|
||||||
|
[EntityTransfer]
|
||||||
|
; The maximum distance in regions that an agent is allowed to teleport along the x or y axis
|
||||||
|
; This is set to 4095 because current viewers can't handle teleports that are greater than this distance
|
||||||
|
max_distance = 4095
|
||||||
|
|
||||||
[Messaging]
|
[Messaging]
|
||||||
; Control which region module is used for instant messaging.
|
; Control which region module is used for instant messaging.
|
||||||
|
|
|
@ -63,9 +63,6 @@
|
||||||
;;--- For MySql region storage (alternative)
|
;;--- For MySql region storage (alternative)
|
||||||
;StorageProvider = "OpenSim.Data.MySQL.dll:MySqlRegionData"
|
;StorageProvider = "OpenSim.Data.MySQL.dll:MySqlRegionData"
|
||||||
|
|
||||||
;; With hypergrid, perform distance check for the creation of a linked region
|
|
||||||
; Check4096 = true
|
|
||||||
|
|
||||||
;; Directory for map tile images of remote regions
|
;; Directory for map tile images of remote regions
|
||||||
; MapTileDirectory = "./maptiles"
|
; MapTileDirectory = "./maptiles"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue