From 236906364071712a2ad0a65d128958abeddc4b1b Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 6 Aug 2010 10:57:52 -0700 Subject: HACK ALERT! There's some underlying bug in the HTTP server that makes requests come up with Accept headers from previous requests. Until that gets fixed, this hack goes in. --- OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'OpenSim') diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index ffa30d5..016ab73 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -319,6 +319,13 @@ namespace OpenSim.Framework.Servers.HttpServer OSHttpRequest req = new OSHttpRequest(context, request); OSHttpResponse resp = new OSHttpResponse(new HttpResponse(context, request),context); 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) -- cgit v1.1 From 85d7d0583ea90c0044f823a665d2bf99abee6df8 Mon Sep 17 00:00:00 2001 From: BlueWall (James Hughes) Date: Tue, 3 Aug 2010 01:49:27 -0400 Subject: Fix XStats formatting: Recent libomv update broke the json serialization for XStats. This uses String.Format to convert all data to strings with fixed decimal (2 places ), or integer formats as appropriate. --- .../Framework/Statistics/SimExtraStatsCollector.cs | 65 ++++++++++++---------- 1 file changed, 35 insertions(+), 30 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/Statistics/SimExtraStatsCollector.cs b/OpenSim/Framework/Statistics/SimExtraStatsCollector.cs index 3619606..5449757 100644 --- a/OpenSim/Framework/Statistics/SimExtraStatsCollector.cs +++ b/OpenSim/Framework/Statistics/SimExtraStatsCollector.cs @@ -390,36 +390,41 @@ Asset service request failures: {3}" + Environment.NewLine, public override string XReport(string uptime, string version) { OSDMap args = new OSDMap(30); - args["AssetsInCache"] = OSD.FromReal(AssetsInCache); - args["TimeAfterCacheMiss"] = OSD.FromReal(assetRequestTimeAfterCacheMiss.Milliseconds / 1000.0); - args["BlockedMissingTextureRequests"] = OSD.FromReal(BlockedMissingTextureRequests); - args["AssetServiceRequestFailures"] = OSD.FromReal(AssetServiceRequestFailures); - args["abnormalClientThreadTerminations"] = OSD.FromReal(abnormalClientThreadTerminations); - args["InventoryServiceRetrievalFailures"] = OSD.FromReal(InventoryServiceRetrievalFailures); - args["Dilatn"] = OSD.FromReal(timeDilation); - args["SimFPS"] = OSD.FromReal(simFps); - args["PhyFPS"] = OSD.FromReal(physicsFps); - args["AgntUp"] = OSD.FromReal(agentUpdates); - args["RootAg"] = OSD.FromReal(rootAgents); - args["ChldAg"] = OSD.FromReal(childAgents); - args["Prims"] = OSD.FromReal(totalPrims); - args["AtvPrm"] = OSD.FromReal(activePrims); - args["AtvScr"] = OSD.FromReal(activeScripts); - args["ScrLPS"] = OSD.FromReal(scriptLinesPerSecond); - args["PktsIn"] = OSD.FromReal(inPacketsPerSecond); - args["PktOut"] = OSD.FromReal(outPacketsPerSecond); - args["PendDl"] = OSD.FromReal(pendingDownloads); - args["PendUl"] = OSD.FromReal(pendingUploads); - args["UnackB"] = OSD.FromReal(unackedBytes); - args["TotlFt"] = OSD.FromReal(totalFrameTime); - args["NetFt"] = OSD.FromReal(netFrameTime); - args["PhysFt"] = OSD.FromReal(physicsFrameTime); - args["OthrFt"] = OSD.FromReal(otherFrameTime); - args["AgntFt"] = OSD.FromReal(agentFrameTime); - args["ImgsFt"] = OSD.FromReal(imageFrameTime); - args["Memory"] = OSD.FromString(base.XReport(uptime, version)); - args["Uptime"] = OSD.FromString(uptime); - args["Version"] = OSD.FromString(version); + args["AssetsInCache"] = OSD.FromString (String.Format ("{0:0.##}", AssetsInCache)); + args["TimeAfterCacheMiss"] = OSD.FromString (String.Format ("{0:0.##}", + assetRequestTimeAfterCacheMiss.Milliseconds / 1000.0)); + args["BlockedMissingTextureRequests"] = OSD.FromString (String.Format ("{0:0.##}", + BlockedMissingTextureRequests)); + args["AssetServiceRequestFailures"] = OSD.FromString (String.Format ("{0:0.##}", + AssetServiceRequestFailures)); + args["abnormalClientThreadTerminations"] = OSD.FromString (String.Format ("{0:0.##}", + abnormalClientThreadTerminations)); + args["InventoryServiceRetrievalFailures"] = OSD.FromString (String.Format ("{0:0.##}", + InventoryServiceRetrievalFailures)); + args["Dilatn"] = OSD.FromString (String.Format ("{0:0.##}", timeDilation)); + args["SimFPS"] = OSD.FromString (String.Format ("{0:0.##}", simFps)); + args["PhyFPS"] = OSD.FromString (String.Format ("{0:0.##}", physicsFps)); + args["AgntUp"] = OSD.FromString (String.Format ("{0:0.##}", agentUpdates)); + args["RootAg"] = OSD.FromString (String.Format ("{0:0.##}", rootAgents)); + args["ChldAg"] = OSD.FromString (String.Format ("{0:0.##}", childAgents)); + args["Prims"] = OSD.FromString (String.Format ("{0:0.##}", totalPrims)); + args["AtvPrm"] = OSD.FromString (String.Format ("{0:0.##}", activePrims)); + args["AtvScr"] = OSD.FromString (String.Format ("{0:0.##}", activeScripts)); + args["ScrLPS"] = OSD.FromString (String.Format ("{0:0.##}", scriptLinesPerSecond)); + args["PktsIn"] = OSD.FromString (String.Format ("{0:0.##}", inPacketsPerSecond)); + args["PktOut"] = OSD.FromString (String.Format ("{0:0.##}", outPacketsPerSecond)); + args["PendDl"] = OSD.FromString (String.Format ("{0:0.##}", pendingDownloads)); + args["PendUl"] = OSD.FromString (String.Format ("{0:0.##}", pendingUploads)); + args["UnackB"] = OSD.FromString (String.Format ("{0:0.##}", unackedBytes)); + args["TotlFt"] = OSD.FromString (String.Format ("{0:0.##}", totalFrameTime)); + args["NetFt"] = OSD.FromString (String.Format ("{0:0.##}", netFrameTime)); + args["PhysFt"] = OSD.FromString (String.Format ("{0:0.##}", physicsFrameTime)); + 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 = ""; strBuffer = OSDParser.SerializeJsonString(args); -- cgit v1.1 From 6c8c8d669b3adb2c47429341f1a28fc7c4803c81 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 7 Aug 2010 00:45:04 +0100 Subject: minor: a few miscellaneous comments --- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 5 +++++ OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 4 ++++ 2 files changed, 9 insertions(+) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index f47450f..03549d7 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -1720,6 +1720,8 @@ namespace OpenSim.Region.Framework.Scenes /// /// /// + /// + /// 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); @@ -1734,6 +1736,9 @@ namespace OpenSim.Region.Framework.Scenes /// /// /// + /// + /// + /// protected internal 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); diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 3dac0ad..0c35eec 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1162,6 +1162,10 @@ namespace OpenSim.Region.Framework.Scenes set { _nextOwnerMask = value; } } + /// + /// Property flags. See OpenMetaverse.PrimFlags + /// + /// Example properties are PrimFlags.Phantom and PrimFlags.DieAtEdge public PrimFlags Flags { get { return _flags; } -- cgit v1.1 From 8d520f4525ffafc6cecacea5e88eea524226a70f Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 7 Aug 2010 00:50:01 +0100 Subject: Remove old test classes that don't actually test anything not done elsewhere Also comment out log4net line in InventoryArchiverTests --- .../Archiver/Tests/InventoryArchiverTests.cs | 2 +- .../Framework/Scenes/Tests/SceneBaseTests.cs | 86 ------------ .../Region/Framework/Scenes/Tests/SceneTests.cs | 147 --------------------- 3 files changed, 1 insertion(+), 234 deletions(-) delete mode 100644 OpenSim/Region/Framework/Scenes/Tests/SceneBaseTests.cs delete mode 100644 OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index 2d80382..3fb2c8c 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs @@ -741,7 +741,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests public void TestMergeIarPath() { TestHelper.InMethod(); - log4net.Config.XmlConfigurator.Configure(); +// log4net.Config.XmlConfigurator.Configure(); Scene scene = SceneSetupHelpers.SetupScene("inventory"); UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene); diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneBaseTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneBaseTests.cs deleted file mode 100644 index 42587c1..0000000 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneBaseTests.cs +++ /dev/null @@ -1,86 +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 NUnit.Framework; -using OpenMetaverse; -using OpenSim.Framework; -using GridRegion = OpenSim.Services.Interfaces.GridRegion; - -namespace OpenSim.Region.Framework.Scenes.Tests -{ - /// - /// Scene presence tests - /// - [TestFixture] - public class SceneBaseTests - { - 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] - public void TestConstructor() - { - new SceneBaseImpl(); - } - } -} diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs deleted file mode 100644 index 8b2d387..0000000 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs +++ /dev/null @@ -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 -{ - /// - /// Scene presence tests - /// - [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 items) - { - throw new NotImplementedException(); - } - - public List 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 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); - } - } -} -- cgit v1.1 From 7e47ab746ef588648b8edbbc7cfb48c4d90c5e34 Mon Sep 17 00:00:00 2001 From: Marck Date: Fri, 6 Aug 2010 07:46:19 +0200 Subject: Allow creation of link regions if there is an existing region within a 4096 range. Also add GetHyperlinks() to the grid service. --- .../Grid/LocalGridServiceConnector.cs | 5 +++ .../Grid/Tests/GridConnectorsTests.cs | 5 +++ .../Server/Handlers/Grid/GridServerPostHandler.cs | 33 ++++++++++++++ .../Connectors/Grid/GridServiceConnector.cs | 50 ++++++++++++++++++++++ .../SimianGrid/SimianGridServiceConnector.cs | 6 +++ OpenSim/Services/GridService/GridService.cs | 16 +++++++ OpenSim/Services/GridService/HypergridLinker.cs | 34 +++++++++++++-- OpenSim/Services/Interfaces/IGridService.cs | 1 + 8 files changed, 146 insertions(+), 4 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs index b2e3f4f..9ea04d4 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs @@ -233,6 +233,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid return m_GridService.GetFallbackRegions(scopeID, x, y); } + public List GetHyperlinks(UUID scopeID) + { + return m_GridService.GetHyperlinks(scopeID); + } + public int GetRegionFlags(UUID scopeID, UUID regionID) { return m_GridService.GetRegionFlags(scopeID, regionID); diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs index 95d8737..1366980 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs @@ -136,6 +136,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests 900 * (int)Constants.RegionSize, 1100 * (int)Constants.RegionSize); Assert.IsNotNull(results, "Retrieved GetRegionRange list is null"); 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"); + } } } diff --git a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs index c90dd6f..913c6c9 100644 --- a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs @@ -109,6 +109,9 @@ namespace OpenSim.Server.Handlers.Grid case "get_fallback_regions": return GetFallbackRegions(request); + case "get_hyperlinks": + return GetHyperlinks(request); + case "get_region_flags": return GetRegionFlags(request); } @@ -483,6 +486,36 @@ namespace OpenSim.Server.Handlers.Grid return encoding.GetBytes(xmlString); } + byte[] GetHyperlinks(Dictionary 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 rinfos = m_GridService.GetHyperlinks(scopeID); + + Dictionary result = new Dictionary(); + if ((rinfos == null) || ((rinfos != null) && (rinfos.Count == 0))) + result["result"] = "null"; + else + { + int i = 0; + foreach (GridRegion rinfo in rinfos) + { + Dictionary 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 request) { UUID scopeID = UUID.Zero; diff --git a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs index 1831533..202bad7 100644 --- a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs +++ b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs @@ -556,6 +556,56 @@ namespace OpenSim.Services.Connectors return rinfos; } + public List GetHyperlinks(UUID scopeID) + { + Dictionary sendData = new Dictionary(); + + sendData["SCOPEID"] = scopeID.ToString(); + + sendData["METHOD"] = "get_hyperlinks"; + + List rinfos = new List(); + 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 replyData = ServerUtils.ParseXmlResponse(reply); + + if (replyData != null) + { + Dictionary.ValueCollection rinfosList = replyData.Values; + foreach (object r in rinfosList) + { + if (r is Dictionary) + { + GridRegion rinfo = new GridRegion((Dictionary)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) { Dictionary sendData = new Dictionary(); diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs index bea8172..7bc85c6 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs @@ -357,6 +357,12 @@ namespace OpenSim.Services.Connectors.SimianGrid return new List(0); } + public List GetHyperlinks(UUID scopeID) + { + // Hypergrid/linked regions are not supported + return new List(); + } + public int GetRegionFlags(UUID scopeID, UUID regionID) { const int REGION_ONLINE = 4; diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index ebaed42..79a45fe 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -426,6 +426,22 @@ namespace OpenSim.Services.GridService return ret; } + public List GetHyperlinks(UUID scopeID) + { + List ret = new List(); + + List 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) { RegionData region = m_Database.Get(regionID, scopeID); diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 1f53007..017df41 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -27,6 +27,7 @@ using System; using System.Collections.Generic; +using System.Linq; using System.Net; using System.Reflection; using System.Xml; @@ -332,18 +333,43 @@ namespace OpenSim.Services.GridService /// public bool Check4096(ulong realHandle, out uint x, out uint y) { - GridRegion defRegion = DefaultRegion; - uint ux = 0, uy = 0; Utils.LongToUInts(realHandle, out ux, out uy); x = ux / Constants.RegionSize; y = uy / Constants.RegionSize; - if ((Math.Abs((int)defRegion.RegionLocX - ux) >= 4096 * Constants.RegionSize) || - (Math.Abs((int)defRegion.RegionLocY - uy) >= 4096 * Constants.RegionSize)) + const uint limit = (4096 - 1) * 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 regions = m_GridService.GetRegionRange(m_ScopeID, (int)xmin, (int)xmax, (int)ymin, (int)ymax); + if (regions.Count == 0) + { + return false; + } + else + { + // Check for regions which are not linked regions + List hyperlinks = m_GridService.GetHyperlinks(m_ScopeID); + IEnumerable availableRegions = regions.Except(hyperlinks); + if (availableRegions.Count() == 0) { return false; } + } + return true; } diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs index e55b633..77230a3 100644 --- a/OpenSim/Services/Interfaces/IGridService.cs +++ b/OpenSim/Services/Interfaces/IGridService.cs @@ -92,6 +92,7 @@ namespace OpenSim.Services.Interfaces List GetDefaultRegions(UUID scopeID); List GetFallbackRegions(UUID scopeID, int x, int y); + List GetHyperlinks(UUID scopeID); int GetRegionFlags(UUID scopeID, UUID regionID); } -- cgit v1.1 From 4e2caab756e1b7ebd58682efe92401e2e2d5a917 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 7 Aug 2010 01:06:47 +0100 Subject: Add new SceneGraphTests class. Add simple TestDuplicateObject() --- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 2 +- .../Framework/Scenes/Tests/SceneGraphTests.cs | 71 ++++++++++++++++++++++ .../Scenes/Tests/SceneObjectBasicTests.cs | 1 - 3 files changed, 72 insertions(+), 2 deletions(-) create mode 100644 OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 03549d7..9f38a99 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -1739,7 +1739,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// /// - protected internal SceneObjectGroup DuplicateObject(uint originalPrimID, Vector3 offset, uint flags, UUID AgentID, UUID GroupID, Quaternion rot) + 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); SceneObjectGroup original = GetGroupByPrim(originalPrimID); diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs new file mode 100644 index 0000000..8a103d7 --- /dev/null +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs @@ -0,0 +1,71 @@ +/* + * 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.Reflection; +using NUnit.Framework; +using NUnit.Framework.SyntaxHelpers; +using OpenMetaverse; +using OpenSim.Framework; +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 +{ + [TestFixture] + public class SceneGraphTests + { + [Test] + public void TestDuplicateObject() + { + 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); + } + } +} \ No newline at end of file diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs index 4baa22c..d4f9f18 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs @@ -32,7 +32,6 @@ using NUnit.Framework.SyntaxHelpers; using OpenMetaverse; using OpenSim.Framework; using OpenSim.Framework.Communications; - using OpenSim.Region.Framework.Scenes; using OpenSim.Tests.Common; using OpenSim.Tests.Common.Mock; -- cgit v1.1 From 009053479302e7581a85c7574a6cc8eaa23745d8 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 6 Aug 2010 17:43:09 -0700 Subject: Added Check4096 config var under [GridService], at the request of many. Changed the iteration that Marck had on the Hyperlinker. ATTENTION! CONFIGURATION CHANGE AFFECTING Robust.HG.ini.example and StandaloneCommon.ini.example. --- .../Grid/LocalGridServiceConnector.cs | 8 +- .../Grid/Tests/GridConnectorsTests.cs | 6 +- .../Connectors/Grid/GridServiceConnector.cs | 98 +++++++++++----------- .../SimianGrid/SimianGridServiceConnector.cs | 10 +-- OpenSim/Services/GridService/GridService.cs | 30 +++---- OpenSim/Services/GridService/HypergridLinker.cs | 23 +++-- 6 files changed, 92 insertions(+), 83 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs index 9ea04d4..023a44c 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs @@ -233,10 +233,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid return m_GridService.GetFallbackRegions(scopeID, x, y); } - public List GetHyperlinks(UUID scopeID) - { - return m_GridService.GetHyperlinks(scopeID); - } + public List GetHyperlinks(UUID scopeID) + { + return m_GridService.GetHyperlinks(scopeID); + } public int GetRegionFlags(UUID scopeID, UUID regionID) { diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs index 1366980..2726ae8 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs @@ -136,9 +136,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests 900 * (int)Constants.RegionSize, 1100 * (int)Constants.RegionSize); Assert.IsNotNull(results, "Retrieved GetRegionRange list is null"); 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"); + + 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"); } diff --git a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs index 202bad7..80f0d2d 100644 --- a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs +++ b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs @@ -556,55 +556,55 @@ namespace OpenSim.Services.Connectors return rinfos; } - public List GetHyperlinks(UUID scopeID) - { - Dictionary sendData = new Dictionary(); - - sendData["SCOPEID"] = scopeID.ToString(); - - sendData["METHOD"] = "get_hyperlinks"; - - List rinfos = new List(); - 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 replyData = ServerUtils.ParseXmlResponse(reply); - - if (replyData != null) - { - Dictionary.ValueCollection rinfosList = replyData.Values; - foreach (object r in rinfosList) - { - if (r is Dictionary) - { - GridRegion rinfo = new GridRegion((Dictionary)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 List GetHyperlinks(UUID scopeID) + { + Dictionary sendData = new Dictionary(); + + sendData["SCOPEID"] = scopeID.ToString(); + + sendData["METHOD"] = "get_hyperlinks"; + + List rinfos = new List(); + 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 replyData = ServerUtils.ParseXmlResponse(reply); + + if (replyData != null) + { + Dictionary.ValueCollection rinfosList = replyData.Values; + foreach (object r in rinfosList) + { + if (r is Dictionary) + { + GridRegion rinfo = new GridRegion((Dictionary)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) { diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs index 7bc85c6..fefdad6 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs @@ -357,11 +357,11 @@ namespace OpenSim.Services.Connectors.SimianGrid return new List(0); } - public List GetHyperlinks(UUID scopeID) - { - // Hypergrid/linked regions are not supported - return new List(); - } + public List GetHyperlinks(UUID scopeID) + { + // Hypergrid/linked regions are not supported + return new List(); + } public int GetRegionFlags(UUID scopeID, UUID regionID) { diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 79a45fe..ce6f64b 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -426,21 +426,21 @@ namespace OpenSim.Services.GridService return ret; } - public List GetHyperlinks(UUID scopeID) - { - List ret = new List(); - - List 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 List GetHyperlinks(UUID scopeID) + { + List ret = new List(); + + List 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) { diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 017df41..b190f93 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -27,7 +27,6 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Net; using System.Reflection; using System.Xml; @@ -63,6 +62,7 @@ namespace OpenSim.Services.GridService protected GatekeeperServiceConnector m_GatekeeperConnector; protected UUID m_ScopeID = UUID.Zero; + protected bool m_Check4096 = true; // Hyperlink regions are hyperlinks on the map public readonly Dictionary m_HyperlinkRegions = new Dictionary(); @@ -117,6 +117,8 @@ namespace OpenSim.Services.GridService if (scope != string.Empty) UUID.TryParse(scope, out m_ScopeID); + m_Check4096 = gridConfig.GetBoolean("Check4096", true); + m_GatekeeperConnector = new GatekeeperServiceConnector(m_AssetService); m_log.DebugFormat("[HYPERGRID LINKER]: Loaded all services..."); @@ -278,7 +280,7 @@ namespace OpenSim.Services.GridService } uint x, y; - if (!Check4096(handle, out x, out y)) + if (m_Check4096 && !Check4096(handle, out x, out y)) { RemoveHyperlinkRegion(regInfo.RegionID); reason = "Region is too far (" + x + ", " + y + ")"; @@ -363,11 +365,18 @@ namespace OpenSim.Services.GridService { // Check for regions which are not linked regions List hyperlinks = m_GridService.GetHyperlinks(m_ScopeID); - IEnumerable availableRegions = regions.Except(hyperlinks); - if (availableRegions.Count() == 0) - { - return false; - } + // would like to use .Except, but doesn't seem to exist + //IEnumerable availableRegions = regions.Except(hyperlinks); + List 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; -- cgit v1.1