Merge branch 'master' into careminster-presence-refactor

avinationmerge
Melanie 2010-08-07 05:41:41 +01:00
commit 8fd3f6cf7f
23 changed files with 27795 additions and 27780 deletions

View File

@ -319,6 +319,13 @@ namespace OpenSim.Framework.Servers.HttpServer
OSHttpRequest req = new OSHttpRequest(context, request); OSHttpRequest req = new OSHttpRequest(context, request);
OSHttpResponse resp = new OSHttpResponse(new HttpResponse(context, request),context); OSHttpResponse resp = new OSHttpResponse(new HttpResponse(context, request),context);
HandleRequest(req, resp); HandleRequest(req, resp);
// !!!HACK ALERT!!!
// There seems to be a bug in the underlying http code that makes subsequent requests
// come up with trash in Accept headers. Until that gets fixed, we're cleaning them up here.
if (request.AcceptTypes != null)
for (int i = 0; i < request.AcceptTypes.Length; i++)
request.AcceptTypes[i] = string.Empty;
} }
// public void ConvertIHttpClientContextToOSHttp(object stateinfo) // public void ConvertIHttpClientContextToOSHttp(object stateinfo)

View File

@ -390,36 +390,41 @@ Asset service request failures: {3}" + Environment.NewLine,
public override string XReport(string uptime, string version) public override string XReport(string uptime, string version)
{ {
OSDMap args = new OSDMap(30); OSDMap args = new OSDMap(30);
args["AssetsInCache"] = OSD.FromReal(AssetsInCache); args["AssetsInCache"] = OSD.FromString (String.Format ("{0:0.##}", AssetsInCache));
args["TimeAfterCacheMiss"] = OSD.FromReal(assetRequestTimeAfterCacheMiss.Milliseconds / 1000.0); args["TimeAfterCacheMiss"] = OSD.FromString (String.Format ("{0:0.##}",
args["BlockedMissingTextureRequests"] = OSD.FromReal(BlockedMissingTextureRequests); assetRequestTimeAfterCacheMiss.Milliseconds / 1000.0));
args["AssetServiceRequestFailures"] = OSD.FromReal(AssetServiceRequestFailures); args["BlockedMissingTextureRequests"] = OSD.FromString (String.Format ("{0:0.##}",
args["abnormalClientThreadTerminations"] = OSD.FromReal(abnormalClientThreadTerminations); BlockedMissingTextureRequests));
args["InventoryServiceRetrievalFailures"] = OSD.FromReal(InventoryServiceRetrievalFailures); args["AssetServiceRequestFailures"] = OSD.FromString (String.Format ("{0:0.##}",
args["Dilatn"] = OSD.FromReal(timeDilation); AssetServiceRequestFailures));
args["SimFPS"] = OSD.FromReal(simFps); args["abnormalClientThreadTerminations"] = OSD.FromString (String.Format ("{0:0.##}",
args["PhyFPS"] = OSD.FromReal(physicsFps); abnormalClientThreadTerminations));
args["AgntUp"] = OSD.FromReal(agentUpdates); args["InventoryServiceRetrievalFailures"] = OSD.FromString (String.Format ("{0:0.##}",
args["RootAg"] = OSD.FromReal(rootAgents); InventoryServiceRetrievalFailures));
args["ChldAg"] = OSD.FromReal(childAgents); args["Dilatn"] = OSD.FromString (String.Format ("{0:0.##}", timeDilation));
args["Prims"] = OSD.FromReal(totalPrims); args["SimFPS"] = OSD.FromString (String.Format ("{0:0.##}", simFps));
args["AtvPrm"] = OSD.FromReal(activePrims); args["PhyFPS"] = OSD.FromString (String.Format ("{0:0.##}", physicsFps));
args["AtvScr"] = OSD.FromReal(activeScripts); args["AgntUp"] = OSD.FromString (String.Format ("{0:0.##}", agentUpdates));
args["ScrLPS"] = OSD.FromReal(scriptLinesPerSecond); args["RootAg"] = OSD.FromString (String.Format ("{0:0.##}", rootAgents));
args["PktsIn"] = OSD.FromReal(inPacketsPerSecond); args["ChldAg"] = OSD.FromString (String.Format ("{0:0.##}", childAgents));
args["PktOut"] = OSD.FromReal(outPacketsPerSecond); args["Prims"] = OSD.FromString (String.Format ("{0:0.##}", totalPrims));
args["PendDl"] = OSD.FromReal(pendingDownloads); args["AtvPrm"] = OSD.FromString (String.Format ("{0:0.##}", activePrims));
args["PendUl"] = OSD.FromReal(pendingUploads); args["AtvScr"] = OSD.FromString (String.Format ("{0:0.##}", activeScripts));
args["UnackB"] = OSD.FromReal(unackedBytes); args["ScrLPS"] = OSD.FromString (String.Format ("{0:0.##}", scriptLinesPerSecond));
args["TotlFt"] = OSD.FromReal(totalFrameTime); args["PktsIn"] = OSD.FromString (String.Format ("{0:0.##}", inPacketsPerSecond));
args["NetFt"] = OSD.FromReal(netFrameTime); args["PktOut"] = OSD.FromString (String.Format ("{0:0.##}", outPacketsPerSecond));
args["PhysFt"] = OSD.FromReal(physicsFrameTime); args["PendDl"] = OSD.FromString (String.Format ("{0:0.##}", pendingDownloads));
args["OthrFt"] = OSD.FromReal(otherFrameTime); args["PendUl"] = OSD.FromString (String.Format ("{0:0.##}", pendingUploads));
args["AgntFt"] = OSD.FromReal(agentFrameTime); args["UnackB"] = OSD.FromString (String.Format ("{0:0.##}", unackedBytes));
args["ImgsFt"] = OSD.FromReal(imageFrameTime); args["TotlFt"] = OSD.FromString (String.Format ("{0:0.##}", totalFrameTime));
args["Memory"] = OSD.FromString(base.XReport(uptime, version)); args["NetFt"] = OSD.FromString (String.Format ("{0:0.##}", netFrameTime));
args["Uptime"] = OSD.FromString(uptime); args["PhysFt"] = OSD.FromString (String.Format ("{0:0.##}", physicsFrameTime));
args["Version"] = OSD.FromString(version); args["OthrFt"] = OSD.FromString (String.Format ("{0:0.##}", otherFrameTime));
args["AgntFt"] = OSD.FromString (String.Format ("{0:0.##}", agentFrameTime));
args["ImgsFt"] = OSD.FromString (String.Format ("{0:0.##}", imageFrameTime));
args["Memory"] = OSD.FromString (base.XReport (uptime, version));
args["Uptime"] = OSD.FromString (uptime);
args["Version"] = OSD.FromString (version);
string strBuffer = ""; string strBuffer = "";
strBuffer = OSDParser.SerializeJsonString(args); strBuffer = OSDParser.SerializeJsonString(args);

View File

@ -741,7 +741,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
public void TestMergeIarPath() public void TestMergeIarPath()
{ {
TestHelper.InMethod(); TestHelper.InMethod();
log4net.Config.XmlConfigurator.Configure(); // log4net.Config.XmlConfigurator.Configure();
Scene scene = SceneSetupHelpers.SetupScene("inventory"); Scene scene = SceneSetupHelpers.SetupScene("inventory");
UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene); UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene);

View File

@ -233,6 +233,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
return m_GridService.GetFallbackRegions(scopeID, x, y); return m_GridService.GetFallbackRegions(scopeID, x, y);
} }
public List<GridRegion> GetHyperlinks(UUID scopeID)
{
return m_GridService.GetHyperlinks(scopeID);
}
public int GetRegionFlags(UUID scopeID, UUID regionID) public int GetRegionFlags(UUID scopeID, UUID regionID)
{ {
return m_GridService.GetRegionFlags(scopeID, regionID); return m_GridService.GetRegionFlags(scopeID, regionID);

View File

@ -136,6 +136,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests
900 * (int)Constants.RegionSize, 1100 * (int)Constants.RegionSize); 900 * (int)Constants.RegionSize, 1100 * (int)Constants.RegionSize);
Assert.IsNotNull(results, "Retrieved GetRegionRange list is null"); Assert.IsNotNull(results, "Retrieved GetRegionRange list is null");
Assert.That(results.Count, Is.EqualTo(2), "Retrieved neighbour collection is not the number expected"); Assert.That(results.Count, Is.EqualTo(2), "Retrieved neighbour collection is not the number expected");
results = m_LocalConnector.GetHyperlinks(UUID.Zero);
Assert.IsNotNull(results, "Retrieved GetHyperlinks list is null");
Assert.That(results.Count, Is.EqualTo(0), "Retrieved linked regions collection is not the number expected");
} }
} }
} }

View File

@ -1824,6 +1824,8 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="originalPrim"></param> /// <param name="originalPrim"></param>
/// <param name="offset"></param> /// <param name="offset"></param>
/// <param name="flags"></param> /// <param name="flags"></param>
/// <param name="AgentID"></param>
/// <param name="GroupID"></param>
protected internal void DuplicateObject(uint originalPrim, Vector3 offset, uint flags, UUID AgentID, UUID GroupID) protected internal void DuplicateObject(uint originalPrim, Vector3 offset, uint flags, UUID AgentID, UUID GroupID)
{ {
//m_log.DebugFormat("[SCENE]: Duplication of object {0} at offset {1} requested by agent {2}", originalPrim, offset, AgentID); //m_log.DebugFormat("[SCENE]: Duplication of object {0} at offset {1} requested by agent {2}", originalPrim, offset, AgentID);
@ -1838,7 +1840,10 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="originalPrim"></param> /// <param name="originalPrim"></param>
/// <param name="offset"></param> /// <param name="offset"></param>
/// <param name="flags"></param> /// <param name="flags"></param>
protected internal SceneObjectGroup DuplicateObject(uint originalPrimID, Vector3 offset, uint flags, UUID AgentID, UUID GroupID, Quaternion rot) /// <param name="AgentID"></param>
/// <param name="GroupID"></param>
/// <param name="rot"></param>
public SceneObjectGroup DuplicateObject(uint originalPrimID, Vector3 offset, uint flags, UUID AgentID, UUID GroupID, Quaternion rot)
{ {
//m_log.DebugFormat("[SCENE]: Duplication of object {0} at offset {1} requested by agent {2}", originalPrim, offset, AgentID); //m_log.DebugFormat("[SCENE]: Duplication of object {0} at offset {1} requested by agent {2}", originalPrim, offset, AgentID);
SceneObjectGroup original = GetGroupByPrim(originalPrimID); SceneObjectGroup original = GetGroupByPrim(originalPrimID);

View File

@ -1182,6 +1182,10 @@ namespace OpenSim.Region.Framework.Scenes
set { _nextOwnerMask = value; } set { _nextOwnerMask = value; }
} }
/// <summary>
/// Property flags. See OpenMetaverse.PrimFlags
/// </summary>
/// Example properties are PrimFlags.Phantom and PrimFlags.DieAtEdge
public PrimFlags Flags public PrimFlags Flags
{ {
get { return _flags; } get { return _flags; }

View File

@ -1,4 +1,4 @@
/* /*
* Copyright (c) Contributors, http://opensimulator.org/ * Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
@ -26,61 +26,46 @@
*/ */
using System; using System;
using System.Reflection;
using NUnit.Framework; using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;
using OpenMetaverse; using OpenMetaverse;
using OpenSim.Framework; using OpenSim.Framework;
using GridRegion = OpenSim.Services.Interfaces.GridRegion; using OpenSim.Framework.Communications;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Mock;
using OpenSim.Tests.Common.Setup;
namespace OpenSim.Region.Framework.Scenes.Tests namespace OpenSim.Region.Framework.Scenes.Tests
{ {
/// <summary>
/// Scene presence tests
/// </summary>
[TestFixture] [TestFixture]
public class SceneBaseTests public class SceneGraphTests
{ {
private class SceneBaseImpl : SceneBase
{
public override void Update()
{
throw new NotImplementedException();
}
public override void LoadWorldMap()
{
throw new NotImplementedException();
}
public override void AddNewClient(IClientAPI client)
{
throw new NotImplementedException();
}
public override void RemoveClient(UUID agentID)
{
throw new NotImplementedException();
}
public override void OtherRegionUp(GridRegion otherRegion)
{
throw new NotImplementedException();
}
public override bool TryGetScenePresence(UUID agentID, out ScenePresence scenePresence)
{
throw new NotImplementedException();
}
public override bool CheckClient(UUID agentID, System.Net.IPEndPoint ep)
{
throw new NotImplementedException();
}
}
[Test] [Test]
public void TestConstructor() public void TestDuplicateObject()
{ {
new SceneBaseImpl(); TestHelper.InMethod();
Scene scene = SceneSetupHelpers.SetupScene();
UUID ownerUuid = new UUID("00000000-0000-0000-0000-000000000010");
string objName = "obj1";
UUID objUuid = new UUID("00000000-0000-0000-0000-000000000001");
SceneObjectPart part
= new SceneObjectPart(ownerUuid, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
{ Name = objName, UUID = objUuid };
scene.AddNewSceneObject(new SceneObjectGroup(part), false);
SceneObjectGroup duplicatedSo
= scene.SceneGraph.DuplicateObject(
part.LocalId, new Vector3(10, 0, 0), 0, ownerUuid, UUID.Zero, Quaternion.Identity);
Assert.That(duplicatedSo.Children.Count, Is.EqualTo(1));
Assert.That(duplicatedSo.RootPart.LocalId, Is.Not.EqualTo(part.LocalId));
//SceneObjectPart retrievedPart = scene.GetSceneObjectPart(objUuid);
} }
} }
} }

View File

@ -32,7 +32,6 @@ using NUnit.Framework.SyntaxHelpers;
using OpenMetaverse; using OpenMetaverse;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Communications; using OpenSim.Framework.Communications;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using OpenSim.Tests.Common; using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Mock; using OpenSim.Tests.Common.Mock;

View File

@ -1,147 +0,0 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using NUnit.Framework;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces;
namespace OpenSim.Region.Framework.Scenes.Tests
{
/// <summary>
/// Scene presence tests
/// </summary>
[TestFixture]
public class SceneTests
{
private class FakeStorageManager : StorageManager
{
private class FakeRegionDataStore : IRegionDataStore
{
public void Initialise(string filename)
{
}
public void Dispose()
{
}
public void StoreObject(SceneObjectGroup obj, UUID regionUUID)
{
throw new NotImplementedException();
}
public void RemoveObject(UUID uuid, UUID regionUUID)
{
throw new NotImplementedException();
}
public void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items)
{
throw new NotImplementedException();
}
public List<SceneObjectGroup> LoadObjects(UUID regionUUID)
{
throw new NotImplementedException();
}
public void StoreTerrain(double[,] terrain, UUID regionID)
{
throw new NotImplementedException();
}
public double[,] LoadTerrain(UUID regionID)
{
throw new NotImplementedException();
}
public void StoreLandObject(ILandObject Parcel)
{
throw new NotImplementedException();
}
public void RemoveLandObject(UUID globalID)
{
throw new NotImplementedException();
}
public List<LandData> LoadLandObjects(UUID regionUUID)
{
throw new NotImplementedException();
}
public void StoreRegionSettings(RegionSettings rs)
{
throw new NotImplementedException();
}
public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID)
{
//This connector doesn't support the windlight module yet
//Return default LL windlight settings
return new RegionLightShareData();
}
public void StoreRegionWindlightSettings(RegionLightShareData wl)
{
//This connector doesn't support the windlight module yet
}
public RegionSettings LoadRegionSettings(UUID regionUUID)
{
return null;
}
public void Shutdown()
{
throw new NotImplementedException();
}
}
public FakeStorageManager() : base(new FakeRegionDataStore())
{
}
public FakeStorageManager(IRegionDataStore storage) : this()
{
}
public FakeStorageManager(string dllName, string connectionstring, string estateconnectionstring) : this()
{
}
}
[Test]
public void TestConstructor()
{
RegionInfo regionInfo = new RegionInfo(0,0,null,null);
FakeStorageManager storageManager = new FakeStorageManager();
new Scene(regionInfo, null, null, storageManager, null, false, false, false, null, null);
}
}
}

View File

@ -109,6 +109,9 @@ namespace OpenSim.Server.Handlers.Grid
case "get_fallback_regions": case "get_fallback_regions":
return GetFallbackRegions(request); return GetFallbackRegions(request);
case "get_hyperlinks":
return GetHyperlinks(request);
case "get_region_flags": case "get_region_flags":
return GetRegionFlags(request); return GetRegionFlags(request);
} }
@ -483,6 +486,36 @@ namespace OpenSim.Server.Handlers.Grid
return encoding.GetBytes(xmlString); return encoding.GetBytes(xmlString);
} }
byte[] GetHyperlinks(Dictionary<string, object> request)
{
//m_log.DebugFormat("[GRID HANDLER]: GetHyperlinks");
UUID scopeID = UUID.Zero;
if (request.ContainsKey("SCOPEID"))
UUID.TryParse(request["SCOPEID"].ToString(), out scopeID);
else
m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get linked regions");
List<GridRegion> rinfos = m_GridService.GetHyperlinks(scopeID);
Dictionary<string, object> result = new Dictionary<string, object>();
if ((rinfos == null) || ((rinfos != null) && (rinfos.Count == 0)))
result["result"] = "null";
else
{
int i = 0;
foreach (GridRegion rinfo in rinfos)
{
Dictionary<string, object> rinfoDict = rinfo.ToKeyValuePairs();
result["region" + i] = rinfoDict;
i++;
}
}
string xmlString = ServerUtils.BuildXmlResponse(result);
//m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString);
UTF8Encoding encoding = new UTF8Encoding();
return encoding.GetBytes(xmlString);
}
byte[] GetRegionFlags(Dictionary<string, object> request) byte[] GetRegionFlags(Dictionary<string, object> request)
{ {
UUID scopeID = UUID.Zero; UUID scopeID = UUID.Zero;

View File

@ -556,6 +556,56 @@ namespace OpenSim.Services.Connectors
return rinfos; return rinfos;
} }
public List<GridRegion> GetHyperlinks(UUID scopeID)
{
Dictionary<string, object> sendData = new Dictionary<string, object>();
sendData["SCOPEID"] = scopeID.ToString();
sendData["METHOD"] = "get_hyperlinks";
List<GridRegion> rinfos = new List<GridRegion>();
string reply = string.Empty;
try
{
reply = SynchronousRestFormsRequester.MakeRequest("POST",
m_ServerURI + "/grid",
ServerUtils.BuildQueryString(sendData));
//m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply);
}
catch (Exception e)
{
m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server: {0}", e.Message);
return rinfos;
}
if (reply != string.Empty)
{
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
if (replyData != null)
{
Dictionary<string, object>.ValueCollection rinfosList = replyData.Values;
foreach (object r in rinfosList)
{
if (r is Dictionary<string, object>)
{
GridRegion rinfo = new GridRegion((Dictionary<string, object>)r);
rinfos.Add(rinfo);
}
}
}
else
m_log.DebugFormat("[GRID CONNECTOR]: GetHyperlinks {0} received null response",
scopeID);
}
else
m_log.DebugFormat("[GRID CONNECTOR]: GetHyperlinks received null reply");
return rinfos;
}
public virtual int GetRegionFlags(UUID scopeID, UUID regionID) public virtual int GetRegionFlags(UUID scopeID, UUID regionID)
{ {
Dictionary<string, object> sendData = new Dictionary<string, object>(); Dictionary<string, object> sendData = new Dictionary<string, object>();

View File

@ -359,6 +359,12 @@ namespace OpenSim.Services.Connectors.SimianGrid
return new List<GridRegion>(0); return new List<GridRegion>(0);
} }
public List<GridRegion> GetHyperlinks(UUID scopeID)
{
// Hypergrid/linked regions are not supported
return new List<GridRegion>();
}
public int GetRegionFlags(UUID scopeID, UUID regionID) public int GetRegionFlags(UUID scopeID, UUID regionID)
{ {
const int REGION_ONLINE = 4; const int REGION_ONLINE = 4;

View File

@ -426,6 +426,22 @@ namespace OpenSim.Services.GridService
return ret; return ret;
} }
public List<GridRegion> GetHyperlinks(UUID scopeID)
{
List<GridRegion> ret = new List<GridRegion>();
List<RegionData> regions = m_Database.GetHyperlinks(scopeID);
foreach (RegionData r in regions)
{
if ((Convert.ToInt32(r.Data["flags"]) & (int)OpenSim.Data.RegionFlags.RegionOnline) != 0)
ret.Add(RegionData2RegionInfo(r));
}
m_log.DebugFormat("[GRID SERVICE]: Hyperlinks returned {0} regions", ret.Count);
return ret;
}
public int GetRegionFlags(UUID scopeID, UUID regionID) public int GetRegionFlags(UUID scopeID, UUID regionID)
{ {
RegionData region = m_Database.Get(regionID, scopeID); RegionData region = m_Database.Get(regionID, scopeID);

View File

@ -62,6 +62,7 @@ namespace OpenSim.Services.GridService
protected GatekeeperServiceConnector m_GatekeeperConnector; protected GatekeeperServiceConnector m_GatekeeperConnector;
protected UUID m_ScopeID = UUID.Zero; protected UUID m_ScopeID = UUID.Zero;
protected bool m_Check4096 = true;
// Hyperlink regions are hyperlinks on the map // Hyperlink regions are hyperlinks on the map
public readonly Dictionary<UUID, GridRegion> m_HyperlinkRegions = new Dictionary<UUID, GridRegion>(); public readonly Dictionary<UUID, GridRegion> m_HyperlinkRegions = new Dictionary<UUID, GridRegion>();
@ -116,6 +117,8 @@ namespace OpenSim.Services.GridService
if (scope != string.Empty) if (scope != string.Empty)
UUID.TryParse(scope, out m_ScopeID); UUID.TryParse(scope, out m_ScopeID);
m_Check4096 = gridConfig.GetBoolean("Check4096", true);
m_GatekeeperConnector = new GatekeeperServiceConnector(m_AssetService); m_GatekeeperConnector = new GatekeeperServiceConnector(m_AssetService);
m_log.DebugFormat("[HYPERGRID LINKER]: Loaded all services..."); m_log.DebugFormat("[HYPERGRID LINKER]: Loaded all services...");
@ -277,7 +280,7 @@ namespace OpenSim.Services.GridService
} }
uint x, y; uint x, y;
if (!Check4096(handle, out x, out y)) if (m_Check4096 && !Check4096(handle, out x, out y))
{ {
RemoveHyperlinkRegion(regInfo.RegionID); RemoveHyperlinkRegion(regInfo.RegionID);
reason = "Region is too far (" + x + ", " + y + ")"; reason = "Region is too far (" + x + ", " + y + ")";
@ -332,18 +335,50 @@ namespace OpenSim.Services.GridService
/// <returns></returns> /// <returns></returns>
public bool Check4096(ulong realHandle, out uint x, out uint y) public bool Check4096(ulong realHandle, out uint x, out uint y)
{ {
GridRegion defRegion = DefaultRegion;
uint ux = 0, uy = 0; uint ux = 0, uy = 0;
Utils.LongToUInts(realHandle, out ux, out uy); Utils.LongToUInts(realHandle, out ux, out uy);
x = ux / Constants.RegionSize; x = ux / Constants.RegionSize;
y = uy / Constants.RegionSize; y = uy / Constants.RegionSize;
if ((Math.Abs((int)defRegion.RegionLocX - ux) >= 4096 * Constants.RegionSize) || const uint limit = (4096 - 1) * Constants.RegionSize;
(Math.Abs((int)defRegion.RegionLocY - uy) >= 4096 * Constants.RegionSize)) uint xmin = ux - limit;
uint xmax = ux + limit;
uint ymin = uy - limit;
uint ymax = uy + limit;
// World map boundary checks
if (xmin < 0 || xmin > ux)
xmin = 0;
if (xmax > int.MaxValue || xmax < ux)
xmax = int.MaxValue;
if (ymin < 0 || ymin > uy)
ymin = 0;
if (ymax > int.MaxValue || ymax < uy)
ymax = int.MaxValue;
// Check for any regions that are within the possible teleport range to the linked region
List<GridRegion> regions = m_GridService.GetRegionRange(m_ScopeID, (int)xmin, (int)xmax, (int)ymin, (int)ymax);
if (regions.Count == 0)
{ {
return false; return false;
} }
else
{
// 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)
return false;
}
return true; return true;
} }

View File

@ -92,6 +92,7 @@ namespace OpenSim.Services.Interfaces
List<GridRegion> GetDefaultRegions(UUID scopeID); List<GridRegion> GetDefaultRegions(UUID scopeID);
List<GridRegion> GetFallbackRegions(UUID scopeID, int x, int y); List<GridRegion> GetFallbackRegions(UUID scopeID, int x, int y);
List<GridRegion> GetHyperlinks(UUID scopeID);
int GetRegionFlags(UUID scopeID, UUID regionID); int GetRegionFlags(UUID scopeID, UUID regionID);
} }

