If an agent is still registered as 'in transit' by the source region, don't allow an immediate teleport back.
This is to help relieve a race condition when an agent teleports then immediately attempts to teleport back before the source region has properly cleaned up/demoted the old ScenePresence. This is rare in viewers but much more possible via scripting or region module. However, more needs to be done since virtually all clean up happens after the transit flag is cleared . Possibly need to add a 'cleaning up' state to in transit. This change required making the EntityTransferModule and HGEntityTransferModule per-region rather than shared, in order to allow separate transit lists. Changes were also required in LocalSimulationConnector. Tested in standalone, grid and with local and remote region crossings with attachments.0.7.4.1
parent
bc543c1797
commit
459c7635af
|
@ -46,7 +46,7 @@ using Nini.Config;
|
||||||
|
|
||||||
namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
{
|
{
|
||||||
public class EntityTransferModule : ISharedRegionModule, IEntityTransferModule
|
public class EntityTransferModule : INonSharedRegionModule, IEntityTransferModule
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
@ -65,9 +65,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
public bool EnableWaitForCallbackFromTeleportDest { get; set; }
|
public bool EnableWaitForCallbackFromTeleportDest { get; set; }
|
||||||
|
|
||||||
protected bool m_Enabled = false;
|
protected bool m_Enabled = false;
|
||||||
protected Scene m_aScene;
|
|
||||||
protected List<Scene> m_Scenes = new List<Scene>();
|
protected Scene m_scene;
|
||||||
|
|
||||||
protected List<UUID> m_agentsInTransit;
|
protected List<UUID> m_agentsInTransit;
|
||||||
|
|
||||||
private ExpiringCache<UUID, ExpiringCache<ulong, DateTime>> m_bannedRegions =
|
private ExpiringCache<UUID, ExpiringCache<ulong, DateTime>> m_bannedRegions =
|
||||||
new ExpiringCache<UUID, ExpiringCache<ulong, DateTime>>();
|
new ExpiringCache<UUID, ExpiringCache<ulong, DateTime>>();
|
||||||
|
|
||||||
|
@ -129,10 +131,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
if (!m_Enabled)
|
if (!m_Enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (m_aScene == null)
|
m_scene = scene;
|
||||||
m_aScene = scene;
|
|
||||||
|
|
||||||
m_Scenes.Add(scene);
|
|
||||||
scene.RegisterModuleInterface<IEntityTransferModule>(this);
|
scene.RegisterModuleInterface<IEntityTransferModule>(this);
|
||||||
scene.EventManager.OnNewClient += OnNewClient;
|
scene.EventManager.OnNewClient += OnNewClient;
|
||||||
}
|
}
|
||||||
|
@ -143,27 +143,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
client.OnTeleportLandmarkRequest += RequestTeleportLandmark;
|
client.OnTeleportLandmarkRequest += RequestTeleportLandmark;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void Close()
|
public virtual void Close() {}
|
||||||
{
|
|
||||||
if (!m_Enabled)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual void RemoveRegion(Scene scene)
|
public virtual void RemoveRegion(Scene scene) {}
|
||||||
{
|
|
||||||
if (!m_Enabled)
|
|
||||||
return;
|
|
||||||
if (scene == m_aScene)
|
|
||||||
m_aScene = null;
|
|
||||||
|
|
||||||
m_Scenes.Remove(scene);
|
public virtual void RegionLoaded(Scene scene) {}
|
||||||
}
|
|
||||||
|
|
||||||
public virtual void RegionLoaded(Scene scene)
|
|
||||||
{
|
|
||||||
if (!m_Enabled)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -294,7 +278,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
{
|
{
|
||||||
uint x = 0, y = 0;
|
uint x = 0, y = 0;
|
||||||
Utils.LongToUInts(regionHandle, out x, out y);
|
Utils.LongToUInts(regionHandle, out x, out y);
|
||||||
GridRegion reg = m_aScene.GridService.GetRegionByPosition(sp.Scene.RegionInfo.ScopeID, (int)x, (int)y);
|
GridRegion reg = m_scene.GridService.GetRegionByPosition(sp.Scene.RegionInfo.ScopeID, (int)x, (int)y);
|
||||||
|
|
||||||
if (reg != null)
|
if (reg != null)
|
||||||
{
|
{
|
||||||
|
@ -441,7 +425,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
|
|
||||||
string reason;
|
string reason;
|
||||||
string version;
|
string version;
|
||||||
if (!m_aScene.SimulationService.QueryAccess(
|
if (!m_scene.SimulationService.QueryAccess(
|
||||||
finalDestination, sp.ControllingClient.AgentId, Vector3.Zero, out version, out reason))
|
finalDestination, sp.ControllingClient.AgentId, Vector3.Zero, out version, out reason))
|
||||||
{
|
{
|
||||||
sp.ControllingClient.SendTeleportFailed(reason);
|
sp.ControllingClient.SendTeleportFailed(reason);
|
||||||
|
@ -660,7 +644,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
EnableChildAgents(sp);
|
EnableChildAgents(sp);
|
||||||
|
|
||||||
// Finally, kill the agent we just created at the destination.
|
// Finally, kill the agent we just created at the destination.
|
||||||
m_aScene.SimulationService.CloseAgent(finalDestination, sp.UUID);
|
m_scene.SimulationService.CloseAgent(finalDestination, sp.UUID);
|
||||||
|
|
||||||
sp.Scene.EventManager.TriggerTeleportFail(sp.ControllingClient, logout);
|
sp.Scene.EventManager.TriggerTeleportFail(sp.ControllingClient, logout);
|
||||||
}
|
}
|
||||||
|
@ -668,7 +652,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
protected virtual bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason, out bool logout)
|
protected virtual bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason, out bool logout)
|
||||||
{
|
{
|
||||||
logout = false;
|
logout = false;
|
||||||
bool success = m_aScene.SimulationService.CreateAgent(finalDestination, agentCircuit, teleportFlags, out reason);
|
bool success = m_scene.SimulationService.CreateAgent(finalDestination, agentCircuit, teleportFlags, out reason);
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
sp.Scene.EventManager.TriggerTeleportStart(sp.ControllingClient, reg, finalDestination, teleportFlags, logout);
|
sp.Scene.EventManager.TriggerTeleportStart(sp.ControllingClient, reg, finalDestination, teleportFlags, logout);
|
||||||
|
@ -678,7 +662,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
|
|
||||||
protected virtual bool UpdateAgent(GridRegion reg, GridRegion finalDestination, AgentData agent)
|
protected virtual bool UpdateAgent(GridRegion reg, GridRegion finalDestination, AgentData agent)
|
||||||
{
|
{
|
||||||
return m_aScene.SimulationService.UpdateAgent(finalDestination, agent);
|
return m_scene.SimulationService.UpdateAgent(finalDestination, agent);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void SetCallbackURL(AgentData agent, RegionInfo region)
|
protected virtual void SetCallbackURL(AgentData agent, RegionInfo region)
|
||||||
|
@ -730,7 +714,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Landmark Teleport
|
#region Landmark Teleport
|
||||||
|
@ -742,7 +725,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
/// <param name="position"></param>
|
/// <param name="position"></param>
|
||||||
public virtual void RequestTeleportLandmark(IClientAPI remoteClient, AssetLandmark lm)
|
public virtual void RequestTeleportLandmark(IClientAPI remoteClient, AssetLandmark lm)
|
||||||
{
|
{
|
||||||
GridRegion info = m_aScene.GridService.GetRegionByUUID(UUID.Zero, lm.RegionID);
|
GridRegion info = m_scene.GridService.GetRegionByUUID(UUID.Zero, lm.RegionID);
|
||||||
|
|
||||||
if (info == null)
|
if (info == null)
|
||||||
{
|
{
|
||||||
|
@ -763,12 +746,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
m_log.DebugFormat(
|
m_log.DebugFormat(
|
||||||
"[ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.Name, client.AgentId);
|
"[ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.Name, client.AgentId);
|
||||||
|
|
||||||
//OpenSim.Services.Interfaces.PresenceInfo pinfo = m_aScene.PresenceService.GetAgent(client.SessionId);
|
//OpenSim.Services.Interfaces.PresenceInfo pinfo = m_scene.PresenceService.GetAgent(client.SessionId);
|
||||||
GridUserInfo uinfo = m_aScene.GridUserService.GetGridUserInfo(client.AgentId.ToString());
|
GridUserInfo uinfo = m_scene.GridUserService.GetGridUserInfo(client.AgentId.ToString());
|
||||||
|
|
||||||
if (uinfo != null)
|
if (uinfo != null)
|
||||||
{
|
{
|
||||||
GridRegion regionInfo = m_aScene.GridService.GetRegionByUUID(UUID.Zero, uinfo.HomeRegionID);
|
GridRegion regionInfo = m_scene.GridService.GetRegionByUUID(UUID.Zero, uinfo.HomeRegionID);
|
||||||
if (regionInfo == null)
|
if (regionInfo == null)
|
||||||
{
|
{
|
||||||
// can't find the Home region: Tell viewer and abort
|
// can't find the Home region: Tell viewer and abort
|
||||||
|
@ -1625,7 +1608,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
#region Agent Arrived
|
#region Agent Arrived
|
||||||
public void AgentArrivedAtDestination(UUID id)
|
public void AgentArrivedAtDestination(UUID id)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Agent {0} released", id);
|
|
||||||
ResetFromTransit(id);
|
ResetFromTransit(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1896,8 +1878,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
//// And the new channel...
|
//// And the new channel...
|
||||||
//if (m_interregionCommsOut != null)
|
//if (m_interregionCommsOut != null)
|
||||||
// successYN = m_interregionCommsOut.SendCreateObject(newRegionHandle, grp, true);
|
// successYN = m_interregionCommsOut.SendCreateObject(newRegionHandle, grp, true);
|
||||||
if (m_aScene.SimulationService != null)
|
if (m_scene.SimulationService != null)
|
||||||
successYN = m_aScene.SimulationService.CreateObject(destination, newPosition, grp, true);
|
successYN = m_scene.SimulationService.CreateObject(destination, newPosition, grp, true);
|
||||||
|
|
||||||
if (successYN)
|
if (successYN)
|
||||||
{
|
{
|
||||||
|
@ -2004,7 +1986,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>true if the agent is in the process of being teleported, false otherwise.</returns>
|
/// <returns>true if the agent is in the process of being teleported, false otherwise.</returns>
|
||||||
/// <param name='id'>The agent ID</para></param>
|
/// <param name='id'>The agent ID</para></param>
|
||||||
protected bool IsInTransit(UUID id)
|
public bool IsInTransit(UUID id)
|
||||||
{
|
{
|
||||||
lock (m_agentsInTransit)
|
lock (m_agentsInTransit)
|
||||||
return m_agentsInTransit.Contains(id);
|
return m_agentsInTransit.Contains(id);
|
||||||
|
@ -2024,10 +2006,19 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
if (m_agentsInTransit.Contains(id))
|
if (m_agentsInTransit.Contains(id))
|
||||||
{
|
{
|
||||||
m_agentsInTransit.Remove(id);
|
m_agentsInTransit.Remove(id);
|
||||||
|
|
||||||
|
m_log.DebugFormat(
|
||||||
|
"[ENTITY TRANSFER MODULE]: Agent {0} cleared from transit in {1}",
|
||||||
|
id, m_scene.RegionInfo.RegionName);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_log.WarnFormat(
|
||||||
|
"[ENTITY TRANSFER MODULE]: Agent {0} requested to clear from transit in {1} but was already cleared.",
|
||||||
|
id, m_scene.RegionInfo.RegionName);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,11 +45,11 @@ using Nini.Config;
|
||||||
|
|
||||||
namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
{
|
{
|
||||||
public class HGEntityTransferModule : EntityTransferModule, ISharedRegionModule, IEntityTransferModule, IUserAgentVerificationModule
|
public class HGEntityTransferModule
|
||||||
|
: EntityTransferModule, INonSharedRegionModule, IEntityTransferModule, IUserAgentVerificationModule
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private bool m_Initialized = false;
|
|
||||||
private int m_levelHGTeleport = 0;
|
private int m_levelHGTeleport = 0;
|
||||||
|
|
||||||
private GatekeeperServiceConnector m_GatekeeperConnector;
|
private GatekeeperServiceConnector m_GatekeeperConnector;
|
||||||
|
@ -64,6 +64,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
public override void Initialise(IConfigSource source)
|
public override void Initialise(IConfigSource source)
|
||||||
{
|
{
|
||||||
IConfig moduleConfig = source.Configs["Modules"];
|
IConfig moduleConfig = source.Configs["Modules"];
|
||||||
|
|
||||||
if (moduleConfig != null)
|
if (moduleConfig != null)
|
||||||
{
|
{
|
||||||
string name = moduleConfig.GetString("EntityTransferModule", "");
|
string name = moduleConfig.GetString("EntityTransferModule", "");
|
||||||
|
@ -82,10 +83,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
public override void AddRegion(Scene scene)
|
public override void AddRegion(Scene scene)
|
||||||
{
|
{
|
||||||
base.AddRegion(scene);
|
base.AddRegion(scene);
|
||||||
|
|
||||||
if (m_Enabled)
|
if (m_Enabled)
|
||||||
{
|
|
||||||
scene.RegisterModuleInterface<IUserAgentVerificationModule>(this);
|
scene.RegisterModuleInterface<IUserAgentVerificationModule>(this);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnNewClient(IClientAPI client)
|
protected override void OnNewClient(IClientAPI client)
|
||||||
|
@ -98,24 +98,18 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
public override void RegionLoaded(Scene scene)
|
public override void RegionLoaded(Scene scene)
|
||||||
{
|
{
|
||||||
base.RegionLoaded(scene);
|
base.RegionLoaded(scene);
|
||||||
|
|
||||||
if (m_Enabled)
|
if (m_Enabled)
|
||||||
if (!m_Initialized)
|
m_GatekeeperConnector = new GatekeeperServiceConnector(scene.AssetService);
|
||||||
{
|
|
||||||
m_GatekeeperConnector = new GatekeeperServiceConnector(scene.AssetService);
|
|
||||||
m_Initialized = true;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void RemoveRegion(Scene scene)
|
public override void RemoveRegion(Scene scene)
|
||||||
{
|
{
|
||||||
base.AddRegion(scene);
|
base.AddRegion(scene);
|
||||||
if (m_Enabled)
|
|
||||||
{
|
|
||||||
scene.UnregisterModuleInterface<IUserAgentVerificationModule>(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (m_Enabled)
|
||||||
|
scene.UnregisterModuleInterface<IUserAgentVerificationModule>(this);
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -123,8 +117,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
|
|
||||||
protected override GridRegion GetFinalDestination(GridRegion region)
|
protected override GridRegion GetFinalDestination(GridRegion region)
|
||||||
{
|
{
|
||||||
int flags = m_aScene.GridService.GetRegionFlags(m_aScene.RegionInfo.ScopeID, region.RegionID);
|
int flags = m_scene.GridService.GetRegionFlags(m_scene.RegionInfo.ScopeID, region.RegionID);
|
||||||
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: region {0} flags: {1}", region.RegionID, flags);
|
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: region {0} flags: {1}", region.RegionID, flags);
|
||||||
|
|
||||||
if ((flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0)
|
if ((flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Destination region {0} is hyperlink", region.RegionID);
|
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Destination region {0} is hyperlink", region.RegionID);
|
||||||
|
@ -135,6 +130,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
m_log.WarnFormat("[HG ENTITY TRANSFER MODULE]: GetHyperlinkRegion to Gatekeeper {0} failed", region.ServerURI);
|
m_log.WarnFormat("[HG ENTITY TRANSFER MODULE]: GetHyperlinkRegion to Gatekeeper {0} failed", region.ServerURI);
|
||||||
return real_destination;
|
return real_destination;
|
||||||
}
|
}
|
||||||
|
|
||||||
return region;
|
return region;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,7 +139,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
if (base.NeedsClosing(drawdist, oldRegionX, newRegionX, oldRegionY, newRegionY, reg))
|
if (base.NeedsClosing(drawdist, oldRegionX, newRegionX, oldRegionY, newRegionY, reg))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
int flags = m_aScene.GridService.GetRegionFlags(m_aScene.RegionInfo.ScopeID, reg.RegionID);
|
int flags = m_scene.GridService.GetRegionFlags(m_scene.RegionInfo.ScopeID, reg.RegionID);
|
||||||
if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0)
|
if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -156,7 +152,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
if (logout)
|
if (logout)
|
||||||
{
|
{
|
||||||
// Log them out of this grid
|
// Log them out of this grid
|
||||||
m_aScene.PresenceService.LogoutAgent(sp.ControllingClient.SessionId);
|
m_scene.PresenceService.LogoutAgent(sp.ControllingClient.SessionId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,7 +161,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: CreateAgent {0} {1}", reg.ServerURI, finalDestination.ServerURI);
|
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: CreateAgent {0} {1}", reg.ServerURI, finalDestination.ServerURI);
|
||||||
reason = string.Empty;
|
reason = string.Empty;
|
||||||
logout = false;
|
logout = false;
|
||||||
int flags = m_aScene.GridService.GetRegionFlags(m_aScene.RegionInfo.ScopeID, reg.RegionID);
|
int flags = m_scene.GridService.GetRegionFlags(m_scene.RegionInfo.ScopeID, reg.RegionID);
|
||||||
if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0)
|
if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0)
|
||||||
{
|
{
|
||||||
// this user is going to another grid
|
// this user is going to another grid
|
||||||
|
@ -205,7 +201,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
"[ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.Name, client.AgentId);
|
"[ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.Name, client.AgentId);
|
||||||
|
|
||||||
// Let's find out if this is a foreign user or a local user
|
// Let's find out if this is a foreign user or a local user
|
||||||
IUserManagement uMan = m_aScene.RequestModuleInterface<IUserManagement>();
|
IUserManagement uMan = m_scene.RequestModuleInterface<IUserManagement>();
|
||||||
if (uMan != null && uMan.IsLocalGridUser(id))
|
if (uMan != null && uMan.IsLocalGridUser(id))
|
||||||
{
|
{
|
||||||
// local grid user
|
// local grid user
|
||||||
|
@ -262,19 +258,21 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Teleporting agent via landmark to {0} region {1} position {2}",
|
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Teleporting agent via landmark to {0} region {1} position {2}",
|
||||||
(lm.Gatekeeper == string.Empty) ? "local" : lm.Gatekeeper, lm.RegionID, lm.Position);
|
(lm.Gatekeeper == string.Empty) ? "local" : lm.Gatekeeper, lm.RegionID, lm.Position);
|
||||||
|
|
||||||
if (lm.Gatekeeper == string.Empty)
|
if (lm.Gatekeeper == string.Empty)
|
||||||
{
|
{
|
||||||
base.RequestTeleportLandmark(remoteClient, lm);
|
base.RequestTeleportLandmark(remoteClient, lm);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GridRegion info = m_aScene.GridService.GetRegionByUUID(UUID.Zero, lm.RegionID);
|
GridRegion info = m_scene.GridService.GetRegionByUUID(UUID.Zero, lm.RegionID);
|
||||||
|
|
||||||
// Local region?
|
// Local region?
|
||||||
if (info != null)
|
if (info != null)
|
||||||
{
|
{
|
||||||
((Scene)(remoteClient.Scene)).RequestTeleportLocation(remoteClient, info.RegionHandle, lm.Position,
|
((Scene)(remoteClient.Scene)).RequestTeleportLocation(remoteClient, info.RegionHandle, lm.Position,
|
||||||
Vector3.Zero, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaLandmark));
|
Vector3.Zero, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaLandmark));
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -285,6 +283,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
GridRegion gatekeeper = new GridRegion();
|
GridRegion gatekeeper = new GridRegion();
|
||||||
gatekeeper.ServerURI = lm.Gatekeeper;
|
gatekeeper.ServerURI = lm.Gatekeeper;
|
||||||
GridRegion finalDestination = gConn.GetHyperlinkRegion(gatekeeper, new UUID(lm.RegionID));
|
GridRegion finalDestination = gConn.GetHyperlinkRegion(gatekeeper, new UUID(lm.RegionID));
|
||||||
|
|
||||||
if (finalDestination != null)
|
if (finalDestination != null)
|
||||||
{
|
{
|
||||||
ScenePresence sp = scene.GetScenePresence(remoteClient.AgentId);
|
ScenePresence sp = scene.GetScenePresence(remoteClient.AgentId);
|
||||||
|
@ -314,8 +313,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
IUserAgentService security = new UserAgentServiceConnector(url);
|
IUserAgentService security = new UserAgentServiceConnector(url);
|
||||||
return security.VerifyClient(aCircuit.SessionID, token);
|
return security.VerifyClient(aCircuit.SessionID, token);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent {0} {1} does not have a HomeURI OH NO!", aCircuit.firstname, aCircuit.lastname);
|
{
|
||||||
|
m_log.DebugFormat(
|
||||||
|
"[HG ENTITY TRANSFER MODULE]: Agent {0} {1} does not have a HomeURI OH NO!",
|
||||||
|
aCircuit.firstname, aCircuit.lastname);
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -332,8 +335,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
}
|
}
|
||||||
|
|
||||||
// Let's find out if this is a foreign user or a local user
|
// Let's find out if this is a foreign user or a local user
|
||||||
IUserManagement uMan = m_aScene.RequestModuleInterface<IUserManagement>();
|
IUserManagement uMan = m_scene.RequestModuleInterface<IUserManagement>();
|
||||||
UserAccount account = m_aScene.UserAccountService.GetUserAccount(m_aScene.RegionInfo.ScopeID, obj.AgentId);
|
UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, obj.AgentId);
|
||||||
if (uMan != null && uMan.IsLocalGridUser(obj.AgentId))
|
if (uMan != null && uMan.IsLocalGridUser(obj.AgentId))
|
||||||
{
|
{
|
||||||
// local grid user
|
// local grid user
|
||||||
|
@ -356,7 +359,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
private GridRegion MakeRegion(AgentCircuitData aCircuit)
|
private GridRegion MakeRegion(AgentCircuitData aCircuit)
|
||||||
{
|
{
|
||||||
GridRegion region = new GridRegion();
|
GridRegion region = new GridRegion();
|
||||||
|
@ -373,6 +375,5 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
region.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), (int)0);
|
region.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), (int)0);
|
||||||
return region;
|
return region;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -26,6 +26,7 @@
|
||||||
*/
|
*/
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using log4net;
|
using log4net;
|
||||||
using Nini.Config;
|
using Nini.Config;
|
||||||
|
@ -41,22 +42,20 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
|
||||||
public class LocalSimulationConnectorModule : ISharedRegionModule, ISimulationService
|
public class LocalSimulationConnectorModule : ISharedRegionModule, ISimulationService
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
// Version of this service
|
|
||||||
|
/// <summary>
|
||||||
|
/// Version of this service
|
||||||
|
/// </summary>
|
||||||
private const string m_Version = "SIMULATION/0.1";
|
private const string m_Version = "SIMULATION/0.1";
|
||||||
|
|
||||||
private List<Scene> m_sceneList = new List<Scene>();
|
/// <summary>
|
||||||
|
/// Map region ID to scene.
|
||||||
private IEntityTransferModule m_AgentTransferModule;
|
/// </summary>
|
||||||
protected IEntityTransferModule AgentTransferModule
|
private Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>();
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (m_AgentTransferModule == null)
|
|
||||||
m_AgentTransferModule = m_sceneList[0].RequestModuleInterface<IEntityTransferModule>();
|
|
||||||
return m_AgentTransferModule;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Is this module enabled?
|
||||||
|
/// </summary>
|
||||||
private bool m_ModuleEnabled = false;
|
private bool m_ModuleEnabled = false;
|
||||||
|
|
||||||
#region IRegionModule
|
#region IRegionModule
|
||||||
|
@ -129,12 +128,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
|
||||||
/// <param name="scene"></param>
|
/// <param name="scene"></param>
|
||||||
public void RemoveScene(Scene scene)
|
public void RemoveScene(Scene scene)
|
||||||
{
|
{
|
||||||
lock (m_sceneList)
|
lock (m_scenes)
|
||||||
{
|
{
|
||||||
if (m_sceneList.Contains(scene))
|
if (m_scenes.ContainsKey(scene.RegionInfo.RegionID))
|
||||||
{
|
m_scenes.Remove(scene.RegionInfo.RegionID);
|
||||||
m_sceneList.Remove(scene);
|
else
|
||||||
}
|
m_log.WarnFormat(
|
||||||
|
"[LOCAL SIMULATION CONNECTOR]: Tried to remove region {0} but it was not present",
|
||||||
|
scene.RegionInfo.RegionName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,13 +145,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
|
||||||
/// <param name="scene"></param>
|
/// <param name="scene"></param>
|
||||||
public void Init(Scene scene)
|
public void Init(Scene scene)
|
||||||
{
|
{
|
||||||
if (!m_sceneList.Contains(scene))
|
lock (m_scenes)
|
||||||
{
|
{
|
||||||
lock (m_sceneList)
|
if (!m_scenes.ContainsKey(scene.RegionInfo.RegionID))
|
||||||
{
|
m_scenes[scene.RegionInfo.RegionID] = scene;
|
||||||
m_sceneList.Add(scene);
|
else
|
||||||
}
|
m_log.WarnFormat(
|
||||||
|
"[LOCAL SIMULATION CONNECTOR]: Tried to add region {0} but it is already present",
|
||||||
|
scene.RegionInfo.RegionName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,13 +162,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
|
||||||
|
|
||||||
public IScene GetScene(ulong regionhandle)
|
public IScene GetScene(ulong regionhandle)
|
||||||
{
|
{
|
||||||
foreach (Scene s in m_sceneList)
|
foreach (Scene s in m_scenes.Values)
|
||||||
{
|
{
|
||||||
if (s.RegionInfo.RegionHandle == regionhandle)
|
if (s.RegionInfo.RegionHandle == regionhandle)
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ? weird. should not happen
|
// ? weird. should not happen
|
||||||
return m_sceneList[0];
|
return m_scenes.Values.ToArray()[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
public ISimulationService GetInnerService()
|
public ISimulationService GetInnerService()
|
||||||
|
@ -187,13 +190,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (Scene s in m_sceneList)
|
if (m_scenes.ContainsKey(destination.RegionID))
|
||||||
{
|
{
|
||||||
if (s.RegionInfo.RegionHandle == destination.RegionHandle)
|
|
||||||
{
|
|
||||||
// m_log.DebugFormat("[LOCAL SIMULATION CONNECTOR]: Found region {0} to send SendCreateChildAgent", destination.RegionName);
|
// m_log.DebugFormat("[LOCAL SIMULATION CONNECTOR]: Found region {0} to send SendCreateChildAgent", destination.RegionName);
|
||||||
return s.NewUserConnection(aCircuit, teleportFlags, out reason);
|
return m_scenes[destination.RegionID].NewUserConnection(aCircuit, teleportFlags, out reason);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
reason = "Did not find region " + destination.RegionName;
|
reason = "Did not find region " + destination.RegionName;
|
||||||
|
@ -205,17 +205,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
|
||||||
if (destination == null)
|
if (destination == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
foreach (Scene s in m_sceneList)
|
if (m_scenes.ContainsKey(destination.RegionID))
|
||||||
{
|
{
|
||||||
if (s.RegionInfo.RegionHandle == destination.RegionHandle)
|
|
||||||
{
|
|
||||||
// m_log.DebugFormat(
|
// m_log.DebugFormat(
|
||||||
// "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate",
|
// "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate",
|
||||||
// s.RegionInfo.RegionName, destination.RegionHandle);
|
// s.RegionInfo.RegionName, destination.RegionHandle);
|
||||||
|
|
||||||
s.IncomingChildAgentDataUpdate(cAgentData);
|
return m_scenes[destination.RegionID].IncomingChildAgentDataUpdate(cAgentData);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// m_log.DebugFormat("[LOCAL COMMS]: Did not find region {0} for ChildAgentUpdate", regionHandle);
|
// m_log.DebugFormat("[LOCAL COMMS]: Did not find region {0} for ChildAgentUpdate", regionHandle);
|
||||||
|
@ -231,11 +227,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
|
||||||
// simulator so when we receive the update we need to hand it to each of the
|
// simulator so when we receive the update we need to hand it to each of the
|
||||||
// scenes; scenes each check to see if the is a scene presence for the avatar
|
// scenes; scenes each check to see if the is a scene presence for the avatar
|
||||||
// note that we really don't need the GridRegion for this call
|
// note that we really don't need the GridRegion for this call
|
||||||
foreach (Scene s in m_sceneList)
|
foreach (Scene s in m_scenes.Values)
|
||||||
{
|
{
|
||||||
//m_log.Debug("[LOCAL COMMS]: Found region to send ChildAgentUpdate");
|
//m_log.Debug("[LOCAL COMMS]: Found region to send ChildAgentUpdate");
|
||||||
s.IncomingChildAgentDataUpdate(cAgentData);
|
s.IncomingChildAgentDataUpdate(cAgentData);
|
||||||
}
|
}
|
||||||
|
|
||||||
//m_log.Debug("[LOCAL COMMS]: region not found for ChildAgentUpdate");
|
//m_log.Debug("[LOCAL COMMS]: region not found for ChildAgentUpdate");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -247,14 +244,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
|
||||||
if (destination == null)
|
if (destination == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
foreach (Scene s in m_sceneList)
|
if (m_scenes.ContainsKey(destination.RegionID))
|
||||||
{
|
{
|
||||||
if (s.RegionInfo.RegionHandle == destination.RegionHandle)
|
// m_log.DebugFormat(
|
||||||
{
|
// "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate",
|
||||||
//m_log.Debug("[LOCAL COMMS]: Found region to send ChildAgentUpdate");
|
// s.RegionInfo.RegionName, destination.RegionHandle);
|
||||||
return s.IncomingRetrieveRootAgent(id, out agent);
|
|
||||||
}
|
return m_scenes[destination.RegionID].IncomingRetrieveRootAgent(id, out agent);
|
||||||
}
|
}
|
||||||
|
|
||||||
//m_log.Debug("[LOCAL COMMS]: region not found for ChildAgentUpdate");
|
//m_log.Debug("[LOCAL COMMS]: region not found for ChildAgentUpdate");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -266,27 +264,31 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
|
||||||
if (destination == null)
|
if (destination == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
foreach (Scene s in m_sceneList)
|
if (m_scenes.ContainsKey(destination.RegionID))
|
||||||
{
|
{
|
||||||
if (s.RegionInfo.RegionID == destination.RegionID)
|
// m_log.DebugFormat(
|
||||||
return s.QueryAccess(id, position, out reason);
|
// "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate",
|
||||||
|
// s.RegionInfo.RegionName, destination.RegionHandle);
|
||||||
|
|
||||||
|
return m_scenes[destination.RegionID].QueryAccess(id, position, out reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
//m_log.Debug("[LOCAL COMMS]: region not found for QueryAccess");
|
//m_log.Debug("[LOCAL COMMS]: region not found for QueryAccess");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool ReleaseAgent(UUID origin, UUID id, string uri)
|
public bool ReleaseAgent(UUID originId, UUID agentId, string uri)
|
||||||
{
|
{
|
||||||
foreach (Scene s in m_sceneList)
|
if (m_scenes.ContainsKey(originId))
|
||||||
{
|
{
|
||||||
if (s.RegionInfo.RegionID == origin)
|
// m_log.DebugFormat(
|
||||||
{
|
// "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate",
|
||||||
// m_log.Debug("[LOCAL COMMS]: Found region to SendReleaseAgent");
|
// s.RegionInfo.RegionName, destination.RegionHandle);
|
||||||
AgentTransferModule.AgentArrivedAtDestination(id);
|
|
||||||
return true;
|
m_scenes[originId].EntityTransferModule.AgentArrivedAtDestination(agentId);
|
||||||
// return s.IncomingReleaseAgent(id);
|
return true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//m_log.Debug("[LOCAL COMMS]: region not found in SendReleaseAgent " + origin);
|
//m_log.Debug("[LOCAL COMMS]: region not found in SendReleaseAgent " + origin);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -296,17 +298,16 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
|
||||||
if (destination == null)
|
if (destination == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
foreach (Scene s in m_sceneList)
|
if (m_scenes.ContainsKey(destination.RegionID))
|
||||||
{
|
{
|
||||||
if (s.RegionInfo.RegionID == destination.RegionID)
|
// m_log.DebugFormat(
|
||||||
{
|
// "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate",
|
||||||
//m_log.Debug("[LOCAL COMMS]: Found region to SendCloseAgent");
|
// s.RegionInfo.RegionName, destination.RegionHandle);
|
||||||
// Let's spawn a threadlet right here, because this may take
|
|
||||||
// a while
|
Util.FireAndForget(delegate { m_scenes[destination.RegionID].IncomingCloseAgent(id); });
|
||||||
Util.FireAndForget(delegate { s.IncomingCloseAgent(id); });
|
return true;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//m_log.Debug("[LOCAL COMMS]: region not found in SendCloseAgent");
|
//m_log.Debug("[LOCAL COMMS]: region not found in SendCloseAgent");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -320,25 +321,28 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
|
||||||
if (destination == null)
|
if (destination == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
foreach (Scene s in m_sceneList)
|
if (m_scenes.ContainsKey(destination.RegionID))
|
||||||
{
|
{
|
||||||
if (s.RegionInfo.RegionHandle == destination.RegionHandle)
|
// m_log.DebugFormat(
|
||||||
|
// "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate",
|
||||||
|
// s.RegionInfo.RegionName, destination.RegionHandle);
|
||||||
|
|
||||||
|
Scene s = m_scenes[destination.RegionID];
|
||||||
|
|
||||||
|
if (isLocalCall)
|
||||||
{
|
{
|
||||||
//m_log.Debug("[LOCAL COMMS]: Found region to SendCreateObject");
|
// We need to make a local copy of the object
|
||||||
if (isLocalCall)
|
ISceneObject sogClone = sog.CloneForNewScene();
|
||||||
{
|
sogClone.SetState(sog.GetStateSnapshot(), s);
|
||||||
// We need to make a local copy of the object
|
return s.IncomingCreateObject(newPosition, sogClone);
|
||||||
ISceneObject sogClone = sog.CloneForNewScene();
|
}
|
||||||
sogClone.SetState(sog.GetStateSnapshot(), s);
|
else
|
||||||
return s.IncomingCreateObject(newPosition, sogClone);
|
{
|
||||||
}
|
// Use the object as it came through the wire
|
||||||
else
|
return s.IncomingCreateObject(newPosition, sog);
|
||||||
{
|
|
||||||
// Use the object as it came through the wire
|
|
||||||
return s.IncomingCreateObject(newPosition, sog);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -347,13 +351,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
|
||||||
if (destination == null)
|
if (destination == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
foreach (Scene s in m_sceneList)
|
if (m_scenes.ContainsKey(destination.RegionID))
|
||||||
{
|
{
|
||||||
if (s.RegionInfo.RegionHandle == destination.RegionHandle)
|
// m_log.DebugFormat(
|
||||||
{
|
// "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate",
|
||||||
return s.IncomingCreateObject(userID, itemID);
|
// s.RegionInfo.RegionName, destination.RegionHandle);
|
||||||
}
|
|
||||||
|
return m_scenes[destination.RegionID].IncomingCreateObject(userID, itemID);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -364,20 +370,18 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
|
||||||
|
|
||||||
public bool IsLocalRegion(ulong regionhandle)
|
public bool IsLocalRegion(ulong regionhandle)
|
||||||
{
|
{
|
||||||
foreach (Scene s in m_sceneList)
|
foreach (Scene s in m_scenes.Values)
|
||||||
if (s.RegionInfo.RegionHandle == regionhandle)
|
if (s.RegionInfo.RegionHandle == regionhandle)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsLocalRegion(UUID id)
|
public bool IsLocalRegion(UUID id)
|
||||||
{
|
{
|
||||||
foreach (Scene s in m_sceneList)
|
return m_scenes.ContainsKey(id);
|
||||||
if (s.RegionInfo.RegionID == id)
|
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -74,6 +74,13 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
/// <param name='client'></param>
|
/// <param name='client'></param>
|
||||||
void TeleportHome(UUID id, IClientAPI client);
|
void TeleportHome(UUID id, IClientAPI client);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Show whether the given agent is being teleported.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>true if the agent is in the process of being teleported, false otherwise.</returns>
|
||||||
|
/// <param name='id'>The agent ID</para></param>
|
||||||
|
bool IsInTransit(UUID id);
|
||||||
|
|
||||||
bool Cross(ScenePresence agent, bool isFlying);
|
bool Cross(ScenePresence agent, bool isFlying);
|
||||||
|
|
||||||
void AgentArrivedAtDestination(UUID agent);
|
void AgentArrivedAtDestination(UUID agent);
|
||||||
|
|
|
@ -166,7 +166,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
protected IConfigSource m_config;
|
protected IConfigSource m_config;
|
||||||
protected IRegionSerialiserModule m_serialiser;
|
protected IRegionSerialiserModule m_serialiser;
|
||||||
protected IDialogModule m_dialogModule;
|
protected IDialogModule m_dialogModule;
|
||||||
protected IEntityTransferModule m_teleportModule;
|
|
||||||
protected ICapabilitiesModule m_capsModule;
|
protected ICapabilitiesModule m_capsModule;
|
||||||
protected IGroupsModule m_groupsModule;
|
protected IGroupsModule m_groupsModule;
|
||||||
|
|
||||||
|
@ -498,6 +497,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
|
|
||||||
public IAttachmentsModule AttachmentsModule { get; set; }
|
public IAttachmentsModule AttachmentsModule { get; set; }
|
||||||
|
public IEntityTransferModule EntityTransferModule { get; private set; }
|
||||||
|
|
||||||
public IAvatarFactoryModule AvatarFactory
|
public IAvatarFactoryModule AvatarFactory
|
||||||
{
|
{
|
||||||
|
@ -924,8 +924,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
List<ulong> old = new List<ulong>();
|
List<ulong> old = new List<ulong>();
|
||||||
old.Add(otherRegion.RegionHandle);
|
old.Add(otherRegion.RegionHandle);
|
||||||
agent.DropOldNeighbours(old);
|
agent.DropOldNeighbours(old);
|
||||||
if (m_teleportModule != null && agent.PresenceType != PresenceType.Npc)
|
if (EntityTransferModule != null && agent.PresenceType != PresenceType.Npc)
|
||||||
m_teleportModule.EnableChildAgent(agent, otherRegion);
|
EntityTransferModule.EnableChildAgent(agent, otherRegion);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
catch (NullReferenceException)
|
catch (NullReferenceException)
|
||||||
|
@ -1062,8 +1062,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
ForEachRootScenePresence(delegate(ScenePresence agent)
|
ForEachRootScenePresence(delegate(ScenePresence agent)
|
||||||
{
|
{
|
||||||
if (m_teleportModule != null && agent.PresenceType != PresenceType.Npc)
|
if (EntityTransferModule != null && agent.PresenceType != PresenceType.Npc)
|
||||||
m_teleportModule.EnableChildAgent(agent, r);
|
EntityTransferModule.EnableChildAgent(agent, r);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
catch (NullReferenceException)
|
catch (NullReferenceException)
|
||||||
|
@ -1238,7 +1238,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
m_serialiser = RequestModuleInterface<IRegionSerialiserModule>();
|
m_serialiser = RequestModuleInterface<IRegionSerialiserModule>();
|
||||||
m_dialogModule = RequestModuleInterface<IDialogModule>();
|
m_dialogModule = RequestModuleInterface<IDialogModule>();
|
||||||
m_capsModule = RequestModuleInterface<ICapabilitiesModule>();
|
m_capsModule = RequestModuleInterface<ICapabilitiesModule>();
|
||||||
m_teleportModule = RequestModuleInterface<IEntityTransferModule>();
|
EntityTransferModule = RequestModuleInterface<IEntityTransferModule>();
|
||||||
m_groupsModule = RequestModuleInterface<IGroupsModule>();
|
m_groupsModule = RequestModuleInterface<IGroupsModule>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2275,8 +2275,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_teleportModule != null)
|
if (EntityTransferModule != null)
|
||||||
m_teleportModule.Cross(grp, attemptedPosition, silent);
|
EntityTransferModule.Cross(grp, attemptedPosition, silent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Border GetCrossedBorder(Vector3 position, Cardinals gridline)
|
public Border GetCrossedBorder(Vector3 position, Cardinals gridline)
|
||||||
|
@ -3078,8 +3078,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <param name="client">The IClientAPI for the client</param>
|
/// <param name="client">The IClientAPI for the client</param>
|
||||||
public virtual void TeleportClientHome(UUID agentId, IClientAPI client)
|
public virtual void TeleportClientHome(UUID agentId, IClientAPI client)
|
||||||
{
|
{
|
||||||
if (m_teleportModule != null)
|
if (EntityTransferModule != null)
|
||||||
m_teleportModule.TeleportHome(agentId, client);
|
{
|
||||||
|
EntityTransferModule.TeleportHome(agentId, client);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[SCENE]: Unable to teleport user home: no AgentTransferModule is active");
|
m_log.DebugFormat("[SCENE]: Unable to teleport user home: no AgentTransferModule is active");
|
||||||
|
@ -3638,7 +3640,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
private bool TestLandRestrictions(AgentCircuitData agent, ILandObject land, out string reason)
|
private bool TestLandRestrictions(AgentCircuitData agent, ILandObject land, out string reason)
|
||||||
{
|
{
|
||||||
|
|
||||||
bool banned = land.IsBannedFromLand(agent.AgentID);
|
bool banned = land.IsBannedFromLand(agent.AgentID);
|
||||||
bool restricted = land.IsRestrictedFromLand(agent.AgentID);
|
bool restricted = land.IsRestrictedFromLand(agent.AgentID);
|
||||||
|
|
||||||
|
@ -4131,8 +4132,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
position.Y -= shifty;
|
position.Y -= shifty;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_teleportModule != null)
|
if (EntityTransferModule != null)
|
||||||
m_teleportModule.Teleport(sp, regionHandle, position, lookAt, teleportFlags);
|
{
|
||||||
|
EntityTransferModule.Teleport(sp, regionHandle, position, lookAt, teleportFlags);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[SCENE]: Unable to perform teleports: no AgentTransferModule is active");
|
m_log.DebugFormat("[SCENE]: Unable to perform teleports: no AgentTransferModule is active");
|
||||||
|
@ -4143,8 +4146,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
public bool CrossAgentToNewRegion(ScenePresence agent, bool isFlying)
|
public bool CrossAgentToNewRegion(ScenePresence agent, bool isFlying)
|
||||||
{
|
{
|
||||||
if (m_teleportModule != null)
|
if (EntityTransferModule != null)
|
||||||
return m_teleportModule.Cross(agent, isFlying);
|
{
|
||||||
|
return EntityTransferModule.Cross(agent, isFlying);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[SCENE]: Unable to cross agent to neighbouring region, because there is no AgentTransferModule");
|
m_log.DebugFormat("[SCENE]: Unable to cross agent to neighbouring region, because there is no AgentTransferModule");
|
||||||
|
@ -5188,14 +5193,34 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
throw new Exception(error);
|
throw new Exception(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This method is called across the simulation connector to
|
/// <summary>
|
||||||
// determine if a given agent is allowed in this region
|
/// This method is called across the simulation connector to
|
||||||
// AS A ROOT AGENT. Returning false here will prevent them
|
/// determine if a given agent is allowed in this region
|
||||||
// from logging into the region, teleporting into the region
|
/// AS A ROOT AGENT
|
||||||
// or corssing the broder walking, but will NOT prevent
|
/// </summary>
|
||||||
// child agent creation, thereby emulating the SL behavior.
|
/// <remarks>
|
||||||
|
/// Returning false here will prevent them
|
||||||
|
/// from logging into the region, teleporting into the region
|
||||||
|
/// or corssing the broder walking, but will NOT prevent
|
||||||
|
/// child agent creation, thereby emulating the SL behavior.
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name='agentID'></param>
|
||||||
|
/// <param name='position'></param>
|
||||||
|
/// <param name='reason'></param>
|
||||||
|
/// <returns></returns>
|
||||||
public bool QueryAccess(UUID agentID, Vector3 position, out string reason)
|
public bool QueryAccess(UUID agentID, Vector3 position, out string reason)
|
||||||
{
|
{
|
||||||
|
if (EntityTransferModule.IsInTransit(agentID))
|
||||||
|
{
|
||||||
|
reason = "Agent is already in transit on this region";
|
||||||
|
|
||||||
|
m_log.DebugFormat(
|
||||||
|
"[SCENE]: Denying agent {0} entry into {1} since region already has them registered as in transit",
|
||||||
|
agentID, RegionInfo.RegionName);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// FIXME: Root agent count is currently known to be inaccurate. This forces a recount before we check.
|
// FIXME: Root agent count is currently known to be inaccurate. This forces a recount before we check.
|
||||||
// However, the long term fix is to make sure root agent count is always accurate.
|
// However, the long term fix is to make sure root agent count is always accurate.
|
||||||
m_sceneGraph.RecalculateStats();
|
m_sceneGraph.RecalculateStats();
|
||||||
|
|
|
@ -110,12 +110,13 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||||
|
|
||||||
UUID userId = TestHelpers.ParseTail(0x1);
|
UUID userId = TestHelpers.ParseTail(0x1);
|
||||||
|
|
||||||
EntityTransferModule etm = new EntityTransferModule();
|
EntityTransferModule etmA = new EntityTransferModule();
|
||||||
|
EntityTransferModule etmB = new EntityTransferModule();
|
||||||
LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule();
|
LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule();
|
||||||
|
|
||||||
IConfigSource config = new IniConfigSource();
|
IConfigSource config = new IniConfigSource();
|
||||||
IConfig modulesConfig = config.AddConfig("Modules");
|
IConfig modulesConfig = config.AddConfig("Modules");
|
||||||
modulesConfig.Set("EntityTransferModule", etm.Name);
|
modulesConfig.Set("EntityTransferModule", etmA.Name);
|
||||||
modulesConfig.Set("SimulationServices", lscm.Name);
|
modulesConfig.Set("SimulationServices", lscm.Name);
|
||||||
IConfig entityTransferConfig = config.AddConfig("EntityTransfer");
|
IConfig entityTransferConfig = config.AddConfig("EntityTransfer");
|
||||||
|
|
||||||
|
@ -127,7 +128,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||||
TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000);
|
TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000);
|
||||||
TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1002, 1000);
|
TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1002, 1000);
|
||||||
|
|
||||||
SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, etm, lscm);
|
SceneHelpers.SetupSceneModules(sceneA, config, etmA);
|
||||||
|
SceneHelpers.SetupSceneModules(sceneB, config, etmB);
|
||||||
|
SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm);
|
||||||
|
|
||||||
Vector3 teleportPosition = new Vector3(10, 11, 12);
|
Vector3 teleportPosition = new Vector3(10, 11, 12);
|
||||||
Vector3 teleportLookAt = new Vector3(20, 21, 22);
|
Vector3 teleportLookAt = new Vector3(20, 21, 22);
|
||||||
|
@ -174,12 +177,14 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||||
UUID userId = TestHelpers.ParseTail(0x1);
|
UUID userId = TestHelpers.ParseTail(0x1);
|
||||||
Vector3 preTeleportPosition = new Vector3(30, 31, 32);
|
Vector3 preTeleportPosition = new Vector3(30, 31, 32);
|
||||||
|
|
||||||
EntityTransferModule etm = new EntityTransferModule();
|
EntityTransferModule etmA = new EntityTransferModule();
|
||||||
|
EntityTransferModule etmB = new EntityTransferModule();
|
||||||
|
|
||||||
LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule();
|
LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule();
|
||||||
|
|
||||||
IConfigSource config = new IniConfigSource();
|
IConfigSource config = new IniConfigSource();
|
||||||
config.AddConfig("Modules");
|
config.AddConfig("Modules");
|
||||||
config.Configs["Modules"].Set("EntityTransferModule", etm.Name);
|
config.Configs["Modules"].Set("EntityTransferModule", etmA.Name);
|
||||||
config.Configs["Modules"].Set("SimulationServices", lscm.Name);
|
config.Configs["Modules"].Set("SimulationServices", lscm.Name);
|
||||||
|
|
||||||
config.AddConfig("EntityTransfer");
|
config.AddConfig("EntityTransfer");
|
||||||
|
@ -195,13 +200,15 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||||
TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000);
|
TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000);
|
||||||
TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1002, 1000);
|
TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1002, 1000);
|
||||||
|
|
||||||
|
SceneHelpers.SetupSceneModules(sceneA, config, etmA );
|
||||||
|
|
||||||
// We need to set up the permisions module on scene B so that our later use of agent limit to deny
|
// We need to set up the permisions module on scene B so that our later use of agent limit to deny
|
||||||
// QueryAccess won't succeed anyway because administrators are always allowed in and the default
|
// QueryAccess won't succeed anyway because administrators are always allowed in and the default
|
||||||
// IsAdministrator if no permissions module is present is true.
|
// IsAdministrator if no permissions module is present is true.
|
||||||
SceneHelpers.SetupSceneModules(sceneB, config, new object[] { new PermissionsModule() });
|
SceneHelpers.SetupSceneModules(sceneB, config, new object[] { new PermissionsModule(), etmB });
|
||||||
|
|
||||||
// Shared scene modules
|
// Shared scene modules
|
||||||
SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, etm, lscm);
|
SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm);
|
||||||
|
|
||||||
Vector3 teleportPosition = new Vector3(10, 11, 12);
|
Vector3 teleportPosition = new Vector3(10, 11, 12);
|
||||||
Vector3 teleportLookAt = new Vector3(20, 21, 22);
|
Vector3 teleportLookAt = new Vector3(20, 21, 22);
|
||||||
|
@ -249,12 +256,13 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||||
UUID userId = TestHelpers.ParseTail(0x1);
|
UUID userId = TestHelpers.ParseTail(0x1);
|
||||||
Vector3 preTeleportPosition = new Vector3(30, 31, 32);
|
Vector3 preTeleportPosition = new Vector3(30, 31, 32);
|
||||||
|
|
||||||
EntityTransferModule etm = new EntityTransferModule();
|
EntityTransferModule etmA = new EntityTransferModule();
|
||||||
|
EntityTransferModule etmB = new EntityTransferModule();
|
||||||
LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule();
|
LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule();
|
||||||
|
|
||||||
IConfigSource config = new IniConfigSource();
|
IConfigSource config = new IniConfigSource();
|
||||||
config.AddConfig("Modules");
|
config.AddConfig("Modules");
|
||||||
config.Configs["Modules"].Set("EntityTransferModule", etm.Name);
|
config.Configs["Modules"].Set("EntityTransferModule", etmA.Name);
|
||||||
config.Configs["Modules"].Set("SimulationServices", lscm.Name);
|
config.Configs["Modules"].Set("SimulationServices", lscm.Name);
|
||||||
|
|
||||||
config.AddConfig("EntityTransfer");
|
config.AddConfig("EntityTransfer");
|
||||||
|
@ -267,8 +275,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||||
TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000);
|
TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000);
|
||||||
TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1002, 1000);
|
TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1002, 1000);
|
||||||
|
|
||||||
|
SceneHelpers.SetupSceneModules(sceneA, config, etmA);
|
||||||
|
SceneHelpers.SetupSceneModules(sceneB, config, etmB);
|
||||||
|
|
||||||
// Shared scene modules
|
// Shared scene modules
|
||||||
SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, etm, lscm);
|
SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm);
|
||||||
|
|
||||||
Vector3 teleportPosition = new Vector3(10, 11, 12);
|
Vector3 teleportPosition = new Vector3(10, 11, 12);
|
||||||
Vector3 teleportLookAt = new Vector3(20, 21, 22);
|
Vector3 teleportLookAt = new Vector3(20, 21, 22);
|
||||||
|
@ -312,12 +323,13 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||||
|
|
||||||
UUID userId = TestHelpers.ParseTail(0x1);
|
UUID userId = TestHelpers.ParseTail(0x1);
|
||||||
|
|
||||||
EntityTransferModule etm = new EntityTransferModule();
|
EntityTransferModule etmA = new EntityTransferModule();
|
||||||
|
EntityTransferModule etmB = new EntityTransferModule();
|
||||||
LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule();
|
LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule();
|
||||||
|
|
||||||
IConfigSource config = new IniConfigSource();
|
IConfigSource config = new IniConfigSource();
|
||||||
IConfig modulesConfig = config.AddConfig("Modules");
|
IConfig modulesConfig = config.AddConfig("Modules");
|
||||||
modulesConfig.Set("EntityTransferModule", etm.Name);
|
modulesConfig.Set("EntityTransferModule", etmA.Name);
|
||||||
modulesConfig.Set("SimulationServices", lscm.Name);
|
modulesConfig.Set("SimulationServices", lscm.Name);
|
||||||
IConfig entityTransferConfig = config.AddConfig("EntityTransfer");
|
IConfig entityTransferConfig = config.AddConfig("EntityTransfer");
|
||||||
|
|
||||||
|
@ -329,9 +341,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||||
TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000);
|
TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000);
|
||||||
TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1001, 1000);
|
TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1001, 1000);
|
||||||
|
|
||||||
SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, etm, lscm);
|
SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm);
|
||||||
SceneHelpers.SetupSceneModules(sceneA, new CapabilitiesModule());
|
SceneHelpers.SetupSceneModules(sceneA, config, new CapabilitiesModule(), etmA);
|
||||||
SceneHelpers.SetupSceneModules(sceneB, new CapabilitiesModule());
|
SceneHelpers.SetupSceneModules(sceneB, config, new CapabilitiesModule(), etmB);
|
||||||
|
|
||||||
Vector3 teleportPosition = new Vector3(10, 11, 12);
|
Vector3 teleportPosition = new Vector3(10, 11, 12);
|
||||||
Vector3 teleportLookAt = new Vector3(20, 21, 22);
|
Vector3 teleportLookAt = new Vector3(20, 21, 22);
|
||||||
|
|
Loading…
Reference in New Issue