Merge branch 'master' of /var/git/opensim/
commit
8b867ba23e
|
@ -27,6 +27,7 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
using System.Xml;
|
||||
|
@ -153,6 +154,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";
|
||||
|
@ -189,7 +195,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;
|
||||
|
@ -202,7 +208,8 @@ namespace OpenSim.Services.GridService
|
|||
|
||||
// From the command line and the 2 above
|
||||
public bool TryCreateLink(UUID scopeID, int xloc, int yloc,
|
||||
string externalRegionName, uint externalPort, string externalHostName, out GridRegion regInfo, out string reason)
|
||||
string externalRegionName, uint externalPort, string externalHostName, 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);
|
||||
|
||||
|
@ -214,12 +221,22 @@ namespace OpenSim.Services.GridService
|
|||
regInfo.RegionLocX = xloc;
|
||||
regInfo.RegionLocY = yloc;
|
||||
regInfo.ScopeID = scopeID;
|
||||
regInfo.EstateOwner = ownerID;
|
||||
|
||||
// Big HACK for Simian Grid !!!
|
||||
// We need to clean up all URLs used in OpenSim !!!
|
||||
if (externalHostName.Contains("/"))
|
||||
regInfo.ServerURI = externalHostName;
|
||||
|
||||
// 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
|
||||
{
|
||||
regInfo.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int)0);
|
||||
|
@ -241,11 +258,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;
|
||||
}
|
||||
|
||||
|
@ -355,17 +372,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;
|
||||
}
|
||||
|
||||
|
@ -529,7 +537,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)
|
||||
{
|
||||
|
@ -631,8 +639,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