Adds support for unlink-region command in hypergrid.
parent
87822c5d95
commit
a7d610ffcc
|
@ -65,6 +65,9 @@ namespace OpenSim.Framework.Communications
|
|||
|
||||
RegionInfo RequestNeighbourInfo(ulong regionHandle);
|
||||
RegionInfo RequestNeighbourInfo(UUID regionID);
|
||||
RegionInfo RequestNeighbourInfo(string name);
|
||||
RegionInfo RequestNeighbourInfo(string host, uint port);
|
||||
|
||||
RegionInfo RequestClosestRegion(string regionName);
|
||||
Dictionary<string, string> GetGridSettings();
|
||||
List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY);
|
||||
|
|
|
@ -69,6 +69,9 @@ namespace OpenSim
|
|||
MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region",
|
||||
"link-region <Xloc> <Yloc> <HostName>:<HttpPort>[:<RemoteRegionName>] <cr>",
|
||||
"Link a hypergrid region", RunCommand);
|
||||
MainConsole.Instance.Commands.AddCommand("hypergrid", false, "unlink-region",
|
||||
"unlink-region <local name> or <HostName>:<HttpPort> <cr>",
|
||||
"Unlink a hypergrid region", RunCommand);
|
||||
}
|
||||
|
||||
protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager,
|
||||
|
@ -188,6 +191,18 @@ namespace OpenSim
|
|||
}
|
||||
return;
|
||||
}
|
||||
else if (command.Equals("unlink-region"))
|
||||
{
|
||||
if (cmdparams.Count < 1)
|
||||
{
|
||||
UnlinkRegionCmdUsage();
|
||||
return;
|
||||
}
|
||||
if (HGHyperlink.TryUnlinkRegion(m_sceneManager.CurrentOrFirstScene, cmdparams[0]))
|
||||
m_log.InfoFormat("[HGrid]: Successfully unlinked {0}", cmdparams[0]);
|
||||
else
|
||||
m_log.InfoFormat("[HGrid]: Unable to unlink {0}, region not found", cmdparams[0]);
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadXmlLinkFile(List<string> cmdparams)
|
||||
|
@ -279,5 +294,12 @@ namespace OpenSim
|
|||
m_log.Info("Usage: link-region <Xloc> <Yloc> <HostName> <HttpPort> [<LocalName>]");
|
||||
m_log.Info("Usage: link-region <URI_of_xml> [<exclude>]");
|
||||
}
|
||||
|
||||
private void UnlinkRegionCmdUsage()
|
||||
{
|
||||
m_log.Info("Usage: unlink-region <HostName>:<HttpPort>");
|
||||
m_log.Info("Usage: unlink-region <LocalName>");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -258,6 +258,47 @@ namespace OpenSim.Region.Communications.Hypergrid
|
|||
return null;
|
||||
}
|
||||
|
||||
public virtual RegionInfo RequestNeighbourInfo(string name)
|
||||
{
|
||||
foreach (RegionInfo info in m_hyperlinkRegions)
|
||||
{
|
||||
//m_log.Debug(" .. " + info.RegionHandle);
|
||||
if (info.RegionName == name) return info;
|
||||
}
|
||||
|
||||
foreach (RegionInfo info in m_knownRegions.Values)
|
||||
{
|
||||
if (info.RegionName == name)
|
||||
{
|
||||
//m_log.Debug("XXX------ known region " + info.RegionHandle);
|
||||
return info;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public virtual RegionInfo RequestNeighbourInfo(string hostName, uint port)
|
||||
{
|
||||
foreach (RegionInfo info in m_hyperlinkRegions)
|
||||
{
|
||||
//m_log.Debug(" .. " + info.RegionHandle);
|
||||
if ((info.ExternalHostName == hostName) && (info.HttpPort == port))
|
||||
return info;
|
||||
}
|
||||
|
||||
foreach (RegionInfo info in m_knownRegions.Values)
|
||||
{
|
||||
if ((info.ExternalHostName == hostName) && (info.HttpPort == port))
|
||||
{
|
||||
//m_log.Debug("XXX------ known region " + info.RegionHandle);
|
||||
return info;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public virtual RegionInfo RequestClosestRegion(string regionName)
|
||||
{
|
||||
foreach (RegionInfo info in m_hyperlinkRegions)
|
||||
|
|
|
@ -198,6 +198,38 @@ namespace OpenSim.Region.Communications.Local
|
|||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get information about a neighbouring region
|
||||
/// </summary>
|
||||
/// <param name="regionHandle"></param>
|
||||
/// <returns></returns>
|
||||
public RegionInfo RequestNeighbourInfo(string name)
|
||||
{
|
||||
foreach (RegionInfo info in m_regions.Values)
|
||||
{
|
||||
if (info.RegionName == name)
|
||||
return info;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get information about a neighbouring region
|
||||
/// </summary>
|
||||
/// <param name="regionHandle"></param>
|
||||
/// <returns></returns>
|
||||
public RegionInfo RequestNeighbourInfo(string host, uint port)
|
||||
{
|
||||
foreach (RegionInfo info in m_regions.Values)
|
||||
{
|
||||
if ((info.ExternalHostName == host) && (info.HttpPort == port))
|
||||
return info;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get information about the closet region given a region name.
|
||||
/// </summary>
|
||||
|
|
|
@ -445,6 +445,28 @@ namespace OpenSim.Region.Communications.OGS1
|
|||
return regionInfo;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get information about a neighbouring region
|
||||
/// </summary>
|
||||
/// <param name="regionHandle"></param>
|
||||
/// <returns></returns>
|
||||
public RegionInfo RequestNeighbourInfo(string name)
|
||||
{
|
||||
// Not implemented yet
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get information about a neighbouring region
|
||||
/// </summary>
|
||||
/// <param name="regionHandle"></param>
|
||||
/// <returns></returns>
|
||||
public RegionInfo RequestNeighbourInfo(string host, uint port)
|
||||
{
|
||||
// Not implemented yet
|
||||
return null;
|
||||
}
|
||||
|
||||
public RegionInfo RequestClosestRegion(string regionName)
|
||||
{
|
||||
foreach (RegionInfo ri in m_remoteRegionInfoCache.Values)
|
||||
|
|
|
@ -149,6 +149,48 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
|
|||
return true;
|
||||
}
|
||||
|
||||
public static bool TryUnlinkRegion(Scene m_scene, string mapName)
|
||||
{
|
||||
RegionInfo regInfo = null;
|
||||
if (mapName.Contains(":"))
|
||||
{
|
||||
string host = "127.0.0.1";
|
||||
string portstr;
|
||||
string regionName = "";
|
||||
uint port = 9000;
|
||||
string[] parts = mapName.Split(new char[] { ':' });
|
||||
if (parts.Length >= 1)
|
||||
{
|
||||
host = parts[0];
|
||||
}
|
||||
if (parts.Length >= 2)
|
||||
{
|
||||
portstr = parts[1];
|
||||
if (!UInt32.TryParse(portstr, out port))
|
||||
regionName = parts[1];
|
||||
}
|
||||
// always take the last one
|
||||
if (parts.Length >= 3)
|
||||
{
|
||||
regionName = parts[2];
|
||||
}
|
||||
regInfo = m_scene.CommsManager.GridService.RequestNeighbourInfo(host, port);
|
||||
}
|
||||
else
|
||||
{
|
||||
regInfo = m_scene.CommsManager.GridService.RequestNeighbourInfo(mapName);
|
||||
}
|
||||
if (regInfo != null)
|
||||
{
|
||||
return m_scene.CommsManager.GridService.DeregisterRegion(regInfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.InfoFormat("[HGrid]: Region {0} not found", mapName);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Cope with this viewer limitation.
|
||||
/// </summary>
|
||||
|
|
Loading…
Reference in New Issue