Merge branch 'master' into mantis5110
Conflicts: OpenSim/Services/GridService/HypergridLinker.csviewer-2-initial-appearance
commit
594f23ff22
|
@ -27,6 +27,7 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
using System.Xml;
|
||||
|
@ -154,6 +155,11 @@ namespace OpenSim.Services.GridService
|
|||
|
||||
// From the command line link-region
|
||||
public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, out string reason)
|
||||
{
|
||||
return TryLinkRegionToCoords(scopeID, mapName, xloc, yloc, UUID.Zero, out reason);
|
||||
}
|
||||
|
||||
public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, UUID ownerID, out string reason)
|
||||
{
|
||||
reason = string.Empty;
|
||||
string host = "127.0.0.1";
|
||||
|
@ -190,7 +196,7 @@ namespace OpenSim.Services.GridService
|
|||
//}
|
||||
|
||||
GridRegion regInfo;
|
||||
bool success = TryCreateLink(scopeID, xloc, yloc, regionName, port, host, out regInfo, out reason);
|
||||
bool success = TryCreateLink(scopeID, xloc, yloc, regionName, port, host, ownerID, out regInfo, out reason);
|
||||
if (success)
|
||||
{
|
||||
regInfo.RegionName = mapName;
|
||||
|
@ -200,12 +206,12 @@ namespace OpenSim.Services.GridService
|
|||
return null;
|
||||
}
|
||||
|
||||
public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string externalRegionName, uint externalPort, string externalHostName, out GridRegion regInfo, out string reason)
|
||||
public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string externalRegionName, uint externalPort, string externalHostName, UUID ownerID, out GridRegion regInfo, out string reason)
|
||||
{
|
||||
return TryCreateLink(scopeID, xloc, yloc, externalRegionName, externalPort, externalHostName, null, out regInfo, out reason);
|
||||
return TryCreateLink(scopeID, xloc, yloc, externalRegionName, externalPort, externalHostName, null, ownerID, out regInfo, out reason);
|
||||
}
|
||||
|
||||
public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string externalRegionName, uint externalPort, string externalHostName, string serverURI, out GridRegion regInfo, out string reason)
|
||||
public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string externalRegionName, uint externalPort, string externalHostName, string serverURI, UUID ownerID, out GridRegion regInfo, out string reason)
|
||||
{
|
||||
m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}:{2}, in {3}-{4}", externalHostName, externalPort, externalRegionName, xloc, yloc);
|
||||
|
||||
|
@ -225,6 +231,16 @@ namespace OpenSim.Services.GridService
|
|||
regInfo.RegionLocX = xloc;
|
||||
regInfo.RegionLocY = yloc;
|
||||
regInfo.ScopeID = scopeID;
|
||||
regInfo.EstateOwner = ownerID;
|
||||
|
||||
// Check for free coordinates
|
||||
GridRegion region = m_GridService.GetRegionByPosition(regInfo.ScopeID, regInfo.RegionLocX, regInfo.RegionLocY);
|
||||
if (region != null)
|
||||
{
|
||||
m_log.WarnFormat("[HYPERGRID LINKER]: Coordinates {0}-{1} are already occupied by region {2} with uuid {3}", regInfo.RegionLocX, regInfo.RegionLocY, region.RegionName, region.RegionID);
|
||||
reason = "Coordinates are already in use";
|
||||
return false;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -247,11 +263,11 @@ namespace OpenSim.Services.GridService
|
|||
|
||||
if (regionID != UUID.Zero)
|
||||
{
|
||||
GridRegion r = m_GridService.GetRegionByUUID(scopeID, regionID);
|
||||
if (r != null)
|
||||
region = m_GridService.GetRegionByUUID(scopeID, regionID);
|
||||
if (region != null)
|
||||
{
|
||||
m_log.DebugFormat("[HYPERGRID LINKER]: Region already exists in coordinates {0} {1}", r.RegionLocX / Constants.RegionSize, r.RegionLocY / Constants.RegionSize);
|
||||
regInfo = r;
|
||||
m_log.DebugFormat("[HYPERGRID LINKER]: Region already exists in coordinates {0} {1}", region.RegionLocX / Constants.RegionSize, region.RegionLocY / Constants.RegionSize);
|
||||
regInfo = region;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -366,17 +382,8 @@ namespace OpenSim.Services.GridService
|
|||
{
|
||||
// Check for regions which are not linked regions
|
||||
List<GridRegion> hyperlinks = m_GridService.GetHyperlinks(m_ScopeID);
|
||||
// would like to use .Except, but doesn't seem to exist
|
||||
//IEnumerable<GridRegion> availableRegions = regions.Except(hyperlinks);
|
||||
List<GridRegion> availableRegions = regions.FindAll(delegate(GridRegion region)
|
||||
{
|
||||
// Ewww! n^2
|
||||
if (hyperlinks.Find(delegate(GridRegion r) { return r.RegionID == region.RegionID; }) == null) // not hyperlink. good.
|
||||
return true;
|
||||
|
||||
return false;
|
||||
});
|
||||
if (availableRegions.Count == 0)
|
||||
IEnumerable<GridRegion> availableRegions = regions.Except(hyperlinks);
|
||||
if (availableRegions.Count() == 0)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -458,7 +465,7 @@ namespace OpenSim.Services.GridService
|
|||
remoteName = cmdparams[3];
|
||||
string reason = string.Empty;
|
||||
GridRegion regInfo;
|
||||
TryCreateLink(UUID.Zero, xloc, yloc, remoteName, 0, null, serverURI, out regInfo, out reason);
|
||||
TryCreateLink(UUID.Zero, xloc, yloc, remoteName, 0, null, serverURI, UUID.Zero, out regInfo, out reason);
|
||||
}
|
||||
|
||||
private void RunHGCommand(string command, string[] cmdparams)
|
||||
|
@ -571,7 +578,7 @@ namespace OpenSim.Services.GridService
|
|||
xloc = xloc * (int)Constants.RegionSize;
|
||||
yloc = yloc * (int)Constants.RegionSize;
|
||||
string reason = string.Empty;
|
||||
if (TryCreateLink(UUID.Zero, xloc, yloc, "", externalPort, externalHostName, out regInfo, out reason))
|
||||
if (TryCreateLink(UUID.Zero, xloc, yloc, "", externalPort, externalHostName, UUID.Zero, out regInfo, out reason))
|
||||
{
|
||||
if (cmdparams.Length >= 5)
|
||||
{
|
||||
|
@ -673,8 +680,7 @@ namespace OpenSim.Services.GridService
|
|||
xloc = xloc * (int)Constants.RegionSize;
|
||||
yloc = yloc * (int)Constants.RegionSize;
|
||||
string reason = string.Empty;
|
||||
if (TryCreateLink(UUID.Zero, xloc, yloc, "", externalPort,
|
||||
externalHostName, out regInfo, out reason))
|
||||
if (TryCreateLink(UUID.Zero, xloc, yloc, "", externalPort, externalHostName, UUID.Zero, out regInfo, out reason))
|
||||
{
|
||||
regInfo.RegionName = config.GetString("localName", "");
|
||||
}
|
||||
|
|
|
@ -1084,6 +1084,7 @@
|
|||
|
||||
<ReferencePath>../../../bin/</ReferencePath>
|
||||
<Reference name="System"/>
|
||||
<Reference name="System.Core"/>
|
||||
<Reference name="System.Xml"/>
|
||||
<Reference name="OpenMetaverseTypes" path="../../../bin/"/>
|
||||
<Reference name="OpenMetaverse" path="../../../bin/"/>
|
||||
|
|
Loading…
Reference in New Issue