Fixed a bug with link-region.
parent
b5163889b9
commit
dcfd08b8dd
|
@ -37,6 +37,7 @@ using OpenSim.Region.Framework.Interfaces;
|
||||||
using OpenSim.Server.Base;
|
using OpenSim.Server.Base;
|
||||||
using OpenSim.Server.Handlers.Base;
|
using OpenSim.Server.Handlers.Base;
|
||||||
using OpenSim.Server.Handlers.Grid;
|
using OpenSim.Server.Handlers.Grid;
|
||||||
|
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||||
|
|
||||||
namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Grid
|
namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Grid
|
||||||
{
|
{
|
||||||
|
@ -106,7 +107,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Grid
|
||||||
//ServerUtils.LoadPlugin<HypergridServiceInConnector>("OpenSim.Server.Handlers.dll:HypergridServiceInConnector", args);
|
//ServerUtils.LoadPlugin<HypergridServiceInConnector>("OpenSim.Server.Handlers.dll:HypergridServiceInConnector", args);
|
||||||
}
|
}
|
||||||
|
|
||||||
SimpleRegionInfo rinfo = new SimpleRegionInfo(scene.RegionInfo);
|
GridRegion rinfo = new GridRegion(scene.RegionInfo);
|
||||||
m_HypergridHandler.AddRegion(rinfo);
|
m_HypergridHandler.AddRegion(rinfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,7 +116,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Grid
|
||||||
if (!m_Enabled)
|
if (!m_Enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SimpleRegionInfo rinfo = new SimpleRegionInfo(scene.RegionInfo);
|
GridRegion rinfo = new GridRegion(scene.RegionInfo);
|
||||||
m_HypergridHandler.RemoveRegion(rinfo);
|
m_HypergridHandler.RemoveRegion(rinfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||||
|
|
||||||
private void RunHGCommand(string command, string[] cmdparams)
|
private void RunHGCommand(string command, string[] cmdparams)
|
||||||
{
|
{
|
||||||
if (command.Equals("linkk-mapping"))
|
if (command.Equals("link-mapping"))
|
||||||
{
|
{
|
||||||
if (cmdparams.Length == 2)
|
if (cmdparams.Length == 2)
|
||||||
{
|
{
|
||||||
|
@ -104,7 +104,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (command.Equals("linkk-region"))
|
else if (command.Equals("link-region"))
|
||||||
{
|
{
|
||||||
if (cmdparams.Length < 3)
|
if (cmdparams.Length < 3)
|
||||||
{
|
{
|
||||||
|
@ -187,7 +187,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (command.Equals("unlinkk-region"))
|
else if (command.Equals("unlink-region"))
|
||||||
{
|
{
|
||||||
if (cmdparams.Length < 1)
|
if (cmdparams.Length < 1)
|
||||||
{
|
{
|
||||||
|
|
|
@ -159,27 +159,16 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||||
{
|
{
|
||||||
m_HypergridServiceConnector = new HypergridServiceConnector(scene.AssetService);
|
m_HypergridServiceConnector = new HypergridServiceConnector(scene.AssetService);
|
||||||
HGCommands hgCommands = new HGCommands(this, scene);
|
HGCommands hgCommands = new HGCommands(this, scene);
|
||||||
MainConsole.Instance.Commands.AddCommand("HGGridServicesConnector", false, "linkk-region",
|
MainConsole.Instance.Commands.AddCommand("HGGridServicesConnector", false, "link-region",
|
||||||
"link-region <Xloc> <Yloc> <HostName>:<HttpPort>[:<RemoteRegionName>] <cr>",
|
"link-region <Xloc> <Yloc> <HostName>:<HttpPort>[:<RemoteRegionName>] <cr>",
|
||||||
"Link a hypergrid region", hgCommands.RunCommand);
|
"Link a hypergrid region", hgCommands.RunCommand);
|
||||||
MainConsole.Instance.Commands.AddCommand("HGGridServicesConnector", false, "unlinkk-region",
|
MainConsole.Instance.Commands.AddCommand("HGGridServicesConnector", false, "unlink-region",
|
||||||
"unlink-region <local name> or <HostName>:<HttpPort> <cr>",
|
"unlink-region <local name> or <HostName>:<HttpPort> <cr>",
|
||||||
"Unlink a hypergrid region", hgCommands.RunCommand);
|
"Unlink a hypergrid region", hgCommands.RunCommand);
|
||||||
MainConsole.Instance.Commands.AddCommand("HGGridServicesConnector", false, "linkk-mapping", "link-mapping [<x> <y>] <cr>",
|
MainConsole.Instance.Commands.AddCommand("HGGridServicesConnector", false, "link-mapping", "link-mapping [<x> <y>] <cr>",
|
||||||
"Set local coordinate to map HG regions to", hgCommands.RunCommand);
|
"Set local coordinate to map HG regions to", hgCommands.RunCommand);
|
||||||
m_Initialized = true;
|
m_Initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//scene.AddCommand("HGGridServicesConnector", "linkk-region",
|
|
||||||
// "link-region <Xloc> <Yloc> <HostName>:<HttpPort>[:<RemoteRegionName>] <cr>",
|
|
||||||
// "Link a hypergrid region", hgCommands.RunCommand);
|
|
||||||
//scene.AddCommand("HGGridServicesConnector", "unlinkk-region",
|
|
||||||
// "unlink-region <local name> or <HostName>:<HttpPort> <cr>",
|
|
||||||
// "Unlink a hypergrid region", hgCommands.RunCommand);
|
|
||||||
//scene.AddCommand("HGGridServicesConnector", "linkk-mapping", "link-mapping [<x> <y>] <cr>",
|
|
||||||
// "Set local coordinate to map HG regions to", hgCommands.RunCommand);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -450,15 +439,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||||
}
|
}
|
||||||
|
|
||||||
// Finally, link it
|
// Finally, link it
|
||||||
try
|
if (!RegisterRegion(UUID.Zero, regInfo))
|
||||||
{
|
{
|
||||||
RegisterRegion(UUID.Zero, regInfo);
|
m_log.Warn("[HGrid]: Unable to link region");
|
||||||
}
|
return false;
|
||||||
catch (Exception e)
|
}
|
||||||
{
|
|
||||||
m_log.Warn("[HGrid]: Unable to link region: " + e.Message);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
int x, y;
|
int x, y;
|
||||||
if (!Check4096(m_scene, regInfo, out x, out y))
|
if (!Check4096(m_scene, regInfo, out x, out y))
|
||||||
|
|
|
@ -36,6 +36,7 @@ using OpenSim.Server.Base;
|
||||||
using OpenSim.Services.Interfaces;
|
using OpenSim.Services.Interfaces;
|
||||||
using OpenSim.Framework.Servers.HttpServer;
|
using OpenSim.Framework.Servers.HttpServer;
|
||||||
using OpenSim.Server.Handlers.Base;
|
using OpenSim.Server.Handlers.Base;
|
||||||
|
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||||
|
|
||||||
using log4net;
|
using log4net;
|
||||||
using Nwc.XmlRpc;
|
using Nwc.XmlRpc;
|
||||||
|
@ -48,12 +49,12 @@ namespace OpenSim.Server.Handlers.Grid
|
||||||
LogManager.GetLogger(
|
LogManager.GetLogger(
|
||||||
MethodBase.GetCurrentMethod().DeclaringType);
|
MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private List<SimpleRegionInfo> m_RegionsOnSim = new List<SimpleRegionInfo>();
|
private List<GridRegion> m_RegionsOnSim = new List<GridRegion>();
|
||||||
|
|
||||||
public HypergridServiceInConnector(IConfigSource config, IHttpServer server) :
|
public HypergridServiceInConnector(IConfigSource config, IHttpServer server) :
|
||||||
base(config, server)
|
base(config, server)
|
||||||
{
|
{
|
||||||
server.AddXmlRPCHandler("linkk_region", LinkRegionRequest, false);
|
server.AddXmlRPCHandler("link_region", LinkRegionRequest, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -70,8 +71,8 @@ namespace OpenSim.Server.Handlers.Grid
|
||||||
|
|
||||||
m_log.DebugFormat("[HGrid]: Hyperlink request");
|
m_log.DebugFormat("[HGrid]: Hyperlink request");
|
||||||
|
|
||||||
SimpleRegionInfo regInfo = null;
|
GridRegion regInfo = null;
|
||||||
foreach (SimpleRegionInfo r in m_RegionsOnSim)
|
foreach (GridRegion r in m_RegionsOnSim)
|
||||||
{
|
{
|
||||||
if ((r.RegionName != null) && (name != null) && (r.RegionName.ToLower() == name.ToLower()))
|
if ((r.RegionName != null) && (name != null) && (r.RegionName.ToLower() == name.ToLower()))
|
||||||
{
|
{
|
||||||
|
@ -85,9 +86,9 @@ namespace OpenSim.Server.Handlers.Grid
|
||||||
|
|
||||||
Hashtable hash = new Hashtable();
|
Hashtable hash = new Hashtable();
|
||||||
hash["uuid"] = regInfo.RegionID.ToString();
|
hash["uuid"] = regInfo.RegionID.ToString();
|
||||||
|
m_log.Debug(">> Here " + regInfo.RegionID);
|
||||||
hash["handle"] = regInfo.RegionHandle.ToString();
|
hash["handle"] = regInfo.RegionHandle.ToString();
|
||||||
//m_log.Debug(">> Here " + regInfo.RegionHandle);
|
hash["region_image"] = regInfo.TerrainImage.ToString();
|
||||||
//hash["region_image"] = regInfo.RegionSettings.TerrainImageID.ToString();
|
|
||||||
hash["region_name"] = regInfo.RegionName;
|
hash["region_name"] = regInfo.RegionName;
|
||||||
hash["internal_port"] = regInfo.InternalEndPoint.Port.ToString();
|
hash["internal_port"] = regInfo.InternalEndPoint.Port.ToString();
|
||||||
//m_log.Debug(">> Here: " + regInfo.InternalEndPoint.Port);
|
//m_log.Debug(">> Here: " + regInfo.InternalEndPoint.Port);
|
||||||
|
@ -98,12 +99,12 @@ namespace OpenSim.Server.Handlers.Grid
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddRegion(SimpleRegionInfo rinfo)
|
public void AddRegion(GridRegion rinfo)
|
||||||
{
|
{
|
||||||
m_RegionsOnSim.Add(rinfo);
|
m_RegionsOnSim.Add(rinfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveRegion(SimpleRegionInfo rinfo)
|
public void RemoveRegion(GridRegion rinfo)
|
||||||
{
|
{
|
||||||
if (m_RegionsOnSim.Contains(rinfo))
|
if (m_RegionsOnSim.Contains(rinfo))
|
||||||
m_RegionsOnSim.Remove(rinfo);
|
m_RegionsOnSim.Remove(rinfo);
|
||||||
|
|
|
@ -66,7 +66,7 @@ namespace OpenSim.Services.Connectors.Grid
|
||||||
IList paramList = new ArrayList();
|
IList paramList = new ArrayList();
|
||||||
paramList.Add(hash);
|
paramList.Add(hash);
|
||||||
|
|
||||||
XmlRpcRequest request = new XmlRpcRequest("linkk_region", paramList);
|
XmlRpcRequest request = new XmlRpcRequest("link_region", paramList);
|
||||||
string uri = "http://" + info.ExternalEndPoint.Address + ":" + info.HttpPort + "/";
|
string uri = "http://" + info.ExternalEndPoint.Address + ":" + info.HttpPort + "/";
|
||||||
m_log.Debug("[HGrid]: Linking to " + uri);
|
m_log.Debug("[HGrid]: Linking to " + uri);
|
||||||
XmlRpcResponse response = request.Send(uri, 10000);
|
XmlRpcResponse response = request.Send(uri, 10000);
|
||||||
|
@ -82,6 +82,7 @@ namespace OpenSim.Services.Connectors.Grid
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
UUID.TryParse((string)hash["uuid"], out uuid);
|
UUID.TryParse((string)hash["uuid"], out uuid);
|
||||||
|
m_log.Debug(">> HERE, uuid: " + uuid);
|
||||||
info.RegionID = uuid;
|
info.RegionID = uuid;
|
||||||
if ((string)hash["handle"] != null)
|
if ((string)hash["handle"] != null)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue