mirror of
https://github.com/opensim/opensim.git
synced 2026-08-12 20:55:43 +08:00
Integrated the hyperlinking with the GridService.
This commit is contained in:
@@ -48,16 +48,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private IHypergridService m_HypergridService;
|
||||
private IHypergridService HyperGridService
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_HypergridService == null)
|
||||
m_HypergridService = m_aScene.RequestModuleInterface<IHypergridService>();
|
||||
return m_HypergridService;
|
||||
}
|
||||
}
|
||||
private bool m_Initialized = false;
|
||||
|
||||
private GatekeeperServiceConnector m_GatekeeperConnector;
|
||||
private IHomeUsersSecurityService m_Security;
|
||||
@@ -78,7 +69,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
if (name == Name)
|
||||
{
|
||||
m_agentsInTransit = new List<UUID>();
|
||||
m_GatekeeperConnector = new GatekeeperServiceConnector();
|
||||
|
||||
IConfig config = source.Configs["HGEntityTransferModule"];
|
||||
if (config != null)
|
||||
@@ -108,6 +98,17 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
scene.RegisterModuleInterface<IHomeUsersSecurityService>(m_Security);
|
||||
}
|
||||
|
||||
public override void RegionLoaded(Scene scene)
|
||||
{
|
||||
base.RegionLoaded(scene);
|
||||
if (m_Enabled)
|
||||
if (!m_Initialized)
|
||||
{
|
||||
m_GatekeeperConnector = new GatekeeperServiceConnector(scene.AssetService);
|
||||
m_Initialized = true;
|
||||
}
|
||||
|
||||
}
|
||||
public override void RemoveRegion(Scene scene)
|
||||
{
|
||||
base.AddRegion(scene);
|
||||
@@ -122,7 +123,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
|
||||
protected override GridRegion GetFinalDestination(GridRegion region)
|
||||
{
|
||||
return HyperGridService.GetHyperlinkRegion(region, region.RegionID);
|
||||
int flags = m_aScene.GridService.GetRegionFlags(m_aScene.RegionInfo.ScopeID, region.RegionID);
|
||||
if ((flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0)
|
||||
{
|
||||
return m_GatekeeperConnector.GetHyperlinkRegion(region, region.RegionID);
|
||||
}
|
||||
return region;
|
||||
}
|
||||
|
||||
protected override bool NeedsClosing(uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, GridRegion reg)
|
||||
@@ -133,13 +139,16 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
protected override bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason)
|
||||
{
|
||||
reason = string.Empty;
|
||||
if (reg.RegionLocX != finalDestination.RegionLocX || reg.RegionLocY != finalDestination.RegionLocY)
|
||||
int flags = m_aScene.GridService.GetRegionFlags(m_aScene.RegionInfo.ScopeID, reg.RegionID);
|
||||
if ((flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0)
|
||||
{
|
||||
// this user is going to another grid
|
||||
reg.RegionName = finalDestination.RegionName;
|
||||
reg.RegionID = finalDestination.RegionID;
|
||||
reg.RegionLocX = finalDestination.RegionLocX;
|
||||
reg.RegionLocY = finalDestination.RegionLocY;
|
||||
// Take the IP address + port of the gatekeeper (reg) plus the info of finalDestination
|
||||
GridRegion region = new GridRegion(reg);
|
||||
region.RegionName = finalDestination.RegionName;
|
||||
region.RegionID = finalDestination.RegionID;
|
||||
region.RegionLocX = finalDestination.RegionLocX;
|
||||
region.RegionLocY = finalDestination.RegionLocY;
|
||||
|
||||
// Log their session and remote endpoint in the home users security service
|
||||
IHomeUsersSecurityService security = sp.Scene.RequestModuleInterface<IHomeUsersSecurityService>();
|
||||
@@ -149,7 +158,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
// Log them out of this grid
|
||||
sp.Scene.PresenceService.LogoutAgent(agentCircuit.SessionID, sp.AbsolutePosition, sp.Lookat);
|
||||
|
||||
return m_GatekeeperConnector.CreateAgent(reg, agentCircuit, teleportFlags, out reason);
|
||||
return m_GatekeeperConnector.CreateAgent(region, agentCircuit, teleportFlags, out reason);
|
||||
}
|
||||
|
||||
return m_aScene.SimulationService.CreateAgent(reg, agentCircuit, teleportFlags, out reason);
|
||||
|
||||
@@ -48,7 +48,7 @@ using Nini.Config;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||
{
|
||||
public class HGGridConnector : ISharedRegionModule, IGridService, IHypergridService
|
||||
public class HGGridConnector : ISharedRegionModule, IGridService
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(
|
||||
@@ -61,8 +61,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||
private Dictionary<ulong, Scene> m_LocalScenes = new Dictionary<ulong, Scene>();
|
||||
|
||||
private IGridService m_GridServiceConnector;
|
||||
private IHypergridService m_HypergridService;
|
||||
|
||||
|
||||
#region ISharedRegionModule
|
||||
|
||||
@@ -119,16 +117,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||
Object[] args = new Object[] { source };
|
||||
m_GridServiceConnector = ServerUtils.LoadPlugin<IGridService>(module, args);
|
||||
|
||||
string hypergrid = gridConfig.GetString("HypergridService", string.Empty);
|
||||
if (hypergrid == String.Empty)
|
||||
{
|
||||
m_log.Error("[HGGRID CONNECTOR]: No HypergridService named in section GridService");
|
||||
throw new Exception("Unable to proceed. Please make sure your ini files in config-include are updated according to .example's");
|
||||
}
|
||||
m_HypergridService = ServerUtils.LoadPlugin<IHypergridService>(hypergrid, args);
|
||||
|
||||
if (m_GridServiceConnector == null || m_HypergridService == null)
|
||||
throw new Exception("Unable to proceed. HGGrid services could not be loaded.");
|
||||
}
|
||||
|
||||
public void PostInitialise()
|
||||
@@ -148,7 +136,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||
|
||||
m_LocalScenes[scene.RegionInfo.RegionHandle] = scene;
|
||||
scene.RegisterModuleInterface<IGridService>(this);
|
||||
scene.RegisterModuleInterface<IHypergridService>(this);
|
||||
|
||||
((ISharedRegionModule)m_GridServiceConnector).AddRegion(scene);
|
||||
|
||||
@@ -160,7 +147,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||
{
|
||||
m_LocalScenes.Remove(scene.RegionInfo.RegionHandle);
|
||||
scene.UnregisterModuleInterface<IGridService>(this);
|
||||
scene.UnregisterModuleInterface<IHypergridService>(this);
|
||||
((ISharedRegionModule)m_GridServiceConnector).RemoveRegion(scene);
|
||||
}
|
||||
}
|
||||
@@ -201,13 +187,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||
|
||||
public GridRegion GetRegionByUUID(UUID scopeID, UUID regionID)
|
||||
{
|
||||
GridRegion region = m_GridServiceConnector.GetRegionByUUID(scopeID, regionID);
|
||||
if (region != null)
|
||||
return region;
|
||||
return m_GridServiceConnector.GetRegionByUUID(scopeID, regionID);
|
||||
//if (region != null)
|
||||
// return region;
|
||||
|
||||
region = m_HypergridService.GetRegionByUUID(regionID);
|
||||
//region = m_HypergridService.GetRegionByUUID(regionID);
|
||||
|
||||
return region;
|
||||
//return region;
|
||||
}
|
||||
|
||||
public GridRegion GetRegionByPosition(UUID scopeID, int x, int y)
|
||||
@@ -216,10 +202,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||
int snapY = (int) (y / Constants.RegionSize) * (int)Constants.RegionSize;
|
||||
|
||||
GridRegion region = m_GridServiceConnector.GetRegionByPosition(scopeID, x, y);
|
||||
if (region != null)
|
||||
return region;
|
||||
//if (region != null)
|
||||
// return region;
|
||||
|
||||
region = m_HypergridService.GetRegionByPosition(snapX, snapY);
|
||||
//region = m_HypergridService.GetRegionByPosition(snapX, snapY);
|
||||
|
||||
return region;
|
||||
}
|
||||
@@ -231,7 +217,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||
if (region != null)
|
||||
return region;
|
||||
|
||||
region = m_HypergridService.GetRegionByName(regionName);
|
||||
//region = m_HypergridService.GetRegionByName(regionName);
|
||||
|
||||
return region;
|
||||
}
|
||||
@@ -241,27 +227,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||
if (name == string.Empty)
|
||||
return new List<GridRegion>();
|
||||
|
||||
List<GridRegion> rinfos = m_GridServiceConnector.GetRegionsByName(scopeID, name, maxNumber);
|
||||
|
||||
rinfos.AddRange(m_HypergridService.GetRegionsByName(name));
|
||||
if (rinfos.Count > maxNumber)
|
||||
rinfos.RemoveRange(maxNumber - 1, rinfos.Count - maxNumber);
|
||||
|
||||
return rinfos;
|
||||
return m_GridServiceConnector.GetRegionsByName(scopeID, name, maxNumber);
|
||||
}
|
||||
|
||||
public List<GridRegion> GetRegionRange(UUID scopeID, int xmin, int xmax, int ymin, int ymax)
|
||||
{
|
||||
int snapXmin = (int)(xmin / Constants.RegionSize) * (int)Constants.RegionSize;
|
||||
int snapXmax = (int)(xmax / Constants.RegionSize) * (int)Constants.RegionSize;
|
||||
int snapYmin = (int)(ymin / Constants.RegionSize) * (int)Constants.RegionSize;
|
||||
int snapYmax = (int)(ymax / Constants.RegionSize) * (int)Constants.RegionSize;
|
||||
|
||||
List<GridRegion> rinfos = m_GridServiceConnector.GetRegionRange(scopeID, xmin, xmax, ymin, ymax);
|
||||
|
||||
rinfos.AddRange(m_HypergridService.GetRegionRange(snapXmin, snapXmax, snapYmin, snapYmax));
|
||||
|
||||
return rinfos;
|
||||
return m_GridServiceConnector.GetRegionRange(scopeID, xmin, xmax, ymin, ymax);
|
||||
}
|
||||
|
||||
public List<GridRegion> GetDefaultRegions(UUID scopeID)
|
||||
@@ -281,27 +252,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||
|
||||
#endregion
|
||||
|
||||
#region IHypergridService
|
||||
|
||||
public bool LinkRegion(string regionDescriptor, out UUID regionID, out ulong regionHandle, out string imageURL, out string reason)
|
||||
{
|
||||
return m_HypergridService.LinkRegion(regionDescriptor, out regionID, out regionHandle, out imageURL, out reason);
|
||||
}
|
||||
|
||||
public GridRegion GetHyperlinkRegion(GridRegion gateway, UUID regionID)
|
||||
{
|
||||
if (m_LocalScenes.ContainsKey(gateway.RegionHandle))
|
||||
return gateway;
|
||||
|
||||
return m_HypergridService.GetHyperlinkRegion(gateway, regionID);
|
||||
}
|
||||
|
||||
public GridRegion GetRegionByUUID(UUID regionID) { return null; }
|
||||
public GridRegion GetRegionByPosition(int x, int y) { return null; }
|
||||
public GridRegion GetRegionByName(string name) { return null; }
|
||||
public List<GridRegion> GetRegionsByName(string name) { return null; }
|
||||
public List<GridRegion> GetRegionRange(int xmin, int xmax, int ymin, int ymax) { return null; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user