First pass at the heart surgery for grid services. Compiles and runs minimally. A few bugs to catch now.

This commit is contained in:
Diva Canto
2009-09-26 07:48:21 -07:00
parent eed8a61559
commit 5757afe766
27 changed files with 441 additions and 980 deletions

View File

@@ -47,7 +47,7 @@ using Nini.Config;
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
{
public class HGGridConnector : ISharedRegionModule, IGridService
public class HGGridConnector : ISharedRegionModule, IGridService, IHyperlinkService
{
private static readonly ILog m_log =
LogManager.GetLogger(
@@ -142,6 +142,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
return;
scene.RegisterModuleInterface<IGridService>(this);
scene.RegisterModuleInterface<IHyperlinkService>(this);
}
@@ -367,10 +368,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
}
#endregion
#region Hyperlinks
#region IHyperlinkService
private static Random random = new Random();
public GridRegion TryLinkRegionToCoords(Scene m_scene, IClientAPI client, string mapName, int xloc, int yloc)
{
string host = "127.0.0.1";
@@ -417,6 +419,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
return null;
}
// From the map search and secondlife://blah
public GridRegion TryLinkRegion(Scene m_scene, IClientAPI client, string mapName)
{
@@ -554,6 +557,27 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
return true;
}
public GridRegion TryLinkRegion(IClientAPI client, string regionDescriptor)
{
return TryLinkRegion((Scene)client.Scene, client, regionDescriptor);
}
public GridRegion GetHyperlinkRegion(ulong handle)
{
foreach (GridRegion r in m_HyperlinkRegions.Values)
if (r.RegionHandle == handle)
return r;
return null;
}
public ulong FindRegionHandle(ulong handle)
{
foreach (GridRegion r in m_HyperlinkRegions.Values)
if ((r.RegionHandle == handle) && (m_HyperlinkHandles.ContainsKey(r.RegionID)))
return m_HyperlinkHandles[r.RegionID];
return 0;
}
#endregion
}

View File

@@ -42,6 +42,7 @@ using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.Framework.Scenes.Hypergrid;
using OpenSim.Region.Framework.Scenes.Serialization;
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
{
@@ -161,7 +162,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
// else do the remote thing
if (!m_localBackend.IsLocalRegion(regionHandle))
{
RegionInfo regInfo = m_commsManager.GridService.RequestNeighbourInfo(regionHandle);
uint x = 0, y = 0;
Utils.LongToUInts(regionHandle, out x, out y);
GridRegion regInfo = m_aScene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
if (regInfo != null)
{
m_regionClient.SendUserInformation(regInfo, aCircuit);
@@ -183,7 +186,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
// else do the remote thing
if (!m_localBackend.IsLocalRegion(regionHandle))
{
RegionInfo regInfo = m_commsManager.GridService.RequestNeighbourInfo(regionHandle);
uint x = 0, y = 0;
Utils.LongToUInts(regionHandle, out x, out y);
GridRegion regInfo = m_aScene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
if (regInfo != null)
{
return m_regionClient.DoChildAgentUpdateCall(regInfo, cAgentData);
@@ -204,7 +209,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
// else do the remote thing
if (!m_localBackend.IsLocalRegion(regionHandle))
{
RegionInfo regInfo = m_commsManager.GridService.RequestNeighbourInfo(regionHandle);
uint x = 0, y = 0;
Utils.LongToUInts(regionHandle, out x, out y);
GridRegion regInfo = m_aScene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
if (regInfo != null)
{
return m_regionClient.DoChildAgentUpdateCall(regInfo, cAgentData);
@@ -225,7 +232,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
// else do the remote thing
if (!m_localBackend.IsLocalRegion(regionHandle))
{
RegionInfo regInfo = m_commsManager.GridService.RequestNeighbourInfo(regionHandle);
uint x = 0, y = 0;
Utils.LongToUInts(regionHandle, out x, out y);
GridRegion regInfo = m_aScene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
if (regInfo != null)
{
return m_regionClient.DoRetrieveRootAgentCall(regInfo, id, out agent);
@@ -257,7 +266,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
// else do the remote thing
if (!m_localBackend.IsLocalRegion(regionHandle))
{
RegionInfo regInfo = m_commsManager.GridService.RequestNeighbourInfo(regionHandle);
uint x = 0, y = 0;
Utils.LongToUInts(regionHandle, out x, out y);
GridRegion regInfo = m_aScene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
if (regInfo != null)
{
return m_regionClient.DoCloseAgentCall(regInfo, id);
@@ -284,7 +295,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
// else do the remote thing
if (!m_localBackend.IsLocalRegion(regionHandle))
{
RegionInfo regInfo = m_commsManager.GridService.RequestNeighbourInfo(regionHandle);
uint x = 0, y = 0;
Utils.LongToUInts(regionHandle, out x, out y);
GridRegion regInfo = m_aScene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
if (regInfo != null)
{
return m_regionClient.DoCreateObjectCall(
@@ -798,13 +811,20 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
return false;
}
public override void SendUserInformation(RegionInfo regInfo, AgentCircuitData aCircuit)
public override void SendUserInformation(GridRegion regInfo, AgentCircuitData aCircuit)
{
try
{
if (m_aScene.SceneGridService is HGSceneCommunicationService)
{
((HGSceneCommunicationService)(m_aScene.SceneGridService)).m_hg.SendUserInformation(regInfo, aCircuit);
// big hack for now
RegionInfo r = new RegionInfo();
r.ExternalHostName = regInfo.ExternalHostName;
r.HttpPort = regInfo.HttpPort;
r.RegionID = regInfo.RegionID;
r.RegionLocX = (uint)regInfo.RegionLocX;
r.RegionLocY = (uint)regInfo.RegionLocY;
((HGSceneCommunicationService)(m_aScene.SceneGridService)).m_hg.SendUserInformation(r, aCircuit);
}
}
catch // Bad cast

View File

@@ -37,6 +37,7 @@ using OpenSim.Region.Framework.Scenes;
using OpenSim.Services.Interfaces;
using OpenSim.Server.Base;
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Land
{
public class RemoteLandServicesConnector :
@@ -89,7 +90,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Land
if (!m_Enabled)
return;
m_MapService = scene.CommsManager.GridService;
m_GridService = scene.GridService;
m_LocalService.AddRegion(scene);
scene.RegisterModuleInterface<ILandService>(this);
}

View File

@@ -118,7 +118,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour
if (!m_Enabled)
return;
m_MapService = scene.CommsManager.GridService;
m_LocalService.AddRegion(scene);
scene.RegisterModuleInterface<INeighbourService>(this);
}
@@ -134,6 +133,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour
if (!m_Enabled)
return;
m_GridService = scene.GridService;
m_log.InfoFormat("[NEIGHBOUR CONNECTOR]: Enabled remote neighbours for region {0}", scene.RegionInfo.RegionName);
}