View File

@ -54,6 +54,8 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003
LocalServiceModule = "OpenSim.Services.GridService.dll:GridService" LocalServiceModule = "OpenSim.Services.GridService.dll:GridService"
Realm = "regions" Realm = "regions"
; AllowDuplicateNames = "True" ; AllowDuplicateNames = "True"
; Check4096 = "False"
;; Next, we can specify properties of regions, including default and fallback regions ;; Next, we can specify properties of regions, including default and fallback regions
;; The syntax is: Region_<RegionName> = "<flags>" ;; The syntax is: Region_<RegionName> = "<flags>"
;; or: Region_<RegionID> = "<flags>" ;; or: Region_<RegionID> = "<flags>"

View File

@ -48,6 +48,9 @@
;;--- For MySql region storage (alternative) ;;--- For MySql region storage (alternative)
;StorageProvider = "OpenSim.Data.MySQL.dll:MySqlRegionData" ;StorageProvider = "OpenSim.Data.MySQL.dll:MySqlRegionData"
; If HG, do you want this check on the distance to be performed?
; Check4096 = "False"
;; Next, we can specify properties of regions, including default and fallback regions ;; Next, we can specify properties of regions, including default and fallback regions
;; The syntax is: Region_<RegioName> = "<flags>" ;; The syntax is: Region_<RegioName> = "<flags>"
;; where <flags> can be DefaultRegion, FallbackRegion, NoDirectLogin, Persistent, LockedOut ;; where <flags> can be DefaultRegion, FallbackRegion, NoDirectLogin, Persistent, LockedOut

View File

@ -2950,6 +2950,7 @@
<ReferencePath>../../../bin/</ReferencePath> <ReferencePath>../../../bin/</ReferencePath>
<Reference name="System"/> <Reference name="System"/>
<Reference name="System.Core"/>
<Reference name="System.Xml"/> <Reference name="System.Xml"/>
<Reference name="System.Drawing"/> <Reference name="System.Drawing"/>
<Reference name="OpenMetaverseTypes.dll"/> <Reference name="OpenMetaverseTypes.dll"/>