From e7362738155c0a0a5c9ef8b867eb14b18bb31a44 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 18 Sep 2009 19:16:30 -0700 Subject: First pass at the grid service. --- OpenSim/Services/GridService/GridService.cs | 297 ++++++++++++++++++++++++ OpenSim/Services/GridService/GridServiceBase.cs | 84 +++++++ 2 files changed, 381 insertions(+) create mode 100644 OpenSim/Services/GridService/GridService.cs create mode 100644 OpenSim/Services/GridService/GridServiceBase.cs (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs new file mode 100644 index 0000000..6aa1c4f --- /dev/null +++ b/OpenSim/Services/GridService/GridService.cs @@ -0,0 +1,297 @@ +/* + * 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 System.Net; +using System.Reflection; +using Nini.Config; +using log4net; +using OpenSim.Framework; +using OpenSim.Framework.Console; +using OpenSim.Data; +using OpenSim.Services.Interfaces; +using OpenMetaverse; + +namespace OpenSim.Services.GridService +{ + public class GridService : GridServiceBase, IGridService + { + private static readonly ILog m_log = + LogManager.GetLogger( + MethodBase.GetCurrentMethod().DeclaringType); + + public GridService(IConfigSource config) + : base(config) + { + MainConsole.Instance.Commands.AddCommand("kfs", false, + "show digest", + "show digest ", + "Show asset digest", HandleShowDigest); + + MainConsole.Instance.Commands.AddCommand("kfs", false, + "delete asset", + "delete asset ", + "Delete asset from database", HandleDeleteAsset); + + } + + #region IGridService + + public bool RegisterRegion(UUID scopeID, SimpleRegionInfo regionInfos) + { + if (m_Database.Get(regionInfos.RegionID, scopeID) != null) + { + m_log.WarnFormat("[GRID SERVICE]: Region {0} already registered in scope {1}.", regionInfos.RegionID, scopeID); + return false; + } + if (m_Database.Get((int)regionInfos.RegionLocX, (int)regionInfos.RegionLocY, scopeID) != null) + { + m_log.WarnFormat("[GRID SERVICE]: Region {0} tried to register in coordinates {1}, {2} which are already in use in scope {3}.", + regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID); + return false; + } + + // Everything is ok, let's register + RegionData rdata = RegionInfo2RegionData(regionInfos); + rdata.ScopeID = scopeID; + m_Database.Store(rdata); + return true; + } + + public bool DeregisterRegion(UUID regionID) + { + return m_Database.Delete(regionID); + } + + public List GetNeighbours(UUID scopeID, int x, int y) + { + List rdatas = m_Database.Get(x - 1, y - 1, x + 1, y + 1, scopeID); + List rinfos = new List(); + foreach (RegionData rdata in rdatas) + rinfos.Add(RegionData2RegionInfo(rdata)); + + return rinfos; + } + + public SimpleRegionInfo GetRegionByUUID(UUID scopeID, UUID regionID) + { + RegionData rdata = m_Database.Get(regionID, scopeID); + if (rdata != null) + return RegionData2RegionInfo(rdata); + + return null; + } + + public SimpleRegionInfo GetRegionByPosition(UUID scopeID, int x, int y) + { + RegionData rdata = m_Database.Get(x, y, scopeID); + if (rdata != null) + return RegionData2RegionInfo(rdata); + + return null; + } + + public SimpleRegionInfo GetRegionByName(UUID scopeID, string regionName) + { + List rdatas = m_Database.Get(regionName + "%", scopeID); + if ((rdatas != null) && (rdatas.Count > 0)) + return RegionData2RegionInfo(rdatas[0]); // get the first + + return null; + } + + public List GetRegionsByName(UUID scopeID, string name, int maxNumber) + { + List rdatas = m_Database.Get("%" + name + "%", scopeID); + + int count = 0; + List rinfos = new List(); + + if (rdatas != null) + { + foreach (RegionData rdata in rdatas) + { + if (count++ < maxNumber) + rinfos.Add(RegionData2RegionInfo(rdata)); + } + } + + return rinfos; + } + + public List GetRegionRange(UUID scopeID, int xmin, int xmax, int ymin, int ymax) + { + List rdatas = m_Database.Get(xmin, ymin, xmax, ymax, scopeID); + List rinfos = new List(); + foreach (RegionData rdata in rdatas) + rinfos.Add(RegionData2RegionInfo(rdata)); + + return rinfos; + } + + #endregion + + #region Data structure conversions + + protected RegionData RegionInfo2RegionData(SimpleRegionInfo rinfo) + { + RegionData rdata = new RegionData(); + rdata.posX = (int)rinfo.RegionLocX; + rdata.posY = (int)rinfo.RegionLocY; + rdata.RegionID = rinfo.RegionID; + //rdata.RegionName = rinfo.RegionName; + rdata.Data["external_ip_address"] = rinfo.ExternalEndPoint.Address.ToString(); + rdata.Data["external_port"] = rinfo.ExternalEndPoint.Port.ToString(); + rdata.Data["external_host_name"] = rinfo.ExternalHostName; + rdata.Data["http_port"] = rinfo.HttpPort.ToString(); + rdata.Data["internal_ip_address"] = rinfo.InternalEndPoint.Address.ToString(); + rdata.Data["internal_port"] = rinfo.InternalEndPoint.Port.ToString(); + rdata.Data["alternate_ports"] = rinfo.m_allow_alternate_ports.ToString(); + rdata.Data["server_uri"] = rinfo.ServerURI; + + return rdata; + } + + protected SimpleRegionInfo RegionData2RegionInfo(RegionData rdata) + { + SimpleRegionInfo rinfo = new SimpleRegionInfo(); + rinfo.RegionLocX = (uint)rdata.posX; + rinfo.RegionLocY = (uint)rdata.posY; + rinfo.RegionID = rdata.RegionID; + //rinfo.RegionName = rdata.RegionName; + + // Now for the variable data + if ((rdata.Data["external_ip_address"] != null) && (rdata.Data["external_port"] != null)) + { + int port = 0; + Int32.TryParse((string)rdata.Data["external_port"], out port); + IPEndPoint ep = new IPEndPoint(IPAddress.Parse((string)rdata.Data["external_ip_address"]), port); + rinfo.ExternalEndPoint = ep; + } + else + rinfo.ExternalEndPoint = new IPEndPoint(new IPAddress(0), 0); + + if (rdata.Data["external_host_name"] != null) + rinfo.ExternalHostName = (string)rdata.Data["external_host_name"] ; + + if (rdata.Data["http_port"] != null) + { + UInt32 port = 0; + UInt32.TryParse((string)rdata.Data["http_port"], out port); + rinfo.HttpPort = port; + } + + if ((rdata.Data["internal_ip_address"] != null) && (rdata.Data["internal_port"] != null)) + { + int port = 0; + Int32.TryParse((string)rdata.Data["internal_port"], out port); + IPEndPoint ep = new IPEndPoint(IPAddress.Parse((string)rdata.Data["internal_ip_address"]), port); + rinfo.InternalEndPoint = ep; + } + else + rinfo.InternalEndPoint = new IPEndPoint(new IPAddress(0), 0); + + if (rdata.Data["alternate_ports"] != null) + { + bool alts = false; + Boolean.TryParse((string)rdata.Data["alternate_ports"], out alts); + rinfo.m_allow_alternate_ports = alts; + } + + if (rdata.Data["server_uri"] != null) + rinfo.ServerURI = (string)rdata.Data["server_uri"]; + + return rinfo; + } + + #endregion + + void HandleShowDigest(string module, string[] args) + { + //if (args.Length < 3) + //{ + // MainConsole.Instance.Output("Syntax: show digest "); + // return; + //} + + //AssetBase asset = Get(args[2]); + + //if (asset == null || asset.Data.Length == 0) + //{ + // MainConsole.Instance.Output("Asset not found"); + // return; + //} + + //int i; + + //MainConsole.Instance.Output(String.Format("Name: {0}", asset.Name)); + //MainConsole.Instance.Output(String.Format("Description: {0}", asset.Description)); + //MainConsole.Instance.Output(String.Format("Type: {0}", asset.Type)); + //MainConsole.Instance.Output(String.Format("Content-type: {0}", asset.Metadata.ContentType)); + + //for (i = 0 ; i < 5 ; i++) + //{ + // int off = i * 16; + // if (asset.Data.Length <= off) + // break; + // int len = 16; + // if (asset.Data.Length < off + len) + // len = asset.Data.Length - off; + + // byte[] line = new byte[len]; + // Array.Copy(asset.Data, off, line, 0, len); + + // string text = BitConverter.ToString(line); + // MainConsole.Instance.Output(String.Format("{0:x4}: {1}", off, text)); + //} + } + + void HandleDeleteAsset(string module, string[] args) + { + //if (args.Length < 3) + //{ + // MainConsole.Instance.Output("Syntax: delete asset "); + // return; + //} + + //AssetBase asset = Get(args[2]); + + //if (asset == null || asset.Data.Length == 0) + // MainConsole.Instance.Output("Asset not found"); + // return; + //} + + //Delete(args[2]); + + ////MainConsole.Instance.Output("Asset deleted"); + //// TODO: Implement this + + //MainConsole.Instance.Output("Asset deletion not supported by database"); + } + } +} diff --git a/OpenSim/Services/GridService/GridServiceBase.cs b/OpenSim/Services/GridService/GridServiceBase.cs new file mode 100644 index 0000000..7b69290 --- /dev/null +++ b/OpenSim/Services/GridService/GridServiceBase.cs @@ -0,0 +1,84 @@ +/* + * 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 Nini.Config; +using OpenSim.Framework; +using OpenSim.Data; +using OpenSim.Services.Interfaces; +using OpenSim.Services.Base; + +namespace OpenSim.Services.GridService +{ + public class GridServiceBase : ServiceBase + { + protected IRegionData m_Database = null; + + public GridServiceBase(IConfigSource config) + : base(config) + { + string dllName = String.Empty; + string connString = String.Empty; + string realm = "regions"; + + // + // Try reading the [AssetService] section first, if it exists + // + IConfig gridConfig = config.Configs["GridService"]; + if (gridConfig != null) + { + dllName = gridConfig.GetString("StorageProvider", dllName); + connString = gridConfig.GetString("ConnectionString", connString); + realm = gridConfig.GetString("Realm", realm); + } + + // + // Try reading the [DatabaseService] section, if it exists + // + IConfig dbConfig = config.Configs["DatabaseService"]; + if (dbConfig != null) + { + if (dllName == String.Empty) + dllName = dbConfig.GetString("StorageProvider", String.Empty); + if (connString == String.Empty) + connString = dbConfig.GetString("ConnectionString", String.Empty); + } + + // + // We tried, but this doesn't exist. We can't proceed. + // + if (dllName.Equals(String.Empty)) + throw new Exception("No StorageProvider configured"); + + m_Database = LoadPlugin(dllName, new Object[] { connString, realm }); + if (m_Database == null) + throw new Exception("Could not find a storage interface in the given module"); + + } + } +} -- cgit v1.1 From 15d6bb4ce55092d2ee0a27bbb3ec5e7760a05dcc Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 18 Sep 2009 20:09:43 -0700 Subject: Reverted the order of reading configs in GridServiceBase. --- OpenSim/Services/GridService/GridServiceBase.cs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridServiceBase.cs b/OpenSim/Services/GridService/GridServiceBase.cs index 7b69290..7522e64 100644 --- a/OpenSim/Services/GridService/GridServiceBase.cs +++ b/OpenSim/Services/GridService/GridServiceBase.cs @@ -47,17 +47,6 @@ namespace OpenSim.Services.GridService string realm = "regions"; // - // Try reading the [AssetService] section first, if it exists - // - IConfig gridConfig = config.Configs["GridService"]; - if (gridConfig != null) - { - dllName = gridConfig.GetString("StorageProvider", dllName); - connString = gridConfig.GetString("ConnectionString", connString); - realm = gridConfig.GetString("Realm", realm); - } - - // // Try reading the [DatabaseService] section, if it exists // IConfig dbConfig = config.Configs["DatabaseService"]; @@ -70,6 +59,17 @@ namespace OpenSim.Services.GridService } // + // [GridService] section overrides [DatabaseService], if it exists + // + IConfig gridConfig = config.Configs["GridService"]; + if (gridConfig != null) + { + dllName = gridConfig.GetString("StorageProvider", dllName); + connString = gridConfig.GetString("ConnectionString", connString); + realm = gridConfig.GetString("Realm", realm); + } + + // // We tried, but this doesn't exist. We can't proceed. // if (dllName.Equals(String.Empty)) -- cgit v1.1 From 390137d540b9ae39eba3ba9136bd49d5e992bc5f Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 21 Sep 2009 11:05:01 -0700 Subject: Added grid handler and grid remote connector. --- OpenSim/Services/GridService/GridService.cs | 65 +++++------------------------ 1 file changed, 11 insertions(+), 54 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 6aa1c4f..2229421 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -88,13 +88,18 @@ namespace OpenSim.Services.GridService return m_Database.Delete(regionID); } - public List GetNeighbours(UUID scopeID, int x, int y) + public List GetNeighbours(UUID scopeID, UUID regionID) { - List rdatas = m_Database.Get(x - 1, y - 1, x + 1, y + 1, scopeID); List rinfos = new List(); - foreach (RegionData rdata in rdatas) - rinfos.Add(RegionData2RegionInfo(rdata)); + RegionData region = m_Database.Get(regionID, scopeID); + if (region != null) + { + // Not really? Maybe? + List rdatas = m_Database.Get(region.posX - 1, region.posY - 1, region.posX + 1, region.posY + 1, scopeID); + foreach (RegionData rdata in rdatas) + rinfos.Add(RegionData2RegionInfo(rdata)); + } return rinfos; } @@ -164,68 +169,20 @@ namespace OpenSim.Services.GridService rdata.posX = (int)rinfo.RegionLocX; rdata.posY = (int)rinfo.RegionLocY; rdata.RegionID = rinfo.RegionID; + rdata.Data = rinfo.ToKeyValuePairs(); //rdata.RegionName = rinfo.RegionName; - rdata.Data["external_ip_address"] = rinfo.ExternalEndPoint.Address.ToString(); - rdata.Data["external_port"] = rinfo.ExternalEndPoint.Port.ToString(); - rdata.Data["external_host_name"] = rinfo.ExternalHostName; - rdata.Data["http_port"] = rinfo.HttpPort.ToString(); - rdata.Data["internal_ip_address"] = rinfo.InternalEndPoint.Address.ToString(); - rdata.Data["internal_port"] = rinfo.InternalEndPoint.Port.ToString(); - rdata.Data["alternate_ports"] = rinfo.m_allow_alternate_ports.ToString(); - rdata.Data["server_uri"] = rinfo.ServerURI; return rdata; } protected SimpleRegionInfo RegionData2RegionInfo(RegionData rdata) { - SimpleRegionInfo rinfo = new SimpleRegionInfo(); + SimpleRegionInfo rinfo = new SimpleRegionInfo(rdata.Data); rinfo.RegionLocX = (uint)rdata.posX; rinfo.RegionLocY = (uint)rdata.posY; rinfo.RegionID = rdata.RegionID; //rinfo.RegionName = rdata.RegionName; - // Now for the variable data - if ((rdata.Data["external_ip_address"] != null) && (rdata.Data["external_port"] != null)) - { - int port = 0; - Int32.TryParse((string)rdata.Data["external_port"], out port); - IPEndPoint ep = new IPEndPoint(IPAddress.Parse((string)rdata.Data["external_ip_address"]), port); - rinfo.ExternalEndPoint = ep; - } - else - rinfo.ExternalEndPoint = new IPEndPoint(new IPAddress(0), 0); - - if (rdata.Data["external_host_name"] != null) - rinfo.ExternalHostName = (string)rdata.Data["external_host_name"] ; - - if (rdata.Data["http_port"] != null) - { - UInt32 port = 0; - UInt32.TryParse((string)rdata.Data["http_port"], out port); - rinfo.HttpPort = port; - } - - if ((rdata.Data["internal_ip_address"] != null) && (rdata.Data["internal_port"] != null)) - { - int port = 0; - Int32.TryParse((string)rdata.Data["internal_port"], out port); - IPEndPoint ep = new IPEndPoint(IPAddress.Parse((string)rdata.Data["internal_ip_address"]), port); - rinfo.InternalEndPoint = ep; - } - else - rinfo.InternalEndPoint = new IPEndPoint(new IPAddress(0), 0); - - if (rdata.Data["alternate_ports"] != null) - { - bool alts = false; - Boolean.TryParse((string)rdata.Data["alternate_ports"], out alts); - rinfo.m_allow_alternate_ports = alts; - } - - if (rdata.Data["server_uri"] != null) - rinfo.ServerURI = (string)rdata.Data["server_uri"]; - return rinfo; } -- cgit v1.1 From ae07b220c61cc92453c67e602907f0b3c8fcc707 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 21 Sep 2009 17:16:30 -0700 Subject: Changed position methods so that they assume the input params are in meters. --- OpenSim/Services/GridService/GridService.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 2229421..dd529f5 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -95,7 +95,9 @@ namespace OpenSim.Services.GridService if (region != null) { // Not really? Maybe? - List rdatas = m_Database.Get(region.posX - 1, region.posY - 1, region.posX + 1, region.posY + 1, scopeID); + List rdatas = m_Database.Get(region.posX - (int)Constants.RegionSize, region.posY - (int)Constants.RegionSize, + region.posX + (int)Constants.RegionSize, region.posY + (int)Constants.RegionSize, scopeID); + foreach (RegionData rdata in rdatas) rinfos.Add(RegionData2RegionInfo(rdata)); @@ -114,7 +116,9 @@ namespace OpenSim.Services.GridService public SimpleRegionInfo GetRegionByPosition(UUID scopeID, int x, int y) { - RegionData rdata = m_Database.Get(x, y, scopeID); + int snapX = (int)(x / Constants.RegionSize) * (int)Constants.RegionSize; + int snapY = (int)(y / Constants.RegionSize) * (int)Constants.RegionSize; + RegionData rdata = m_Database.Get(snapX, snapY, scopeID); if (rdata != null) return RegionData2RegionInfo(rdata); @@ -151,7 +155,12 @@ namespace OpenSim.Services.GridService public List GetRegionRange(UUID scopeID, int xmin, int xmax, int ymin, int ymax) { - List rdatas = m_Database.Get(xmin, ymin, xmax, ymax, scopeID); + int xminSnap = (int)(xmin / Constants.RegionSize) * (int)Constants.RegionSize; + int xmaxSnap = (int)(xmax / Constants.RegionSize) * (int)Constants.RegionSize; + int yminSnap = (int)(ymin / Constants.RegionSize) * (int)Constants.RegionSize; + int ymaxSnap = (int)(ymax / Constants.RegionSize) * (int)Constants.RegionSize; + + List rdatas = m_Database.Get(xminSnap, yminSnap, xmaxSnap, ymaxSnap, scopeID); List rinfos = new List(); foreach (RegionData rdata in rdatas) rinfos.Add(RegionData2RegionInfo(rdata)); -- cgit v1.1 From ffd30b8ac31bc408316079ba86076bf9e984a8be Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 22 Sep 2009 14:46:05 -0700 Subject: Moved RegionName from RegionInfo to SimpleRegionInfo. --- OpenSim/Services/GridService/GridService.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index dd529f5..b37a51b 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -179,7 +179,7 @@ namespace OpenSim.Services.GridService rdata.posY = (int)rinfo.RegionLocY; rdata.RegionID = rinfo.RegionID; rdata.Data = rinfo.ToKeyValuePairs(); - //rdata.RegionName = rinfo.RegionName; + rdata.RegionName = rinfo.RegionName; return rdata; } @@ -190,7 +190,7 @@ namespace OpenSim.Services.GridService rinfo.RegionLocX = (uint)rdata.posX; rinfo.RegionLocY = (uint)rdata.posY; rinfo.RegionID = rdata.RegionID; - //rinfo.RegionName = rdata.RegionName; + rinfo.RegionName = rdata.RegionName; return rinfo; } -- cgit v1.1 From 67276589c883fe1a74d8d52057db1431d637dade Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 23 Sep 2009 17:20:07 -0700 Subject: Changed IGridService to use the new GridRegion data structure instead of old SimpleRegionInfo. Added grid configs to standalones. --- OpenSim/Services/GridService/GridService.cs | 32 +++++++++++++------------ OpenSim/Services/GridService/GridServiceBase.cs | 2 +- 2 files changed, 18 insertions(+), 16 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index b37a51b..cd462ab 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -35,6 +35,7 @@ using OpenSim.Framework; using OpenSim.Framework.Console; using OpenSim.Data; using OpenSim.Services.Interfaces; +using GridRegion = OpenSim.Services.Interfaces.GridRegion; using OpenMetaverse; namespace OpenSim.Services.GridService @@ -48,6 +49,7 @@ namespace OpenSim.Services.GridService public GridService(IConfigSource config) : base(config) { + m_log.DebugFormat("[GRID SERVICE]: Starting..."); MainConsole.Instance.Commands.AddCommand("kfs", false, "show digest", "show digest ", @@ -62,7 +64,7 @@ namespace OpenSim.Services.GridService #region IGridService - public bool RegisterRegion(UUID scopeID, SimpleRegionInfo regionInfos) + public bool RegisterRegion(UUID scopeID, GridRegion regionInfos) { if (m_Database.Get(regionInfos.RegionID, scopeID) != null) { @@ -88,9 +90,9 @@ namespace OpenSim.Services.GridService return m_Database.Delete(regionID); } - public List GetNeighbours(UUID scopeID, UUID regionID) + public List GetNeighbours(UUID scopeID, UUID regionID) { - List rinfos = new List(); + List rinfos = new List(); RegionData region = m_Database.Get(regionID, scopeID); if (region != null) { @@ -105,7 +107,7 @@ namespace OpenSim.Services.GridService return rinfos; } - public SimpleRegionInfo GetRegionByUUID(UUID scopeID, UUID regionID) + public GridRegion GetRegionByUUID(UUID scopeID, UUID regionID) { RegionData rdata = m_Database.Get(regionID, scopeID); if (rdata != null) @@ -114,7 +116,7 @@ namespace OpenSim.Services.GridService return null; } - public SimpleRegionInfo GetRegionByPosition(UUID scopeID, int x, int y) + public GridRegion GetRegionByPosition(UUID scopeID, int x, int y) { int snapX = (int)(x / Constants.RegionSize) * (int)Constants.RegionSize; int snapY = (int)(y / Constants.RegionSize) * (int)Constants.RegionSize; @@ -125,7 +127,7 @@ namespace OpenSim.Services.GridService return null; } - public SimpleRegionInfo GetRegionByName(UUID scopeID, string regionName) + public GridRegion GetRegionByName(UUID scopeID, string regionName) { List rdatas = m_Database.Get(regionName + "%", scopeID); if ((rdatas != null) && (rdatas.Count > 0)) @@ -134,12 +136,12 @@ namespace OpenSim.Services.GridService return null; } - public List GetRegionsByName(UUID scopeID, string name, int maxNumber) + public List GetRegionsByName(UUID scopeID, string name, int maxNumber) { List rdatas = m_Database.Get("%" + name + "%", scopeID); int count = 0; - List rinfos = new List(); + List rinfos = new List(); if (rdatas != null) { @@ -153,7 +155,7 @@ namespace OpenSim.Services.GridService return rinfos; } - public List GetRegionRange(UUID scopeID, int xmin, int xmax, int ymin, int ymax) + public List GetRegionRange(UUID scopeID, int xmin, int xmax, int ymin, int ymax) { int xminSnap = (int)(xmin / Constants.RegionSize) * (int)Constants.RegionSize; int xmaxSnap = (int)(xmax / Constants.RegionSize) * (int)Constants.RegionSize; @@ -161,7 +163,7 @@ namespace OpenSim.Services.GridService int ymaxSnap = (int)(ymax / Constants.RegionSize) * (int)Constants.RegionSize; List rdatas = m_Database.Get(xminSnap, yminSnap, xmaxSnap, ymaxSnap, scopeID); - List rinfos = new List(); + List rinfos = new List(); foreach (RegionData rdata in rdatas) rinfos.Add(RegionData2RegionInfo(rdata)); @@ -172,7 +174,7 @@ namespace OpenSim.Services.GridService #region Data structure conversions - protected RegionData RegionInfo2RegionData(SimpleRegionInfo rinfo) + protected RegionData RegionInfo2RegionData(GridRegion rinfo) { RegionData rdata = new RegionData(); rdata.posX = (int)rinfo.RegionLocX; @@ -184,11 +186,11 @@ namespace OpenSim.Services.GridService return rdata; } - protected SimpleRegionInfo RegionData2RegionInfo(RegionData rdata) + protected GridRegion RegionData2RegionInfo(RegionData rdata) { - SimpleRegionInfo rinfo = new SimpleRegionInfo(rdata.Data); - rinfo.RegionLocX = (uint)rdata.posX; - rinfo.RegionLocY = (uint)rdata.posY; + GridRegion rinfo = new GridRegion(rdata.Data); + rinfo.RegionLocX = rdata.posX; + rinfo.RegionLocY = rdata.posY; rinfo.RegionID = rdata.RegionID; rinfo.RegionName = rdata.RegionName; diff --git a/OpenSim/Services/GridService/GridServiceBase.cs b/OpenSim/Services/GridService/GridServiceBase.cs index 7522e64..444f79b 100644 --- a/OpenSim/Services/GridService/GridServiceBase.cs +++ b/OpenSim/Services/GridService/GridServiceBase.cs @@ -68,7 +68,7 @@ namespace OpenSim.Services.GridService connString = gridConfig.GetString("ConnectionString", connString); realm = gridConfig.GetString("Realm", realm); } - + // // We tried, but this doesn't exist. We can't proceed. // -- cgit v1.1 From fd8fb7735b0eb6150679ccad84b2a32fd5315a38 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 23 Sep 2009 20:39:25 -0700 Subject: First test passes -- regions being registered and retrieved correctly in Data.Null. --- OpenSim/Services/GridService/GridService.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index cd462ab..1b297dc 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -101,7 +101,8 @@ namespace OpenSim.Services.GridService region.posX + (int)Constants.RegionSize, region.posY + (int)Constants.RegionSize, scopeID); foreach (RegionData rdata in rdatas) - rinfos.Add(RegionData2RegionInfo(rdata)); + if (rdata.RegionID != regionID) + rinfos.Add(RegionData2RegionInfo(rdata)); } return rinfos; -- cgit v1.1 From 2824bbc47b30ab6fb9a12bce3201bb5b79b20bd5 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 24 Sep 2009 05:48:35 -0700 Subject: Changed name of the hyperlink XMLRPC method to linkk-region, so that it doesn't conflict with the existing one. --- OpenSim/Services/GridService/GridService.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 1b297dc..01ffa1d 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -71,7 +71,9 @@ namespace OpenSim.Services.GridService m_log.WarnFormat("[GRID SERVICE]: Region {0} already registered in scope {1}.", regionInfos.RegionID, scopeID); return false; } - if (m_Database.Get((int)regionInfos.RegionLocX, (int)regionInfos.RegionLocY, scopeID) != null) + // This needs better sanity testing. What if regionInfo is registering in + // overlapping coords? + if (m_Database.Get(regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID) != null) { m_log.WarnFormat("[GRID SERVICE]: Region {0} tried to register in coordinates {1}, {2} which are already in use in scope {3}.", regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID); -- cgit v1.1 From 6a5d7650d02979c74abcbbb3595729a4a6b55411 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 24 Sep 2009 18:23:55 -0700 Subject: All tests pass for MySQL/MySQLRegionData. Added OpenSim.GridServer.ini.example that I have been using for testing the ROBUST grid service with the GridClient. --- OpenSim/Services/GridService/GridService.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 01ffa1d..41344ad 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -183,9 +183,9 @@ namespace OpenSim.Services.GridService rdata.posX = (int)rinfo.RegionLocX; rdata.posY = (int)rinfo.RegionLocY; rdata.RegionID = rinfo.RegionID; - rdata.Data = rinfo.ToKeyValuePairs(); rdata.RegionName = rinfo.RegionName; - + rdata.Data = rinfo.ToKeyValuePairs(); + rdata.Data["regionHandle"] = Utils.UIntsToLong((uint)rdata.posX, (uint)rdata.posY); return rdata; } @@ -196,6 +196,7 @@ namespace OpenSim.Services.GridService rinfo.RegionLocY = rdata.posY; rinfo.RegionID = rdata.RegionID; rinfo.RegionName = rdata.RegionName; + rinfo.ScopeID = rdata.ScopeID; return rinfo; } -- cgit v1.1 From b6824c495cb04ca79c681143be2d1b8f9b5b228d Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 24 Sep 2009 18:28:38 -0700 Subject: Deleted the meaningless console commands on the GridService. Will need to add meaningful ones. --- OpenSim/Services/GridService/GridService.cs | 72 ----------------------------- 1 file changed, 72 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 41344ad..68b7cdf 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -50,16 +50,6 @@ namespace OpenSim.Services.GridService : base(config) { m_log.DebugFormat("[GRID SERVICE]: Starting..."); - MainConsole.Instance.Commands.AddCommand("kfs", false, - "show digest", - "show digest ", - "Show asset digest", HandleShowDigest); - - MainConsole.Instance.Commands.AddCommand("kfs", false, - "delete asset", - "delete asset ", - "Delete asset from database", HandleDeleteAsset); - } #region IGridService @@ -203,67 +193,5 @@ namespace OpenSim.Services.GridService #endregion - void HandleShowDigest(string module, string[] args) - { - //if (args.Length < 3) - //{ - // MainConsole.Instance.Output("Syntax: show digest "); - // return; - //} - - //AssetBase asset = Get(args[2]); - - //if (asset == null || asset.Data.Length == 0) - //{ - // MainConsole.Instance.Output("Asset not found"); - // return; - //} - - //int i; - - //MainConsole.Instance.Output(String.Format("Name: {0}", asset.Name)); - //MainConsole.Instance.Output(String.Format("Description: {0}", asset.Description)); - //MainConsole.Instance.Output(String.Format("Type: {0}", asset.Type)); - //MainConsole.Instance.Output(String.Format("Content-type: {0}", asset.Metadata.ContentType)); - - //for (i = 0 ; i < 5 ; i++) - //{ - // int off = i * 16; - // if (asset.Data.Length <= off) - // break; - // int len = 16; - // if (asset.Data.Length < off + len) - // len = asset.Data.Length - off; - - // byte[] line = new byte[len]; - // Array.Copy(asset.Data, off, line, 0, len); - - // string text = BitConverter.ToString(line); - // MainConsole.Instance.Output(String.Format("{0:x4}: {1}", off, text)); - //} - } - - void HandleDeleteAsset(string module, string[] args) - { - //if (args.Length < 3) - //{ - // MainConsole.Instance.Output("Syntax: delete asset "); - // return; - //} - - //AssetBase asset = Get(args[2]); - - //if (asset == null || asset.Data.Length == 0) - // MainConsole.Instance.Output("Asset not found"); - // return; - //} - - //Delete(args[2]); - - ////MainConsole.Instance.Output("Asset deleted"); - //// TODO: Implement this - - //MainConsole.Instance.Output("Asset deletion not supported by database"); - } } } -- cgit v1.1 From 52e477b41f137ff2a0775722dcbaaa64fa5f3bc3 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 25 Sep 2009 06:02:41 -0700 Subject: Better guards on RegisterRegion in GridService. Added serverPort to the fields that get stored (I think this is the UDP port). --- OpenSim/Services/GridService/GridService.cs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 68b7cdf..991acf2 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -56,19 +56,21 @@ namespace OpenSim.Services.GridService public bool RegisterRegion(UUID scopeID, GridRegion regionInfos) { - if (m_Database.Get(regionInfos.RegionID, scopeID) != null) - { - m_log.WarnFormat("[GRID SERVICE]: Region {0} already registered in scope {1}.", regionInfos.RegionID, scopeID); - return false; - } // This needs better sanity testing. What if regionInfo is registering in // overlapping coords? - if (m_Database.Get(regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID) != null) + RegionData region = m_Database.Get(regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID); + if ((region != null) && (region.RegionID != regionInfos.RegionID)) { m_log.WarnFormat("[GRID SERVICE]: Region {0} tried to register in coordinates {1}, {2} which are already in use in scope {3}.", regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID); return false; } + if ((region != null) && (region.RegionID == regionInfos.RegionID) && + ((region.posX != regionInfos.RegionLocX) || (region.posY != regionInfos.RegionLocY))) + { + // Region reregistering in other coordinates. Delete the old entry + m_Database.Delete(regionInfos.RegionID); + } // Everything is ok, let's register RegionData rdata = RegionInfo2RegionData(regionInfos); -- cgit v1.1 From a2d5da71292ee271617edf28346e6aeb1e153943 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 5 Oct 2009 10:31:09 -0700 Subject: More debug messages if things go wrong. --- OpenSim/Services/GridService/GridService.cs | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 991acf2..a2e4771 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -69,18 +69,40 @@ namespace OpenSim.Services.GridService ((region.posX != regionInfos.RegionLocX) || (region.posY != regionInfos.RegionLocY))) { // Region reregistering in other coordinates. Delete the old entry - m_Database.Delete(regionInfos.RegionID); + m_log.DebugFormat("[GRID SERVICE]: Region {0} ({1}) was previously registered at {2}-{3}. Deleting old entry.", + regionInfos.RegionName, regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY); + + try + { + m_Database.Delete(regionInfos.RegionID); + } + catch (Exception e) + { + m_log.DebugFormat("[GRID SERVICE]: Database exception: {0}", e); + } } // Everything is ok, let's register RegionData rdata = RegionInfo2RegionData(regionInfos); rdata.ScopeID = scopeID; - m_Database.Store(rdata); + try + { + m_Database.Store(rdata); + } + catch (Exception e) + { + m_log.DebugFormat("[GRID SERVICE]: Database exception: {0}", e); + } + + m_log.DebugFormat("[GRID SERVICE]: Region {0} ({1}) registered successfully at {2}-{3}", + regionInfos.RegionName, regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY); + return true; } public bool DeregisterRegion(UUID regionID) { + m_log.DebugFormat("[GRID SERVICE]: Region {0} deregistered", regionID); return m_Database.Delete(regionID); } -- cgit v1.1 From d9f15fbf40f7eca81ff2ca6f3792820c6cabc605 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 7 Oct 2009 19:37:18 +0100 Subject: store owner_uuid in the region table --- OpenSim/Services/GridService/GridService.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index a2e4771..86815e5 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -200,6 +200,7 @@ namespace OpenSim.Services.GridService rdata.RegionName = rinfo.RegionName; rdata.Data = rinfo.ToKeyValuePairs(); rdata.Data["regionHandle"] = Utils.UIntsToLong((uint)rdata.posX, (uint)rdata.posY); + rdata.Data["owner_uuid"] = rinfo.EstateOwner.ToString(); return rdata; } -- cgit v1.1 From 28d6705358c2e383fb46c57f064de4dcff144e33 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 9 Jan 2010 20:46:32 +0000 Subject: Preliminary work on the new default region setting mechanism --- OpenSim/Services/GridService/GridService.cs | 69 +++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 86815e5..884bc95 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -46,10 +46,18 @@ namespace OpenSim.Services.GridService LogManager.GetLogger( MethodBase.GetCurrentMethod().DeclaringType); + private bool m_DeleteOnUnregister = true; + public GridService(IConfigSource config) : base(config) { m_log.DebugFormat("[GRID SERVICE]: Starting..."); + + IConfig gridConfig = config.Configs["GridService"]; + if (gridConfig != null) + { + m_DeleteOnUnregister = gridConfig.GetBoolean("DeleteOnUnregister", true); + } } #region IGridService @@ -85,6 +93,15 @@ namespace OpenSim.Services.GridService // Everything is ok, let's register RegionData rdata = RegionInfo2RegionData(regionInfos); rdata.ScopeID = scopeID; + + if (region != null) + { + rdata.Data["flags"] = region.Data["flags"]; // Preserve fields + } + int flags = Convert.ToInt32(rdata.Data["flags"]); + flags |= (int)OpenSim.Data.RegionFlags.RegionOnline; + rdata.Data["flags"] = flags.ToString(); + try { m_Database.Store(rdata); @@ -103,6 +120,28 @@ namespace OpenSim.Services.GridService public bool DeregisterRegion(UUID regionID) { m_log.DebugFormat("[GRID SERVICE]: Region {0} deregistered", regionID); + if (!m_DeleteOnUnregister) + { + RegionData region = m_Database.Get(regionID, UUID.Zero); + if (region == null) + return false; + + int flags = Convert.ToInt32(region.Data["flags"]); + flags &= ~(int)OpenSim.Data.RegionFlags.RegionOnline; + region.Data["flags"] = flags.ToString(); + try + { + m_Database.Store(region); + } + catch (Exception e) + { + m_log.DebugFormat("[GRID SERVICE]: Database exception: {0}", e); + } + + return true; + + } + return m_Database.Delete(regionID); } @@ -218,5 +257,35 @@ namespace OpenSim.Services.GridService #endregion + public List GetDefaultRegions(UUID scopeID) + { + List ret = new List(); + + List regions = m_Database.GetDefaultRegions(scopeID); + + foreach (RegionData r in regions) + ret.Add(RegionData2RegionInfo(r)); + + return ret; + } + + public List GetFallbackRegions(UUID scopeID, int x, int y) + { + List ret = new List(); + + List regions = m_Database.GetFallbackRegions(scopeID, x, y); + + foreach (RegionData r in regions) + ret.Add(RegionData2RegionInfo(r)); + + return ret; + } + + public int GetRegionFlags(UUID scopeID, UUID regionID) + { + RegionData region = m_Database.Get(regionID, scopeID); + + return Convert.ToInt32(region.Data["flags"]); + } } } -- cgit v1.1 From 59ecd6d151a990454847358fc4f83fb210913741 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 9 Jan 2010 23:25:34 +0000 Subject: Temp fix: initialize flags value to prevent exception --- OpenSim/Services/GridService/GridService.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 884bc95..31163a5 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -58,6 +58,13 @@ namespace OpenSim.Services.GridService { m_DeleteOnUnregister = gridConfig.GetBoolean("DeleteOnUnregister", true); } + + MainConsole.Instance.Commands.AddCommand("grid", true, + "show region", + "show region ", + "Show details on a region", + "Display all details about a registered grid region", + HandleShowRegion); } #region IGridService @@ -93,6 +100,7 @@ namespace OpenSim.Services.GridService // Everything is ok, let's register RegionData rdata = RegionInfo2RegionData(regionInfos); rdata.ScopeID = scopeID; + rdata.Data["flags"] = "0"; if (region != null) { @@ -287,5 +295,16 @@ namespace OpenSim.Services.GridService return Convert.ToInt32(region.Data["flags"]); } + + private void HandleShowRegion(string module, string[] cmd) + { + if (cmd.Length != 3) + { + MainConsole.Instance.Output("Syntax: show region "); + return; + } + + + } } } -- cgit v1.1 From 7a352edd5a8fac579b2267d26e1c2a1cae524df6 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 10 Jan 2010 01:02:03 +0000 Subject: Add some commands to the grid server --- OpenSim/Services/GridService/GridService.cs | 75 +++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 31163a5..d6232ac 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -47,12 +47,16 @@ namespace OpenSim.Services.GridService MethodBase.GetCurrentMethod().DeclaringType); private bool m_DeleteOnUnregister = true; + private static GridService m_RootInstance = null; public GridService(IConfigSource config) : base(config) { m_log.DebugFormat("[GRID SERVICE]: Starting..."); + if (m_RootInstance == null) + m_RootInstance = this; + IConfig gridConfig = config.Configs["GridService"]; if (gridConfig != null) { @@ -298,13 +302,84 @@ namespace OpenSim.Services.GridService private void HandleShowRegion(string module, string[] cmd) { + if (m_RootInstance != this) + return; + if (cmd.Length != 3) { MainConsole.Instance.Output("Syntax: show region "); return; } + List regions = m_Database.Get(cmd[2], UUID.Zero); + if (regions == null || regions.Count < 1) + { + MainConsole.Instance.Output("Region not found"); + return; + } + + MainConsole.Instance.Output("Region Name Region UUID"); + MainConsole.Instance.Output("Location URI"); + MainConsole.Instance.Output("Owner ID Flags"); + MainConsole.Instance.Output("-------------------------------------------------------------------------------"); + foreach (RegionData r in regions) + { + OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]); + MainConsole.Instance.Output(String.Format("{0,-20} {1}\n{2,-20} {3}\n{4,-39} {5}\n\n", + r.RegionName, r.RegionID, + String.Format("{0},{1}", r.posX, r.posY), "http://" + r.Data["serverIP"].ToString() + ":" + r.Data["serverPort"].ToString(), + r.Data["owner_uuid"].ToString(), flags.ToString())); + } + return; + } + + private int ParseFlags(int prev, string flags) + { + OpenSim.Data.RegionFlags f = (OpenSim.Data.RegionFlags)prev; + + string[] parts = flags.Split(new char[] {',', ' '}, StringSplitOptions.RemoveEmptyEntries); + + foreach (string p in parts) + { + int val; + + try + { + if (p.StartsWith("+")) + { + val = (int)Enum.Parse(typeof(OpenSim.Data.RegionFlags), p.Substring(1)); + f |= (OpenSim.Data.RegionFlags)val; + } + else if (p.StartsWith("-")) + { + val = (int)Enum.Parse(typeof(OpenSim.Data.RegionFlags), p.Substring(1)); + f &= ~(OpenSim.Data.RegionFlags)val; + } + else + { + val = (int)Enum.Parse(typeof(OpenSim.Data.RegionFlags), p); + f |= (OpenSim.Data.RegionFlags)val; + } + } + catch (Exception e) + { + } + } + return (int)f; + } + + private void HandleSetFlags(string module, string[] cmd) + { + if (m_RootInstance != this) + return; + + if (cmd.Length < 4) + { + MainConsole.Instance.Output("Syntax: set region flags "); + return; + } + MainConsole.Instance.Output(ParseFlags(0, cmd[3]).ToString()); } } } -- cgit v1.1 From d889d4e1fa9f921a4f8f4f128218bf1d4454071e Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 10 Jan 2010 01:46:34 +0000 Subject: Finally the region service config stuff is in. --- OpenSim/Services/GridService/GridService.cs | 68 +++++++++++++++++++++-------- 1 file changed, 51 insertions(+), 17 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index d6232ac..0fd2934 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -48,33 +48,45 @@ namespace OpenSim.Services.GridService private bool m_DeleteOnUnregister = true; private static GridService m_RootInstance = null; + protected IConfigSource m_config; public GridService(IConfigSource config) : base(config) { m_log.DebugFormat("[GRID SERVICE]: Starting..."); - if (m_RootInstance == null) - m_RootInstance = this; - + m_config = config; IConfig gridConfig = config.Configs["GridService"]; if (gridConfig != null) { m_DeleteOnUnregister = gridConfig.GetBoolean("DeleteOnUnregister", true); } - MainConsole.Instance.Commands.AddCommand("grid", true, - "show region", - "show region ", - "Show details on a region", - "Display all details about a registered grid region", - HandleShowRegion); + if (m_RootInstance == null) + { + m_RootInstance = this; + + MainConsole.Instance.Commands.AddCommand("grid", true, + "show region", + "show region ", + "Show details on a region", + String.Empty, + HandleShowRegion); + + MainConsole.Instance.Commands.AddCommand("grid", true, + "set region flags", + "set region flags ", + "Set database flags for region", + String.Empty, + HandleSetFlags); + } } #region IGridService public bool RegisterRegion(UUID scopeID, GridRegion regionInfos) { + IConfig gridConfig = m_config.Configs["GridService"]; // This needs better sanity testing. What if regionInfo is registering in // overlapping coords? RegionData region = m_Database.Get(regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID); @@ -104,12 +116,23 @@ namespace OpenSim.Services.GridService // Everything is ok, let's register RegionData rdata = RegionInfo2RegionData(regionInfos); rdata.ScopeID = scopeID; - rdata.Data["flags"] = "0"; if (region != null) { rdata.Data["flags"] = region.Data["flags"]; // Preserve fields } + else + { + rdata.Data["flags"] = "0"; + if (gridConfig != null) + { + int newFlags = 0; + newFlags = ParseFlags(newFlags, gridConfig.GetString("Region_" + rdata.RegionName, String.Empty)); + newFlags = ParseFlags(newFlags, gridConfig.GetString("Region_" + rdata.RegionID.ToString(), String.Empty)); + rdata.Data["flags"] = newFlags.ToString(); + } + } + int flags = Convert.ToInt32(rdata.Data["flags"]); flags |= (int)OpenSim.Data.RegionFlags.RegionOnline; rdata.Data["flags"] = flags.ToString(); @@ -302,9 +325,6 @@ namespace OpenSim.Services.GridService private void HandleShowRegion(string module, string[] cmd) { - if (m_RootInstance != this) - return; - if (cmd.Length != 3) { MainConsole.Instance.Output("Syntax: show region "); @@ -362,6 +382,7 @@ namespace OpenSim.Services.GridService } catch (Exception e) { + MainConsole.Instance.Output("Error in flag specification: " + p); } } @@ -370,16 +391,29 @@ namespace OpenSim.Services.GridService private void HandleSetFlags(string module, string[] cmd) { - if (m_RootInstance != this) + if (cmd.Length < 5) + { + MainConsole.Instance.Output("Syntax: set region flags "); return; + } - if (cmd.Length < 4) + List regions = m_Database.Get(cmd[3], UUID.Zero); + if (regions == null || regions.Count < 1) { - MainConsole.Instance.Output("Syntax: set region flags "); + MainConsole.Instance.Output("Region not found"); return; } - MainConsole.Instance.Output(ParseFlags(0, cmd[3]).ToString()); + foreach (RegionData r in regions) + { + int flags = Convert.ToInt32(r.Data["flags"]); + flags = ParseFlags(flags, cmd[4]); + r.Data["flags"] = flags.ToString(); + OpenSim.Data.RegionFlags f = (OpenSim.Data.RegionFlags)flags; + + MainConsole.Instance.Output(String.Format("Set region {0} to {1}", r.RegionName, f)); + m_Database.Store(r); + } } } } -- cgit v1.1 From 21de921b95da3d6fe94284365d836d71f3295a41 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 10 Jan 2010 02:07:10 +0000 Subject: Make the new API return only the regions that are marked online --- OpenSim/Services/GridService/GridService.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 0fd2934..3ae51e4 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -299,7 +299,10 @@ namespace OpenSim.Services.GridService List regions = m_Database.GetDefaultRegions(scopeID); foreach (RegionData r in regions) - ret.Add(RegionData2RegionInfo(r)); + { + if ((Convert.ToInt32(r.Data["flags"]) & (int)OpenSim.Data.RegionFlags.RegionOnline) != 0) + ret.Add(RegionData2RegionInfo(r)); + } return ret; } @@ -311,7 +314,10 @@ namespace OpenSim.Services.GridService List regions = m_Database.GetFallbackRegions(scopeID, x, y); foreach (RegionData r in regions) - ret.Add(RegionData2RegionInfo(r)); + { + if ((Convert.ToInt32(r.Data["flags"]) & (int)OpenSim.Data.RegionFlags.RegionOnline) != 0) + ret.Add(RegionData2RegionInfo(r)); + } return ret; } -- cgit v1.1 From e189b3056fff7223f6474bc26af559ef32891fa6 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 10 Jan 2010 02:13:55 +0000 Subject: Add last_seen field to regions table --- OpenSim/Services/GridService/GridService.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 3ae51e4..9bf986e 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -139,6 +139,7 @@ namespace OpenSim.Services.GridService try { + rdata.Data["last_seen"] = Util.UnixTimeSinceEpoch(); m_Database.Store(rdata); } catch (Exception e) @@ -164,6 +165,7 @@ namespace OpenSim.Services.GridService int flags = Convert.ToInt32(region.Data["flags"]); flags &= ~(int)OpenSim.Data.RegionFlags.RegionOnline; region.Data["flags"] = flags.ToString(); + region.Data["last_seen"] = Util.UnixTimeSinceEpoch(); try { m_Database.Store(region); -- cgit v1.1 From 9727e3d66b7324a2fa63e1cd95a77e2a82882723 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 10 Jan 2010 02:44:57 +0000 Subject: Add "Persistent" flag to regions table flags values --- OpenSim/Services/GridService/GridService.cs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 9bf986e..66bbff0 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -156,13 +156,14 @@ namespace OpenSim.Services.GridService public bool DeregisterRegion(UUID regionID) { m_log.DebugFormat("[GRID SERVICE]: Region {0} deregistered", regionID); - if (!m_DeleteOnUnregister) - { - RegionData region = m_Database.Get(regionID, UUID.Zero); - if (region == null) - return false; + RegionData region = m_Database.Get(regionID, UUID.Zero); + if (region == null) + return false; - int flags = Convert.ToInt32(region.Data["flags"]); + int flags = Convert.ToInt32(region.Data["flags"]); + + if (!m_DeleteOnUnregister || (flags & (int)OpenSim.Data.RegionFlags.Persistent) != 0) + { flags &= ~(int)OpenSim.Data.RegionFlags.RegionOnline; region.Data["flags"] = flags.ToString(); region.Data["last_seen"] = Util.UnixTimeSinceEpoch(); -- cgit v1.1 From 78e9dc7c2c71a2d1cfda7b39dfbc12ddbb64233b Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 10 Jan 2010 04:23:23 +0000 Subject: Add a "LockedOut" flag to allow locking a region out via the grid server. This flag prevents registration of a known region --- OpenSim/Services/GridService/GridService.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 66bbff0..c48b10c 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -119,6 +119,9 @@ namespace OpenSim.Services.GridService if (region != null) { + if ((Convert.ToInt32(region.Data["flags"]) & (int)OpenSim.Data.RegionFlags.LockedOut) != 0) + return false; + rdata.Data["flags"] = region.Data["flags"]; // Preserve fields } else -- cgit v1.1 From 7467a471ca2d3e6066f89d8bca4ba956e07fbb6b Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 11 Jan 2010 22:52:05 +0000 Subject: Add the option to reject duplicate region names --- OpenSim/Services/GridService/GridService.cs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 86815e5..a500593 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -46,10 +46,18 @@ namespace OpenSim.Services.GridService LogManager.GetLogger( MethodBase.GetCurrentMethod().DeclaringType); + protected bool m_AllowDuplicateNames = false; + public GridService(IConfigSource config) : base(config) { m_log.DebugFormat("[GRID SERVICE]: Starting..."); + + IConfig gridConfig = config.Configs["GridService"]; + if (gridConfig != null) + { + m_AllowDuplicateNames = gridConfig.GetBoolean("AllowDuplicateNames", m_AllowDuplicateNames); + } } #region IGridService @@ -82,6 +90,23 @@ namespace OpenSim.Services.GridService } } + if (!m_AllowDuplicateNames) + { + List dupe = m_Database.Get(regionInfos.RegionName, scopeID); + if (dupe != null && dupe.Count > 0) + { + foreach (RegionData d in dupe) + { + if (d.RegionID != regionInfos.RegionID) + { + m_log.WarnFormat("[GRID SERVICE]: Region {0} tried to register duplicate name with ID {1}.", + regionInfos.RegionName, regionInfos.RegionID); + return false; + } + } + } + } + // Everything is ok, let's register RegionData rdata = RegionInfo2RegionData(regionInfos); rdata.ScopeID = scopeID; -- cgit v1.1 From e3a04fcb7b6510b46bc4e24b9a1bc6e321774ac3 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 13 Jan 2010 03:08:34 +0000 Subject: Change the error messages on region region registration. This changes URM and region. The non-error case should be compatible, so no version bump. Untested. --- OpenSim/Services/GridService/GridService.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index a500593..7749c37 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -62,7 +62,7 @@ namespace OpenSim.Services.GridService #region IGridService - public bool RegisterRegion(UUID scopeID, GridRegion regionInfos) + public string RegisterRegion(UUID scopeID, GridRegion regionInfos) { // This needs better sanity testing. What if regionInfo is registering in // overlapping coords? @@ -71,7 +71,7 @@ namespace OpenSim.Services.GridService { m_log.WarnFormat("[GRID SERVICE]: Region {0} tried to register in coordinates {1}, {2} which are already in use in scope {3}.", regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID); - return false; + return "Region overlaps another region"; } if ((region != null) && (region.RegionID == regionInfos.RegionID) && ((region.posX != regionInfos.RegionLocX) || (region.posY != regionInfos.RegionLocY))) @@ -101,7 +101,7 @@ namespace OpenSim.Services.GridService { m_log.WarnFormat("[GRID SERVICE]: Region {0} tried to register duplicate name with ID {1}.", regionInfos.RegionName, regionInfos.RegionID); - return false; + return "Duplicate region name"; } } } @@ -122,7 +122,7 @@ namespace OpenSim.Services.GridService m_log.DebugFormat("[GRID SERVICE]: Region {0} ({1}) registered successfully at {2}-{3}", regionInfos.RegionName, regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY); - return true; + return String.Empty; } public bool DeregisterRegion(UUID regionID) -- cgit v1.1 From ab021aaa25d4ec4874ddc06eee77af9944d75926 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 13 Jan 2010 15:42:43 -0800 Subject: Make region flag specs work for regions whose names contain spaces. Uses underscore in place of spaces. Region_Word1_Word2. --- OpenSim/Services/GridService/GridService.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index c48b10c..4f93ce5 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -127,10 +127,11 @@ namespace OpenSim.Services.GridService else { rdata.Data["flags"] = "0"; - if (gridConfig != null) + if ((gridConfig != null) && rdata.RegionName != string.Empty) { int newFlags = 0; - newFlags = ParseFlags(newFlags, gridConfig.GetString("Region_" + rdata.RegionName, String.Empty)); + string regionName = rdata.RegionName.Trim().Replace(' ', '_'); + newFlags = ParseFlags(newFlags, gridConfig.GetString("Region_" + regionName, String.Empty)); newFlags = ParseFlags(newFlags, gridConfig.GetString("Region_" + rdata.RegionID.ToString(), String.Empty)); rdata.Data["flags"] = newFlags.ToString(); } -- cgit v1.1 From 344d27b19d4a1b0ca98a1e7cc4932eb996a9d59c Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 15 Jan 2010 21:23:59 +0000 Subject: Implement the NoMove behavior. Cause Reservation flag to be reset on first connect --- OpenSim/Services/GridService/GridService.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 4f93ce5..6e2c0d7 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -99,6 +99,9 @@ namespace OpenSim.Services.GridService if ((region != null) && (region.RegionID == regionInfos.RegionID) && ((region.posX != regionInfos.RegionLocX) || (region.posY != regionInfos.RegionLocY))) { + if ((Convert.ToInt32(region.Data["flags"]) & (int)OpenSim.Data.RegionFlags.NoMove) != 0) + return false; + // Region reregistering in other coordinates. Delete the old entry m_log.DebugFormat("[GRID SERVICE]: Region {0} ({1}) was previously registered at {2}-{3}. Deleting old entry.", regionInfos.RegionName, regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY); @@ -119,10 +122,13 @@ namespace OpenSim.Services.GridService if (region != null) { - if ((Convert.ToInt32(region.Data["flags"]) & (int)OpenSim.Data.RegionFlags.LockedOut) != 0) + int oldFlags = Convert.ToInt32(region.Data["flags"]); + if ((oldFlags & (int)OpenSim.Data.RegionFlags.LockedOut) != 0) return false; - rdata.Data["flags"] = region.Data["flags"]; // Preserve fields + oldFlags &= ~(int)OpenSim.Data.RegionFlags.Reservation; + + rdata.Data["flags"] = oldFlags.ToString(); // Preserve flags } else { -- cgit v1.1 From d49cc7ca905a54f72707e5fa728c4dfa68a514fb Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 15 Jan 2010 21:35:10 +0000 Subject: Implement "Reservation" flag behavior. --- OpenSim/Services/GridService/GridService.cs | 34 +++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 6e2c0d7..6826940 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -90,6 +90,40 @@ namespace OpenSim.Services.GridService // This needs better sanity testing. What if regionInfo is registering in // overlapping coords? RegionData region = m_Database.Get(regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID); + if (region != null) + { + // There is a preexisting record + // + // Get it's flags + // + OpenSim.Data.RegionFlags rflags = (OpenSim.Data.RegionFlags)Convert.ToInt32(region.Data["Flags"]); + + // Is this a reservation? + // + if ((rflags & OpenSim.Data.RegionFlags.Reservation) != 0) + { + // Regions reserved for the null key cannot be taken. + // + if (region.Data["PrincipalID"] == UUID.Zero.ToString()) + return false; + + // Treat it as an auth request + // + // NOTE: Fudging the flags value here, so these flags + // should not be used elsewhere. Don't optimize + // this with the later retrieval of the same flags! + // + rflags |= OpenSim.Data.RegionFlags.Authenticate; + } + + if ((rflags & OpenSim.Data.RegionFlags.Authenticate) != 0) + { + // TODO: Authenticate the principal + + return false; + } + } + if ((region != null) && (region.RegionID != regionInfos.RegionID)) { m_log.WarnFormat("[GRID SERVICE]: Region {0} tried to register in coordinates {1}, {2} which are already in use in scope {3}.", -- cgit v1.1 From 686660650b4f5724fc0b4858d50ff4deeafb8ffe Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 15 Jan 2010 21:57:31 +0000 Subject: Implement region registration with authentication --- OpenSim/Services/GridService/GridService.cs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 6826940..5c55c0b 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -34,6 +34,7 @@ using log4net; using OpenSim.Framework; using OpenSim.Framework.Console; using OpenSim.Data; +using OpenSim.Server.Base; using OpenSim.Services.Interfaces; using GridRegion = OpenSim.Services.Interfaces.GridRegion; using OpenMetaverse; @@ -50,6 +51,8 @@ namespace OpenSim.Services.GridService private static GridService m_RootInstance = null; protected IConfigSource m_config; + protected IAuthenticationService m_AuthenticationService = null; + public GridService(IConfigSource config) : base(config) { @@ -60,6 +63,14 @@ namespace OpenSim.Services.GridService if (gridConfig != null) { m_DeleteOnUnregister = gridConfig.GetBoolean("DeleteOnUnregister", true); + + string authService = gridConfig.GetString("AuthenticationService", String.Empty); + + if (authService != String.Empty) + { + Object[] args = new Object[] { config }; + m_AuthenticationService = ServerUtils.LoadPlugin(authService, args); + } } if (m_RootInstance == null) @@ -118,7 +129,13 @@ namespace OpenSim.Services.GridService if ((rflags & OpenSim.Data.RegionFlags.Authenticate) != 0) { - // TODO: Authenticate the principal + // Can we authenticate at all? + // + if (m_AuthenticationService == null) + return false; + + if (!m_AuthenticationService.Verify(new UUID(region.Data["PrincipalID"].ToString()), regionInfos.Token, 30)) + return false; return false; } -- cgit v1.1 From bbbe9e73cca2a0ed5d35db1b054b8ed4cd23bfea Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 18 Jan 2010 09:14:19 -0800 Subject: * Fixed misspelling of field in GridService * Moved TeleportClientHome to EntityTransferModule --- OpenSim/Services/GridService/GridService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index e912705..9e0790c 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -109,7 +109,7 @@ namespace OpenSim.Services.GridService // // Get it's flags // - OpenSim.Data.RegionFlags rflags = (OpenSim.Data.RegionFlags)Convert.ToInt32(region.Data["Flags"]); + OpenSim.Data.RegionFlags rflags = (OpenSim.Data.RegionFlags)Convert.ToInt32(region.Data["flags"]); // Is this a reservation? // -- cgit v1.1 From 48b03c2c61a422c3ac9843892a2ae93b29a9f7b8 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 24 Jan 2010 14:30:48 -0800 Subject: Integrated the hyperlinking with the GridService. --- OpenSim/Services/GridService/GridService.cs | 7 +- OpenSim/Services/GridService/HypergridLinker.cs | 614 ++++++++++++++++++++++++ 2 files changed, 619 insertions(+), 2 deletions(-) create mode 100644 OpenSim/Services/GridService/HypergridLinker.cs (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 9e0790c..ae29a74 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -50,6 +50,7 @@ namespace OpenSim.Services.GridService private bool m_DeleteOnUnregister = true; private static GridService m_RootInstance = null; protected IConfigSource m_config; + protected HypergridLinker m_HypergridLinker; protected IAuthenticationService m_AuthenticationService = null; protected bool m_AllowDuplicateNames = false; @@ -92,6 +93,8 @@ namespace OpenSim.Services.GridService "Set database flags for region", String.Empty, HandleSetFlags); + + m_HypergridLinker = new HypergridLinker(m_config, this, m_Database); } } @@ -346,7 +349,7 @@ namespace OpenSim.Services.GridService #region Data structure conversions - protected RegionData RegionInfo2RegionData(GridRegion rinfo) + public RegionData RegionInfo2RegionData(GridRegion rinfo) { RegionData rdata = new RegionData(); rdata.posX = (int)rinfo.RegionLocX; @@ -359,7 +362,7 @@ namespace OpenSim.Services.GridService return rdata; } - protected GridRegion RegionData2RegionInfo(RegionData rdata) + public GridRegion RegionData2RegionInfo(RegionData rdata) { GridRegion rinfo = new GridRegion(rdata.Data); rinfo.RegionLocX = rdata.posX; diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs new file mode 100644 index 0000000..b0cf723 --- /dev/null +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -0,0 +1,614 @@ +/* + * 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 System.Net; +using System.Reflection; +using System.Xml; + +using Nini.Config; +using log4net; +using OpenSim.Framework; +using OpenSim.Framework.Console; +using OpenSim.Data; +using OpenSim.Server.Base; +using OpenSim.Services.Interfaces; +using OpenSim.Services.Connectors.Hypergrid; +using GridRegion = OpenSim.Services.Interfaces.GridRegion; +using OpenMetaverse; + +namespace OpenSim.Services.GridService +{ + public class HypergridLinker + { + private static readonly ILog m_log = + LogManager.GetLogger( + MethodBase.GetCurrentMethod().DeclaringType); + + private static UUID m_HGMapImage = new UUID("00000000-0000-1111-9999-000000000013"); + + private static uint m_autoMappingX = 0; + private static uint m_autoMappingY = 0; + private static bool m_enableAutoMapping = false; + + protected IRegionData m_Database; + protected GridService m_GridService; + protected IAssetService m_AssetService; + protected GatekeeperServiceConnector m_GatekeeperConnector; + + protected UUID m_ScopeID = UUID.Zero; + + // Hyperlink regions are hyperlinks on the map + public readonly Dictionary m_HyperlinkRegions = new Dictionary(); + protected Dictionary m_HyperlinkHandles = new Dictionary(); + + protected GridRegion m_DefaultRegion; + protected GridRegion DefaultRegion + { + get + { + if (m_DefaultRegion == null) + { + List defs = m_GridService.GetDefaultRegions(m_ScopeID); + if (defs != null && defs.Count > 0) + m_DefaultRegion = defs[0]; + else + { + // Best guess, may be totally off + m_DefaultRegion = new GridRegion(1000, 1000); + m_log.WarnFormat("[HYPERGRID LINKER]: This grid does not have a default region. Assuming default coordinates at 1000, 1000."); + } + } + return m_DefaultRegion; + } + } + + public HypergridLinker(IConfigSource config, GridService gridService, IRegionData db) + { + m_log.DebugFormat("[HYPERGRID LINKER]: Starting..."); + + m_Database = db; + m_GridService = gridService; + + IConfig gridConfig = config.Configs["GridService"]; + if (gridConfig != null) + { + string assetService = gridConfig.GetString("AssetService", string.Empty); + + Object[] args = new Object[] { config }; + + if (assetService != string.Empty) + m_AssetService = ServerUtils.LoadPlugin(assetService, args); + + string scope = gridConfig.GetString("ScopeID", string.Empty); + if (scope != string.Empty) + UUID.TryParse(scope, out m_ScopeID); + + m_GatekeeperConnector = new GatekeeperServiceConnector(m_AssetService); + + m_log.DebugFormat("[HYPERGRID LINKER]: Loaded all services..."); + } + + + MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", + "link-region :[:] ", + "Link a hypergrid region", RunCommand); + MainConsole.Instance.Commands.AddCommand("hypergrid", false, "unlink-region", + "unlink-region or : ", + "Unlink a hypergrid region", RunCommand); + MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-mapping", "link-mapping [ ] ", + "Set local coordinate to map HG regions to", RunCommand); + MainConsole.Instance.Commands.AddCommand("hypergrid", false, "show hyperlinks", "show hyperlinks ", + "List the HG regions", HandleShow); + } + + + #region Link Region + + public bool LinkRegion(string regionDescriptor, out UUID regionID, out ulong regionHandle, out string imageURL, out string reason) + { + regionID = UUID.Zero; + imageURL = string.Empty; + regionHandle = 0; + reason = string.Empty; + int xloc = random.Next(0, Int16.MaxValue) * (int)Constants.RegionSize; + GridRegion region = TryLinkRegionToCoords(regionDescriptor, xloc, 0, out reason); + if (region == null) + return false; + + regionID = region.RegionID; + regionHandle = region.RegionHandle; + return true; + } + + private static Random random = new Random(); + + // From the command line link-region + public GridRegion TryLinkRegionToCoords(string mapName, int xloc, int yloc, out string reason) + { + reason = string.Empty; + 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]; + //m_log.Debug("-- port = " + portstr); + if (!UInt32.TryParse(portstr, out port)) + regionName = parts[1]; + } + // always take the last one + if (parts.Length >= 3) + { + regionName = parts[2]; + } + + // Sanity check. Don't ever link to this sim. + IPAddress ipaddr = null; + try + { + ipaddr = Util.GetHostFromDNS(host); + } + catch { } + + GridRegion regInfo; + bool success = TryCreateLink(xloc, yloc, regionName, port, host, out regInfo, out reason); + if (success) + { + regInfo.RegionName = mapName; + return regInfo; + } + + return null; + } + + + // From the command line and the 2 above + public bool TryCreateLink(int xloc, int yloc, + string externalRegionName, uint externalPort, string externalHostName, out GridRegion regInfo, out string reason) + { + m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}, in {2}-{3}", externalHostName, externalPort, xloc, yloc); + + reason = string.Empty; + regInfo = new GridRegion(); + regInfo.RegionName = externalRegionName; + regInfo.HttpPort = externalPort; + regInfo.ExternalHostName = externalHostName; + regInfo.RegionLocX = xloc; + regInfo.RegionLocY = yloc; + + try + { + regInfo.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int)0); + } + catch (Exception e) + { + m_log.Warn("[HYPERGRID LINKER]: Wrong format for link-region: " + e.Message); + reason = "Internal error"; + return false; + } + + // Finally, link it + ulong handle = 0; + UUID regionID = UUID.Zero; + string imageURL = string.Empty; + if (!m_GatekeeperConnector.LinkRegion(regInfo, out regionID, out handle, out imageURL, out reason)) + return false; + + if (regionID != UUID.Zero) + { + regInfo.RegionID = regionID; + // Try get the map image + regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL); + // I need a texture that works for this... the one I tried doesn't seem to be working + //regInfo.TerrainImage = m_HGMapImage; + + AddHyperlinkRegion(regInfo, handle); + m_log.Info("[HYPERGRID LINKER]: Successfully linked to region_uuid " + regInfo.RegionID); + + } + else + { + m_log.Warn("[HYPERGRID LINKER]: Unable to link region"); + reason = "Remote region could not be found"; + return false; + } + + uint x, y; + if (!Check4096(handle, out x, out y)) + { + RemoveHyperlinkRegion(regInfo.RegionID); + reason = "Region is too far (" + x + ", " + y + ")"; + m_log.Info("[HYPERGRID LINKER]: Unable to link, region is too far (" + x + ", " + y + ")"); + return false; + } + + m_log.Debug("[HYPERGRID LINKER]: link region succeeded"); + return true; + } + + public bool TryUnlinkRegion(string mapName) + { + GridRegion 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]; + } + + foreach (GridRegion r in m_HyperlinkRegions.Values) + if (host.Equals(r.ExternalHostName) && (port == r.HttpPort)) + regInfo = r; + } + else + { + foreach (GridRegion r in m_HyperlinkRegions.Values) + if (r.RegionName.Equals(mapName)) + regInfo = r; + } + if (regInfo != null) + { + RemoveHyperlinkRegion(regInfo.RegionID); + return true; + } + else + { + m_log.InfoFormat("[HYPERGRID LINKER]: Region {0} not found", mapName); + return false; + } + } + + /// + /// Cope with this viewer limitation. + /// + /// + /// + 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)) + { + return false; + } + return true; + } + + private void AddHyperlinkRegion(GridRegion regionInfo, ulong regionHandle) + { + //m_HyperlinkRegions[regionInfo.RegionID] = regionInfo; + //m_HyperlinkHandles[regionInfo.RegionID] = regionHandle; + + RegionData rdata = m_GridService.RegionInfo2RegionData(regionInfo); + int flags = (int)OpenSim.Data.RegionFlags.Hyperlink + (int)OpenSim.Data.RegionFlags.NoDirectLogin + (int)OpenSim.Data.RegionFlags.RegionOnline; + rdata.Data["flags"] = flags.ToString(); + + m_Database.Store(rdata); + + } + + private void RemoveHyperlinkRegion(UUID regionID) + { + //// Try the hyperlink collection + //if (m_HyperlinkRegions.ContainsKey(regionID)) + //{ + // m_HyperlinkRegions.Remove(regionID); + // m_HyperlinkHandles.Remove(regionID); + //} + m_Database.Delete(regionID); + } + + #endregion + + + #region Console Commands + + public void HandleShow(string module, string[] cmd) + { + MainConsole.Instance.Output("Not Implemented Yet"); + //if (cmd.Length != 2) + //{ + // MainConsole.Instance.Output("Syntax: show hyperlinks"); + // return; + //} + //List regions = new List(m_HypergridService.m_HyperlinkRegions.Values); + //if (regions == null || regions.Count < 1) + //{ + // MainConsole.Instance.Output("No hyperlinks"); + // return; + //} + + //MainConsole.Instance.Output("Region Name Region UUID"); + //MainConsole.Instance.Output("Location URI"); + //MainConsole.Instance.Output("Owner ID "); + //MainConsole.Instance.Output("-------------------------------------------------------------------------------"); + //foreach (GridRegion r in regions) + //{ + // MainConsole.Instance.Output(String.Format("{0,-20} {1}\n{2,-20} {3}\n{4,-39} \n\n", + // r.RegionName, r.RegionID, + // String.Format("{0},{1}", r.RegionLocX, r.RegionLocY), "http://" + r.ExternalHostName + ":" + r.HttpPort.ToString(), + // r.EstateOwner.ToString())); + //} + //return; + } + public void RunCommand(string module, string[] cmdparams) + { + List args = new List(cmdparams); + if (args.Count < 1) + return; + + string command = args[0]; + args.RemoveAt(0); + + cmdparams = args.ToArray(); + + RunHGCommand(command, cmdparams); + + } + + private void RunHGCommand(string command, string[] cmdparams) + { + if (command.Equals("link-mapping")) + { + if (cmdparams.Length == 2) + { + try + { + m_autoMappingX = Convert.ToUInt32(cmdparams[0]); + m_autoMappingY = Convert.ToUInt32(cmdparams[1]); + m_enableAutoMapping = true; + } + catch (Exception) + { + m_autoMappingX = 0; + m_autoMappingY = 0; + m_enableAutoMapping = false; + } + } + } + else if (command.Equals("link-region")) + { + if (cmdparams.Length < 3) + { + if ((cmdparams.Length == 1) || (cmdparams.Length == 2)) + { + LoadXmlLinkFile(cmdparams); + } + else + { + LinkRegionCmdUsage(); + } + return; + } + + if (cmdparams[2].Contains(":")) + { + // New format + int xloc, yloc; + string mapName; + try + { + xloc = Convert.ToInt32(cmdparams[0]); + yloc = Convert.ToInt32(cmdparams[1]); + mapName = cmdparams[2]; + if (cmdparams.Length > 3) + for (int i = 3; i < cmdparams.Length; i++) + mapName += " " + cmdparams[i]; + + //m_log.Info(">> MapName: " + mapName); + } + catch (Exception e) + { + MainConsole.Instance.Output("[HGrid] Wrong format for link-region command: " + e.Message); + LinkRegionCmdUsage(); + return; + } + + // Convert cell coordinates given by the user to meters + xloc = xloc * (int)Constants.RegionSize; + yloc = yloc * (int)Constants.RegionSize; + string reason = string.Empty; + if (TryLinkRegionToCoords(mapName, xloc, yloc, out reason) == null) + MainConsole.Instance.Output("Failed to link region: " + reason); + MainConsole.Instance.Output("Hyperlink estalished"); + } + else + { + // old format + GridRegion regInfo; + int xloc, yloc; + uint externalPort; + string externalHostName; + try + { + xloc = Convert.ToInt32(cmdparams[0]); + yloc = Convert.ToInt32(cmdparams[1]); + externalPort = Convert.ToUInt32(cmdparams[3]); + externalHostName = cmdparams[2]; + //internalPort = Convert.ToUInt32(cmdparams[4]); + //remotingPort = Convert.ToUInt32(cmdparams[5]); + } + catch (Exception e) + { + MainConsole.Instance.Output("[HGrid] Wrong format for link-region command: " + e.Message); + LinkRegionCmdUsage(); + return; + } + + // Convert cell coordinates given by the user to meters + xloc = xloc * (int)Constants.RegionSize; + yloc = yloc * (int)Constants.RegionSize; + string reason = string.Empty; + if (TryCreateLink(xloc, yloc, "", externalPort, externalHostName, out regInfo, out reason)) + { + if (cmdparams.Length >= 5) + { + regInfo.RegionName = ""; + for (int i = 4; i < cmdparams.Length; i++) + regInfo.RegionName += cmdparams[i] + " "; + } + } + } + return; + } + else if (command.Equals("unlink-region")) + { + if (cmdparams.Length < 1) + { + UnlinkRegionCmdUsage(); + return; + } + if (TryUnlinkRegion(cmdparams[0])) + MainConsole.Instance.Output("Successfully unlinked " + cmdparams[0]); + else + MainConsole.Instance.Output("Unable to unlink " + cmdparams[0] + ", region not found."); + } + } + + private void LoadXmlLinkFile(string[] cmdparams) + { + //use http://www.hgurl.com/hypergrid.xml for test + try + { + XmlReader r = XmlReader.Create(cmdparams[0]); + XmlConfigSource cs = new XmlConfigSource(r); + string[] excludeSections = null; + + if (cmdparams.Length == 2) + { + if (cmdparams[1].ToLower().StartsWith("excludelist:")) + { + string excludeString = cmdparams[1].ToLower(); + excludeString = excludeString.Remove(0, 12); + char[] splitter = { ';' }; + + excludeSections = excludeString.Split(splitter); + } + } + + for (int i = 0; i < cs.Configs.Count; i++) + { + bool skip = false; + if ((excludeSections != null) && (excludeSections.Length > 0)) + { + for (int n = 0; n < excludeSections.Length; n++) + { + if (excludeSections[n] == cs.Configs[i].Name.ToLower()) + { + skip = true; + break; + } + } + } + if (!skip) + { + ReadLinkFromConfig(cs.Configs[i]); + } + } + } + catch (Exception e) + { + m_log.Error(e.ToString()); + } + } + + + private void ReadLinkFromConfig(IConfig config) + { + GridRegion regInfo; + int xloc, yloc; + uint externalPort; + string externalHostName; + uint realXLoc, realYLoc; + + xloc = Convert.ToInt32(config.GetString("xloc", "0")); + yloc = Convert.ToInt32(config.GetString("yloc", "0")); + externalPort = Convert.ToUInt32(config.GetString("externalPort", "0")); + externalHostName = config.GetString("externalHostName", ""); + realXLoc = Convert.ToUInt32(config.GetString("real-xloc", "0")); + realYLoc = Convert.ToUInt32(config.GetString("real-yloc", "0")); + + if (m_enableAutoMapping) + { + xloc = (int)((xloc % 100) + m_autoMappingX); + yloc = (int)((yloc % 100) + m_autoMappingY); + } + + if (((realXLoc == 0) && (realYLoc == 0)) || + (((realXLoc - xloc < 3896) || (xloc - realXLoc < 3896)) && + ((realYLoc - yloc < 3896) || (yloc - realYLoc < 3896)))) + { + xloc = xloc * (int)Constants.RegionSize; + yloc = yloc * (int)Constants.RegionSize; + string reason = string.Empty; + if (TryCreateLink(xloc, yloc, "", externalPort, + externalHostName, out regInfo, out reason)) + { + regInfo.RegionName = config.GetString("localName", ""); + } + else + MainConsole.Instance.Output("Unable to link " + externalHostName + ": " + reason); + } + } + + + private void LinkRegionCmdUsage() + { + MainConsole.Instance.Output("Usage: link-region :[:]"); + MainConsole.Instance.Output("Usage: link-region []"); + MainConsole.Instance.Output("Usage: link-region []"); + } + + private void UnlinkRegionCmdUsage() + { + MainConsole.Instance.Output("Usage: unlink-region :"); + MainConsole.Instance.Output("Usage: unlink-region "); + } + + #endregion + + } +} -- cgit v1.1 From ea3d287f70d48eb2d3abf6eb1506bf64674874c5 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 24 Jan 2010 15:04:41 -0800 Subject: Some method implementations were missing from LocalGridServiceConnector. --- OpenSim/Services/GridService/GridService.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index ae29a74..b86fd4d 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -410,7 +410,9 @@ namespace OpenSim.Services.GridService { RegionData region = m_Database.Get(regionID, scopeID); - return Convert.ToInt32(region.Data["flags"]); + int flags = Convert.ToInt32(region.Data["flags"]); + //m_log.DebugFormat("[GRID SERVICE]: Request for flags of {0}: {1}", regionID, flags); + return flags; } private void HandleShowRegion(string module, string[] cmd) -- cgit v1.1 From 8ddf787cfd090fc8f2715a6f2a5329348a12e28b Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 24 Jan 2010 16:00:28 -0800 Subject: Hypergrid map search back on, this time with a config var in the grid service. --- OpenSim/Services/GridService/GridService.cs | 20 +++++++++++-- OpenSim/Services/GridService/HypergridLinker.cs | 39 +++++++++++++------------ 2 files changed, 37 insertions(+), 22 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index b86fd4d..515d620 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -54,6 +54,7 @@ namespace OpenSim.Services.GridService protected IAuthenticationService m_AuthenticationService = null; protected bool m_AllowDuplicateNames = false; + protected bool m_AllowHypergridMapSearch = false; public GridService(IConfigSource config) : base(config) @@ -74,6 +75,7 @@ namespace OpenSim.Services.GridService m_AuthenticationService = ServerUtils.LoadPlugin(authService, args); } m_AllowDuplicateNames = gridConfig.GetBoolean("AllowDuplicateNames", m_AllowDuplicateNames); + m_AllowHypergridMapSearch = gridConfig.GetBoolean("AllowHypergridMapSearch", m_AllowHypergridMapSearch); } if (m_RootInstance == null) @@ -327,6 +329,13 @@ namespace OpenSim.Services.GridService } } + if (m_AllowHypergridMapSearch && rdatas.Count == 0 && name.Contains(".")) + { + GridRegion r = m_HypergridLinker.LinkRegion(scopeID, name); + if (r != null) + rinfos.Add(r); + } + return rinfos; } @@ -410,9 +419,14 @@ namespace OpenSim.Services.GridService { RegionData region = m_Database.Get(regionID, scopeID); - int flags = Convert.ToInt32(region.Data["flags"]); - //m_log.DebugFormat("[GRID SERVICE]: Request for flags of {0}: {1}", regionID, flags); - return flags; + if (region != null) + { + int flags = Convert.ToInt32(region.Data["flags"]); + //m_log.DebugFormat("[GRID SERVICE]: Request for flags of {0}: {1}", regionID, flags); + return flags; + } + else + return -1; } private void HandleShowRegion(string module, string[] cmd) diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index b0cf723..1289cf6 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -130,26 +130,17 @@ namespace OpenSim.Services.GridService #region Link Region - public bool LinkRegion(string regionDescriptor, out UUID regionID, out ulong regionHandle, out string imageURL, out string reason) + public GridRegion LinkRegion(UUID scopeID, string regionDescriptor) { - regionID = UUID.Zero; - imageURL = string.Empty; - regionHandle = 0; - reason = string.Empty; + string reason = string.Empty; int xloc = random.Next(0, Int16.MaxValue) * (int)Constants.RegionSize; - GridRegion region = TryLinkRegionToCoords(regionDescriptor, xloc, 0, out reason); - if (region == null) - return false; - - regionID = region.RegionID; - regionHandle = region.RegionHandle; - return true; + return TryLinkRegionToCoords(scopeID, regionDescriptor, xloc, 0, out reason); } private static Random random = new Random(); // From the command line link-region - public GridRegion TryLinkRegionToCoords(string mapName, int xloc, int yloc, out string reason) + public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, out string reason) { reason = string.Empty; string host = "127.0.0.1"; @@ -183,7 +174,7 @@ namespace OpenSim.Services.GridService catch { } GridRegion regInfo; - bool success = TryCreateLink(xloc, yloc, regionName, port, host, out regInfo, out reason); + bool success = TryCreateLink(scopeID, xloc, yloc, regionName, port, host, out regInfo, out reason); if (success) { regInfo.RegionName = mapName; @@ -195,7 +186,7 @@ namespace OpenSim.Services.GridService // From the command line and the 2 above - public bool TryCreateLink(int xloc, int yloc, + public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string externalRegionName, uint externalPort, string externalHostName, out GridRegion regInfo, out string reason) { m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}, in {2}-{3}", externalHostName, externalPort, xloc, yloc); @@ -207,6 +198,7 @@ namespace OpenSim.Services.GridService regInfo.ExternalHostName = externalHostName; regInfo.RegionLocX = xloc; regInfo.RegionLocY = yloc; + regInfo.ScopeID = scopeID; try { @@ -228,7 +220,16 @@ namespace OpenSim.Services.GridService if (regionID != UUID.Zero) { + GridRegion r = m_GridService.GetRegionByUUID(scopeID, regionID); + if (r != null) + { + m_log.DebugFormat("[HYPERGRID LINKER]: Region already exists in coordinates {0} {1}", r.RegionLocX / Constants.RegionSize, r.RegionLocY / Constants.RegionSize); + regInfo = r; + return true; + } + regInfo.RegionID = regionID; + regInfo.RegionName = regInfo.ExternalHostName + ":" + regInfo.HttpPort + ":" + regInfo.RegionName; // Try get the map image regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL); // I need a texture that works for this... the one I tried doesn't seem to be working @@ -451,9 +452,9 @@ namespace OpenSim.Services.GridService xloc = xloc * (int)Constants.RegionSize; yloc = yloc * (int)Constants.RegionSize; string reason = string.Empty; - if (TryLinkRegionToCoords(mapName, xloc, yloc, out reason) == null) + if (TryLinkRegionToCoords(UUID.Zero, mapName, xloc, yloc, out reason) == null) MainConsole.Instance.Output("Failed to link region: " + reason); - MainConsole.Instance.Output("Hyperlink estalished"); + MainConsole.Instance.Output("Hyperlink established"); } else { @@ -482,7 +483,7 @@ namespace OpenSim.Services.GridService xloc = xloc * (int)Constants.RegionSize; yloc = yloc * (int)Constants.RegionSize; string reason = string.Empty; - if (TryCreateLink(xloc, yloc, "", externalPort, externalHostName, out regInfo, out reason)) + if (TryCreateLink(UUID.Zero, xloc, yloc, "", externalPort, externalHostName, out regInfo, out reason)) { if (cmdparams.Length >= 5) { @@ -584,7 +585,7 @@ namespace OpenSim.Services.GridService xloc = xloc * (int)Constants.RegionSize; yloc = yloc * (int)Constants.RegionSize; string reason = string.Empty; - if (TryCreateLink(xloc, yloc, "", externalPort, + if (TryCreateLink(UUID.Zero, xloc, yloc, "", externalPort, externalHostName, out regInfo, out reason)) { regInfo.RegionName = config.GetString("localName", ""); -- cgit v1.1 From 7c00469cd210cfdda3dd835867469159d4c8b9d9 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 27 Jan 2010 08:00:29 -0800 Subject: Added ExternalName config on Gatekeeper. --- OpenSim/Services/GridService/HypergridLinker.cs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 1289cf6..cda7dae 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -214,8 +214,9 @@ namespace OpenSim.Services.GridService // Finally, link it ulong handle = 0; UUID regionID = UUID.Zero; + string externalName = string.Empty; string imageURL = string.Empty; - if (!m_GatekeeperConnector.LinkRegion(regInfo, out regionID, out handle, out imageURL, out reason)) + if (!m_GatekeeperConnector.LinkRegion(regInfo, out regionID, out handle, out externalName, out imageURL, out reason)) return false; if (regionID != UUID.Zero) @@ -229,11 +230,22 @@ namespace OpenSim.Services.GridService } regInfo.RegionID = regionID; + Uri uri = null; + try + { + uri = new Uri(externalName); + regInfo.ExternalHostName = uri.Host; + regInfo.HttpPort = (uint)uri.Port; + } + catch + { + m_log.WarnFormat("[HYPERGRID LINKER]: Remote Gatekeeper at {0} provided malformed ExternalName {1}", regInfo.ExternalHostName, externalName); + } regInfo.RegionName = regInfo.ExternalHostName + ":" + regInfo.HttpPort + ":" + regInfo.RegionName; // Try get the map image - regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL); + //regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL); // I need a texture that works for this... the one I tried doesn't seem to be working - //regInfo.TerrainImage = m_HGMapImage; + regInfo.TerrainImage = m_HGMapImage; AddHyperlinkRegion(regInfo, handle); m_log.Info("[HYPERGRID LINKER]: Successfully linked to region_uuid " + regInfo.RegionID); -- cgit v1.1 From 1ab8458b1c8b3d687c66f4cb69b05e6fa938784c Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 30 Jan 2010 16:09:40 -0800 Subject: Bug fix for making cross-grid login work. --- OpenSim/Services/GridService/HypergridLinker.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index cda7dae..c0b635c 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -165,13 +165,17 @@ namespace OpenSim.Services.GridService regionName = parts[2]; } - // Sanity check. Don't ever link to this sim. + // Sanity check. IPAddress ipaddr = null; try { ipaddr = Util.GetHostFromDNS(host); } - catch { } + catch + { + reason = "Malformed hostname"; + return null; + } GridRegion regInfo; bool success = TryCreateLink(scopeID, xloc, yloc, regionName, port, host, out regInfo, out reason); -- cgit v1.1 From 35a245b67a44eaa62dbf7951646ad9818caa8b02 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 31 Jan 2010 22:35:23 -0800 Subject: Assorted bug fixes related to hyperlinking --- OpenSim/Services/GridService/GridService.cs | 3 ++- OpenSim/Services/GridService/HypergridLinker.cs | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 515d620..4dee7a4 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -329,7 +329,7 @@ namespace OpenSim.Services.GridService } } - if (m_AllowHypergridMapSearch && rdatas.Count == 0 && name.Contains(".")) + if (m_AllowHypergridMapSearch && rdatas == null || (rdatas != null && rdatas.Count == 0) && name.Contains(".")) { GridRegion r = m_HypergridLinker.LinkRegion(scopeID, name); if (r != null) @@ -412,6 +412,7 @@ namespace OpenSim.Services.GridService ret.Add(RegionData2RegionInfo(r)); } + m_log.DebugFormat("[GRID SERVICE]: Fallback returned {0} regions", ret.Count); return ret; } diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index c0b635c..18d0586 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -470,7 +470,8 @@ namespace OpenSim.Services.GridService string reason = string.Empty; if (TryLinkRegionToCoords(UUID.Zero, mapName, xloc, yloc, out reason) == null) MainConsole.Instance.Output("Failed to link region: " + reason); - MainConsole.Instance.Output("Hyperlink established"); + else + MainConsole.Instance.Output("Hyperlink established"); } else { -- cgit v1.1 From 70de6956ff6a3d833149156b6293122ef734b73d Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 21 Feb 2010 18:56:44 -0800 Subject: Small bug fixes for making tests work. --- OpenSim/Services/GridService/GridService.cs | 30 +++++++++++++------------ OpenSim/Services/GridService/HypergridLinker.cs | 26 +++++++++++---------- 2 files changed, 30 insertions(+), 26 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 4dee7a4..1368e46 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -82,20 +82,22 @@ namespace OpenSim.Services.GridService { m_RootInstance = this; - MainConsole.Instance.Commands.AddCommand("grid", true, - "show region", - "show region ", - "Show details on a region", - String.Empty, - HandleShowRegion); - - MainConsole.Instance.Commands.AddCommand("grid", true, - "set region flags", - "set region flags ", - "Set database flags for region", - String.Empty, - HandleSetFlags); - + if (MainConsole.Instance != null) + { + MainConsole.Instance.Commands.AddCommand("grid", true, + "show region", + "show region ", + "Show details on a region", + String.Empty, + HandleShowRegion); + + MainConsole.Instance.Commands.AddCommand("grid", true, + "set region flags", + "set region flags ", + "Set database flags for region", + String.Empty, + HandleSetFlags); + } m_HypergridLinker = new HypergridLinker(m_config, this, m_Database); } } diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 18d0586..de5df9d 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -113,18 +113,20 @@ namespace OpenSim.Services.GridService m_log.DebugFormat("[HYPERGRID LINKER]: Loaded all services..."); } - - - MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", - "link-region :[:] ", - "Link a hypergrid region", RunCommand); - MainConsole.Instance.Commands.AddCommand("hypergrid", false, "unlink-region", - "unlink-region or : ", - "Unlink a hypergrid region", RunCommand); - MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-mapping", "link-mapping [ ] ", - "Set local coordinate to map HG regions to", RunCommand); - MainConsole.Instance.Commands.AddCommand("hypergrid", false, "show hyperlinks", "show hyperlinks ", - "List the HG regions", HandleShow); + + if (MainConsole.Instance != null) + { + MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", + "link-region :[:] ", + "Link a hypergrid region", RunCommand); + MainConsole.Instance.Commands.AddCommand("hypergrid", false, "unlink-region", + "unlink-region or : ", + "Unlink a hypergrid region", RunCommand); + MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-mapping", "link-mapping [ ] ", + "Set local coordinate to map HG regions to", RunCommand); + MainConsole.Instance.Commands.AddCommand("hypergrid", false, "show hyperlinks", "show hyperlinks ", + "List the HG regions", HandleShow); + } } -- cgit v1.1 From 4b813932745775ef585a2cbca99233e57d20e13e Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 12 Mar 2010 23:21:45 +0000 Subject: minor: remove some mono compiler warnings --- OpenSim/Services/GridService/GridService.cs | 6 ++---- OpenSim/Services/GridService/HypergridLinker.cs | 5 +++-- 2 files changed, 5 insertions(+), 6 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 1368e46..2faf018 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -123,8 +123,7 @@ namespace OpenSim.Services.GridService if ((rflags & OpenSim.Data.RegionFlags.Reservation) != 0) { // Regions reserved for the null key cannot be taken. - // - if (region.Data["PrincipalID"] == UUID.Zero.ToString()) + if ((string)region.Data["PrincipalID"] == UUID.Zero.ToString()) return "Region location us reserved"; // Treat it as an auth request @@ -132,7 +131,6 @@ namespace OpenSim.Services.GridService // NOTE: Fudging the flags value here, so these flags // should not be used elsewhere. Don't optimize // this with the later retrieval of the same flags! - // rflags |= OpenSim.Data.RegionFlags.Authenticate; } @@ -489,7 +487,7 @@ namespace OpenSim.Services.GridService f |= (OpenSim.Data.RegionFlags)val; } } - catch (Exception e) + catch (Exception) { MainConsole.Instance.Output("Error in flag specification: " + p); } diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index de5df9d..58746d0 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -168,10 +168,11 @@ namespace OpenSim.Services.GridService } // Sanity check. - IPAddress ipaddr = null; + //IPAddress ipaddr = null; try { - ipaddr = Util.GetHostFromDNS(host); + //ipaddr = Util.GetHostFromDNS(host); + Util.GetHostFromDNS(host); } catch { -- cgit v1.1 From b10811a13b8fab81ce00d544d8efe081792bdaaa Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 3 May 2010 09:50:55 -0700 Subject: Assorted bug fixes in hypergrid linking. --- OpenSim/Services/GridService/GridService.cs | 5 ++- OpenSim/Services/GridService/HypergridLinker.cs | 52 ++++++++++++++----------- 2 files changed, 33 insertions(+), 24 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 2faf018..4089fce 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -315,6 +315,8 @@ namespace OpenSim.Services.GridService public List GetRegionsByName(UUID scopeID, string name, int maxNumber) { + m_log.DebugFormat("[GRID SERVICE]: GetRegionsByName {0}", name); + List rdatas = m_Database.Get("%" + name + "%", scopeID); int count = 0; @@ -329,7 +331,7 @@ namespace OpenSim.Services.GridService } } - if (m_AllowHypergridMapSearch && rdatas == null || (rdatas != null && rdatas.Count == 0) && name.Contains(".")) + if (m_AllowHypergridMapSearch && (rdatas == null || (rdatas != null && rdatas.Count == 0) && name.Contains("."))) { GridRegion r = m_HypergridLinker.LinkRegion(scopeID, name); if (r != null) @@ -397,6 +399,7 @@ namespace OpenSim.Services.GridService ret.Add(RegionData2RegionInfo(r)); } + m_log.DebugFormat("[GRID SERVICE]: GetDefaultRegions returning {0} regions", ret.Count); return ret; } diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 58746d0..af603b2 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -79,9 +79,16 @@ namespace OpenSim.Services.GridService m_DefaultRegion = defs[0]; else { - // Best guess, may be totally off - m_DefaultRegion = new GridRegion(1000, 1000); - m_log.WarnFormat("[HYPERGRID LINKER]: This grid does not have a default region. Assuming default coordinates at 1000, 1000."); + // Get any region + defs = m_GridService.GetRegionsByName(m_ScopeID, "", 1); + if (defs != null && defs.Count > 0) + m_DefaultRegion = defs[0]; + else + { + // This shouldn't happen + m_DefaultRegion = new GridRegion(1000, 1000); + m_log.Error("[HYPERGRID LINKER]: Something is wrong with this grid. It has no regions?"); + } } } return m_DefaultRegion; @@ -90,7 +97,7 @@ namespace OpenSim.Services.GridService public HypergridLinker(IConfigSource config, GridService gridService, IRegionData db) { - m_log.DebugFormat("[HYPERGRID LINKER]: Starting..."); + m_log.DebugFormat("[HYPERGRID LINKER]: Starting with db {0}", db.GetType()); m_Database = db; m_GridService = gridService; @@ -196,7 +203,7 @@ namespace OpenSim.Services.GridService public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string externalRegionName, uint externalPort, string externalHostName, out GridRegion regInfo, out string reason) { - m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}, in {2}-{3}", externalHostName, externalPort, xloc, yloc); + m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}:{2}, in {3}-{4}", externalHostName, externalPort, externalRegionName, xloc, yloc); reason = string.Empty; regInfo = new GridRegion(); @@ -280,29 +287,28 @@ namespace OpenSim.Services.GridService public bool TryUnlinkRegion(string mapName) { + m_log.DebugFormat("[HYPERGRID LINKER]: Request to unlink {0}", mapName); GridRegion regInfo = null; - if (mapName.Contains(":")) + + List regions = m_Database.Get(mapName, m_ScopeID); + if (regions != null && regions.Count > 0) { - string host = "127.0.0.1"; - //string portstr; - //string regionName = ""; - uint port = 9000; - string[] parts = mapName.Split(new char[] { ':' }); - if (parts.Length >= 1) + OpenSim.Data.RegionFlags rflags = (OpenSim.Data.RegionFlags)Convert.ToInt32(regions[0].Data["flags"]); + if ((rflags & OpenSim.Data.RegionFlags.Hyperlink) != 0) { - host = parts[0]; + regInfo = new GridRegion(); + regInfo.RegionID = regions[0].RegionID; + regInfo.ScopeID = m_ScopeID; } - - foreach (GridRegion r in m_HyperlinkRegions.Values) - if (host.Equals(r.ExternalHostName) && (port == r.HttpPort)) - regInfo = r; - } - else - { - foreach (GridRegion r in m_HyperlinkRegions.Values) - if (r.RegionName.Equals(mapName)) - regInfo = r; } + + //foreach (GridRegion r in m_HyperlinkRegions.Values) + //{ + // m_log.DebugFormat("XXX Comparing {0}:{1} with {2}:{3}", host, port, r.ExternalHostName, r.HttpPort); + // if (host.Equals(r.ExternalHostName) && (port == r.HttpPort)) + // regInfo = r; + //} + if (regInfo != null) { RemoveHyperlinkRegion(regInfo.RegionID); -- cgit v1.1 From b233a4b2cab3a39f9edc17130cd7c2f2f807d6bb Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 9 May 2010 13:39:56 -0700 Subject: * Fixed spamming the assets table with map tiles. The tile image ID is now stored in regionsettings. Upon generation of a new tile image, the old one is deleted. Tested for SQLite and MySql standalone. * Fixed small bug with map search where the local sim regions weren't found. --- OpenSim/Services/GridService/GridService.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 4089fce..7c98642 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -324,6 +324,7 @@ namespace OpenSim.Services.GridService if (rdatas != null) { + m_log.DebugFormat("[GRID SERVICE]: Found {0} regions", rdatas.Count); foreach (RegionData rdata in rdatas) { if (count++ < maxNumber) @@ -331,7 +332,7 @@ namespace OpenSim.Services.GridService } } - if (m_AllowHypergridMapSearch && (rdatas == null || (rdatas != null && rdatas.Count == 0) && name.Contains("."))) + if (m_AllowHypergridMapSearch && (rdatas == null || (rdatas != null && rdatas.Count == 0)) && name.Contains(".")) { GridRegion r = m_HypergridLinker.LinkRegion(scopeID, name); if (r != null) -- cgit v1.1 From 19558f380a1e9cbaff849eb15262266ea79b60d2 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 13 Jun 2010 19:06:22 -0700 Subject: Fixes the long-standing RegionUp bug! Plus lots of other cleanups related to neighbours. --- OpenSim/Services/GridService/GridService.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 7c98642..225530f 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -273,14 +273,15 @@ namespace OpenSim.Services.GridService if (region != null) { // Not really? Maybe? - List rdatas = m_Database.Get(region.posX - (int)Constants.RegionSize, region.posY - (int)Constants.RegionSize, - region.posX + (int)Constants.RegionSize, region.posY + (int)Constants.RegionSize, scopeID); + List rdatas = m_Database.Get(region.posX - (int)Constants.RegionSize - 1, region.posY - (int)Constants.RegionSize - 1, + region.posX + (int)Constants.RegionSize + 1, region.posY + (int)Constants.RegionSize + 1, scopeID); foreach (RegionData rdata in rdatas) if (rdata.RegionID != regionID) rinfos.Add(RegionData2RegionInfo(rdata)); } + m_log.DebugFormat("[GRID SERVICE]: region {0} has {1} neighours", region.RegionName, rinfos.Count); return rinfos; } -- cgit v1.1 From 20fc35399b8193e3620b0dadca861e90c4afe216 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 28 Jun 2010 14:10:22 -0700 Subject: Fixes mantis #4815 and #4812 --- OpenSim/Services/GridService/HypergridLinker.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index af603b2..ae80a8c 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -255,7 +255,11 @@ namespace OpenSim.Services.GridService { m_log.WarnFormat("[HYPERGRID LINKER]: Remote Gatekeeper at {0} provided malformed ExternalName {1}", regInfo.ExternalHostName, externalName); } - regInfo.RegionName = regInfo.ExternalHostName + ":" + regInfo.HttpPort + ":" + regInfo.RegionName; + string name = regInfo.RegionName; + regInfo.RegionName = regInfo.ExternalHostName + ":" + regInfo.HttpPort; + if (name != string.Empty) + regInfo.RegionName += ":" + name; + // Try get the map image //regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL); // I need a texture that works for this... the one I tried doesn't seem to be working -- cgit v1.1 From 7525f3a556116e47f629e09b42dd4753185166e2 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 5 Jul 2010 04:19:53 -0700 Subject: Don't include hyperlinks as neighbors, even if grid operators have done the mistake of placing them as neighbors. This will not prevent further mess ups coming from that unsupported action. --- OpenSim/Services/GridService/GridService.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 225530f..46d72dc 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -278,7 +278,11 @@ namespace OpenSim.Services.GridService foreach (RegionData rdata in rdatas) if (rdata.RegionID != regionID) - rinfos.Add(RegionData2RegionInfo(rdata)); + { + int flags = Convert.ToInt32(rdata.Data["flags"]); + if ((flags & (int)Data.RegionFlags.Hyperlink) == 0) // no hyperlinks as neighbours + rinfos.Add(RegionData2RegionInfo(rdata)); + } } m_log.DebugFormat("[GRID SERVICE]: region {0} has {1} neighours", region.RegionName, rinfos.Count); -- cgit v1.1 From 8c7fd12d5d63fb5e44070e57a4bef8e74986dea6 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 30 Jul 2010 18:06:34 -0700 Subject: Bug fix: make m_HypergridLinker static. --- OpenSim/Services/GridService/GridService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 46d72dc..f49d86d 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -50,7 +50,7 @@ namespace OpenSim.Services.GridService private bool m_DeleteOnUnregister = true; private static GridService m_RootInstance = null; protected IConfigSource m_config; - protected HypergridLinker m_HypergridLinker; + protected static HypergridLinker m_HypergridLinker; protected IAuthenticationService m_AuthenticationService = null; protected bool m_AllowDuplicateNames = false; -- cgit v1.1 From f91ec192247d64786b3eeab66512fdf319273d68 Mon Sep 17 00:00:00 2001 From: Marck Date: Sat, 31 Jul 2010 20:16:39 +0200 Subject: Implemented console command "show hyperlinks". --- OpenSim/Services/GridService/HypergridLinker.cs | 49 ++++++++++++------------- 1 file changed, 24 insertions(+), 25 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index ae80a8c..23f0004 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -378,32 +378,31 @@ namespace OpenSim.Services.GridService public void HandleShow(string module, string[] cmd) { - MainConsole.Instance.Output("Not Implemented Yet"); - //if (cmd.Length != 2) - //{ - // MainConsole.Instance.Output("Syntax: show hyperlinks"); - // return; - //} - //List regions = new List(m_HypergridService.m_HyperlinkRegions.Values); - //if (regions == null || regions.Count < 1) - //{ - // MainConsole.Instance.Output("No hyperlinks"); - // return; - //} - - //MainConsole.Instance.Output("Region Name Region UUID"); - //MainConsole.Instance.Output("Location URI"); - //MainConsole.Instance.Output("Owner ID "); - //MainConsole.Instance.Output("-------------------------------------------------------------------------------"); - //foreach (GridRegion r in regions) - //{ - // MainConsole.Instance.Output(String.Format("{0,-20} {1}\n{2,-20} {3}\n{4,-39} \n\n", - // r.RegionName, r.RegionID, - // String.Format("{0},{1}", r.RegionLocX, r.RegionLocY), "http://" + r.ExternalHostName + ":" + r.HttpPort.ToString(), - // r.EstateOwner.ToString())); - //} - //return; + if (cmd.Length != 2) + { + MainConsole.Instance.Output("Syntax: show hyperlinks"); + return; + } + List regions = m_Database.GetHyperlinks(UUID.Zero); + if (regions == null || regions.Count < 1) + { + MainConsole.Instance.Output("No hyperlinks"); + return; + } + + MainConsole.Instance.Output("Region Name Region UUID"); + MainConsole.Instance.Output("Location URI"); + MainConsole.Instance.Output("-------------------------------------------------------------------------------"); + foreach (RegionData r in regions) + { + MainConsole.Instance.Output(String.Format("{0,-39} {1}\n{2,-39} {3}\n", + r.RegionName, r.RegionID, + String.Format("{0},{1} ({2},{3})", r.posX, r.posY, r.posX / 256, r.posY / 256), + "http://" + r.Data["serverIP"].ToString() + ":" + r.Data["serverHttpPort"].ToString())); + } + return; } + public void RunCommand(string module, string[] cmdparams) { List args = new List(cmdparams); -- cgit v1.1 From c4ecbd1fb1ce5450b66a7de41a0e34cc3474e04a Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 31 Jul 2010 16:40:58 -0700 Subject: White space from previous commit. --- OpenSim/Services/GridService/HypergridLinker.cs | 42 ++++++++++++------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 23f0004..1f53007 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -378,28 +378,28 @@ namespace OpenSim.Services.GridService public void HandleShow(string module, string[] cmd) { - if (cmd.Length != 2) - { - MainConsole.Instance.Output("Syntax: show hyperlinks"); - return; + if (cmd.Length != 2) + { + MainConsole.Instance.Output("Syntax: show hyperlinks"); + return; + } + List regions = m_Database.GetHyperlinks(UUID.Zero); + if (regions == null || regions.Count < 1) + { + MainConsole.Instance.Output("No hyperlinks"); + return; + } + + MainConsole.Instance.Output("Region Name Region UUID"); + MainConsole.Instance.Output("Location URI"); + MainConsole.Instance.Output("-------------------------------------------------------------------------------"); + foreach (RegionData r in regions) + { + MainConsole.Instance.Output(String.Format("{0,-39} {1}\n{2,-39} {3}\n", + r.RegionName, r.RegionID, + String.Format("{0},{1} ({2},{3})", r.posX, r.posY, r.posX / 256, r.posY / 256), + "http://" + r.Data["serverIP"].ToString() + ":" + r.Data["serverHttpPort"].ToString())); } - List regions = m_Database.GetHyperlinks(UUID.Zero); - if (regions == null || regions.Count < 1) - { - MainConsole.Instance.Output("No hyperlinks"); - return; - } - - MainConsole.Instance.Output("Region Name Region UUID"); - MainConsole.Instance.Output("Location URI"); - MainConsole.Instance.Output("-------------------------------------------------------------------------------"); - foreach (RegionData r in regions) - { - MainConsole.Instance.Output(String.Format("{0,-39} {1}\n{2,-39} {3}\n", - r.RegionName, r.RegionID, - String.Format("{0},{1} ({2},{3})", r.posX, r.posY, r.posX / 256, r.posY / 256), - "http://" + r.Data["serverIP"].ToString() + ":" + r.Data["serverHttpPort"].ToString())); - } return; } -- cgit v1.1 From 16bdb53683bf15a39f77603d558eda026fd4d21e Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Wed, 4 Aug 2010 00:45:15 +0200 Subject: Allow specifying default region flags. Correct a typo. --- OpenSim/Services/GridService/GridService.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index f49d86d..ebaed42 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -124,7 +124,7 @@ namespace OpenSim.Services.GridService { // Regions reserved for the null key cannot be taken. if ((string)region.Data["PrincipalID"] == UUID.Zero.ToString()) - return "Region location us reserved"; + return "Region location is reserved"; // Treat it as an auth request // @@ -210,6 +210,7 @@ namespace OpenSim.Services.GridService { int newFlags = 0; string regionName = rdata.RegionName.Trim().Replace(' ', '_'); + newFlags = ParseFlags(newFlags, gridConfig.GetString("DefaultRegionFlags", String.Empty)); newFlags = ParseFlags(newFlags, gridConfig.GetString("Region_" + regionName, String.Empty)); newFlags = ParseFlags(newFlags, gridConfig.GetString("Region_" + rdata.RegionID.ToString(), String.Empty)); rdata.Data["flags"] = newFlags.ToString(); -- 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. --- OpenSim/Services/GridService/GridService.cs | 16 ++++++++++++ OpenSim/Services/GridService/HypergridLinker.cs | 34 ++++++++++++++++++++++--- 2 files changed, 46 insertions(+), 4 deletions(-) (limited to 'OpenSim/Services/GridService') 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; } -- 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. --- OpenSim/Services/GridService/GridService.cs | 30 ++++++++++++------------- OpenSim/Services/GridService/HypergridLinker.cs | 23 +++++++++++++------ 2 files changed, 31 insertions(+), 22 deletions(-) (limited to 'OpenSim/Services/GridService') 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 From 7741143fb5c7c62355170a2f795561d28b9f589f Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 10 Aug 2010 11:14:24 -0700 Subject: Enforce DB limits on region name to 32 chars, or else (not good). Removed a piece of code from Hyperlinker that didn't work anyway. Shortened the hyperlink region name. --- OpenSim/Services/GridService/HypergridLinker.cs | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index b190f93..3d722ec 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -247,21 +247,8 @@ namespace OpenSim.Services.GridService } regInfo.RegionID = regionID; - Uri uri = null; - try - { - uri = new Uri(externalName); - regInfo.ExternalHostName = uri.Host; - regInfo.HttpPort = (uint)uri.Port; - } - catch - { - m_log.WarnFormat("[HYPERGRID LINKER]: Remote Gatekeeper at {0} provided malformed ExternalName {1}", regInfo.ExternalHostName, externalName); - } - string name = regInfo.RegionName; - regInfo.RegionName = regInfo.ExternalHostName + ":" + regInfo.HttpPort; - if (name != string.Empty) - regInfo.RegionName += ":" + name; + if (regInfo.RegionName == string.Empty) + regInfo.RegionName = regInfo.ExternalHostName; // Try get the map image //regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL); @@ -384,8 +371,6 @@ namespace OpenSim.Services.GridService private void AddHyperlinkRegion(GridRegion regionInfo, ulong regionHandle) { - //m_HyperlinkRegions[regionInfo.RegionID] = regionInfo; - //m_HyperlinkHandles[regionInfo.RegionID] = regionHandle; RegionData rdata = m_GridService.RegionInfo2RegionData(regionInfo); int flags = (int)OpenSim.Data.RegionFlags.Hyperlink + (int)OpenSim.Data.RegionFlags.NoDirectLogin + (int)OpenSim.Data.RegionFlags.RegionOnline; @@ -397,12 +382,6 @@ namespace OpenSim.Services.GridService private void RemoveHyperlinkRegion(UUID regionID) { - //// Try the hyperlink collection - //if (m_HyperlinkRegions.ContainsKey(regionID)) - //{ - // m_HyperlinkRegions.Remove(regionID); - // m_HyperlinkHandles.Remove(regionID); - //} m_Database.Delete(regionID); } -- cgit v1.1 From d96f5fa57db52c872b8e431bc9a1137f0525cbc5 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 2 Sep 2010 16:36:05 -0700 Subject: Quick fix for making global references for gatekeepers that are not domain:port work. This needs a serious rewrite, as the assumption domain:port doesn't hold from here on. Just quick-fixing for now. --- OpenSim/Services/GridService/HypergridLinker.cs | 29 ++++++++++++++----------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 3d722ec..b86fb6f 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -158,7 +158,7 @@ namespace OpenSim.Services.GridService string host = "127.0.0.1"; string portstr; string regionName = ""; - uint port = 9000; + uint port = 0; string[] parts = mapName.Split(new char[] { ':' }); if (parts.Length >= 1) { @@ -177,18 +177,16 @@ namespace OpenSim.Services.GridService regionName = parts[2]; } - // Sanity check. - //IPAddress ipaddr = null; - try - { - //ipaddr = Util.GetHostFromDNS(host); - Util.GetHostFromDNS(host); - } - catch - { - reason = "Malformed hostname"; - return null; - } + //// Sanity check. + //try + //{ + // Util.GetHostFromDNS(host); + //} + //catch + //{ + // reason = "Malformed hostname"; + // return null; + //} GridRegion regInfo; bool success = TryCreateLink(scopeID, xloc, yloc, regionName, port, host, out regInfo, out reason); @@ -217,6 +215,11 @@ namespace OpenSim.Services.GridService regInfo.RegionLocY = yloc; regInfo.ScopeID = scopeID; + // Big HACK for Simian Grid !!! + // We need to clean up all URLs used in OpenSim !!! + if (externalHostName.Contains("/")) + regInfo.ServerURI = externalHostName; + try { regInfo.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int)0); -- cgit v1.1 From 32ccc7a9d912543c0a5d3f8db839734194f3d8dd Mon Sep 17 00:00:00 2001 From: Jonathan Freedman Date: Sat, 2 Oct 2010 19:17:02 -0400 Subject: * refactor refactor refactor ServerURI 4 lyfe --- OpenSim/Services/GridService/HypergridLinker.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index b86fb6f..757ae80 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -127,7 +127,7 @@ namespace OpenSim.Services.GridService if (MainConsole.Instance != null) { MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", - "link-region :[:] ", + "link-region [] ", "Link a hypergrid region", RunCommand); MainConsole.Instance.Commands.AddCommand("hypergrid", false, "unlink-region", "unlink-region or : ", @@ -200,10 +200,16 @@ 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) { + TryCreateLink(scopeID, xloc, yloc, externalRegionName, externalPort, externalHostName, null, regInfo, reason); + } + + // From the command line and the 2 above + public bool TryCreateLink(UUID scopeID, int xloc, int yloc, + string externalRegionName, uint externalPort, string externalHostName, string serverURI, out GridRegion regInfo, out string reason) + { m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}:{2}, in {3}-{4}", externalHostName, externalPort, externalRegionName, xloc, yloc); reason = string.Empty; @@ -509,12 +515,16 @@ namespace OpenSim.Services.GridService int xloc, yloc; uint externalPort; string externalHostName; + string serverURI; try { xloc = Convert.ToInt32(cmdparams[0]); yloc = Convert.ToInt32(cmdparams[1]); externalPort = Convert.ToUInt32(cmdparams[3]); externalHostName = cmdparams[2]; + if ( cmdparams.Length == 4 ) { + + } //internalPort = Convert.ToUInt32(cmdparams[4]); //remotingPort = Convert.ToUInt32(cmdparams[5]); } -- cgit v1.1 From 69acf9c79b9e83047c2a0494a6f96c7d33839d3b Mon Sep 17 00:00:00 2001 From: Jonathan Freedman Date: Sun, 3 Oct 2010 18:03:53 -0400 Subject: * additional serveruri cleanup --- OpenSim/Services/GridService/GridService.cs | 2 +- OpenSim/Services/GridService/HypergridLinker.cs | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index ce6f64b..add1be0 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -479,7 +479,7 @@ namespace OpenSim.Services.GridService OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]); MainConsole.Instance.Output(String.Format("{0,-20} {1}\n{2,-20} {3}\n{4,-39} {5}\n\n", r.RegionName, r.RegionID, - String.Format("{0},{1}", r.posX, r.posY), "http://" + r.Data["serverIP"].ToString() + ":" + r.Data["serverPort"].ToString(), + String.Format("{0},{1}", r.posX, r.posY), r.Data["serverURI"], r.Data["owner_uuid"].ToString(), flags.ToString())); } return; diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 757ae80..11df7e0 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -199,11 +199,14 @@ namespace OpenSim.Services.GridService return null; } + public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string externalRegionName, string serverURI, out GridRegion regInfo, out string reason) + { + return TryCreateLink(scopeID, xloc, yloc, externalRegionName, 0, null, serverURI, out regInfo, out reason); + } - 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, out GridRegion regInfo, out string reason) { - TryCreateLink(scopeID, xloc, yloc, externalRegionName, externalPort, externalHostName, null, regInfo, reason); + return TryCreateLink(scopeID, xloc, yloc, externalRegionName, externalPort, externalHostName, null, out regInfo, out reason); } // From the command line and the 2 above -- cgit v1.1 From a2167b0f0dfef5f8aeb7bee99f34f672f6004bb3 Mon Sep 17 00:00:00 2001 From: Jonathan Freedman Date: Mon, 11 Oct 2010 16:53:00 -0400 Subject: * more url / hg cleanup --- OpenSim/Services/GridService/HypergridLinker.cs | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 11df7e0..74e864b 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -198,21 +198,8 @@ namespace OpenSim.Services.GridService return null; } - - public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string externalRegionName, string serverURI, out GridRegion regInfo, out string reason) - { - return TryCreateLink(scopeID, xloc, yloc, externalRegionName, 0, null, serverURI, out regInfo, out reason); - } - public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string externalRegionName, uint externalPort, string externalHostName, out GridRegion regInfo, out string reason) { - return TryCreateLink(scopeID, xloc, yloc, externalRegionName, externalPort, externalHostName, null, out regInfo, out reason); - } - - // From the command line and the 2 above - public bool TryCreateLink(UUID scopeID, int xloc, int yloc, - string externalRegionName, uint externalPort, string externalHostName, string serverURI, out GridRegion regInfo, out string reason) - { m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}:{2}, in {3}-{4}", externalHostName, externalPort, externalRegionName, xloc, yloc); reason = string.Empty; @@ -226,8 +213,11 @@ namespace OpenSim.Services.GridService // Big HACK for Simian Grid !!! // We need to clean up all URLs used in OpenSim !!! - if (externalHostName.Contains("/")) + if (externalHostName.Contains("/")) { regInfo.ServerURI = externalHostName; + } else { + regInfo.ServerURI = "http://" + externalHostName + ":" + externalPort.ToString(); + } try { -- cgit v1.1 From 7de30cc57b5f9ad895e865736550c8d7a433ce55 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 18 Oct 2010 22:58:04 +0100 Subject: Change substring matching to prefix matching in region search. This affects both map and login, as they use the same method. --- OpenSim/Services/GridService/GridService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index ce6f64b..e7988d6 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -323,7 +323,7 @@ namespace OpenSim.Services.GridService { m_log.DebugFormat("[GRID SERVICE]: GetRegionsByName {0}", name); - List rdatas = m_Database.Get("%" + name + "%", scopeID); + List rdatas = m_Database.Get(name + "%", scopeID); int count = 0; List rinfos = new List(); -- cgit v1.1 From d4144bedb81346301162f1e20266561fea7b621e Mon Sep 17 00:00:00 2001 From: Jonathan Freedman Date: Thu, 21 Oct 2010 23:22:15 -0400 Subject: * change the data exchanged within hypergrid transactions --- OpenSim/Services/GridService/HypergridLinker.cs | 73 +++++++++++++++++++------ 1 file changed, 56 insertions(+), 17 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 74e864b..c273d21 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -126,11 +126,12 @@ namespace OpenSim.Services.GridService if (MainConsole.Instance != null) { - MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", - "link-region [] ", - "Link a hypergrid region", RunCommand); + MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", "link-region []", "Link a HyperGrid Region", RunCommand); + MainConsole.Instance.Commands.AddCommand("hypergrid", false, "legacy-link-region", + "legacy-link-region []", + "Link a hypergrid region (deprecated)", RunCommand); MainConsole.Instance.Commands.AddCommand("hypergrid", false, "unlink-region", - "unlink-region or : ", + "unlink-region ", "Unlink a hypergrid region", RunCommand); MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-mapping", "link-mapping [ ] ", "Set local coordinate to map HG regions to", RunCommand); @@ -198,27 +199,33 @@ 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) { + return TryCreateLink(scopeID, xloc, yloc, externalRegionName, externalPort, externalHostName, null, 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) + { m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}:{2}, in {3}-{4}", externalHostName, externalPort, externalRegionName, xloc, yloc); reason = string.Empty; regInfo = new GridRegion(); - regInfo.RegionName = externalRegionName; - regInfo.HttpPort = externalPort; - regInfo.ExternalHostName = externalHostName; + if ( externalPort > 0) + regInfo.HttpPort = externalPort; + else + regInfo.HttpPort = 0; + if ( externalHostName != null) + regInfo.ExternalHostName = externalHostName; + else + regInfo.ExternalHostName = "0.0.0.0"; + if ( serverURI != null) + regInfo.ServerURI = serverURI; + regInfo.RegionLocX = xloc; regInfo.RegionLocY = yloc; regInfo.ScopeID = scopeID; - // Big HACK for Simian Grid !!! - // We need to clean up all URLs used in OpenSim !!! - if (externalHostName.Contains("/")) { - regInfo.ServerURI = externalHostName; - } else { - regInfo.ServerURI = "http://" + externalHostName + ":" + externalPort.ToString(); - } - try { regInfo.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int)0); @@ -249,9 +256,14 @@ namespace OpenSim.Services.GridService } regInfo.RegionID = regionID; - if (regInfo.RegionName == string.Empty) - regInfo.RegionName = regInfo.ExternalHostName; + if ( externalName == string.Empty ) + regInfo.RegionName = regInfo.ServerURI; + else + regInfo.RegionName = externalName; + + m_log.Debug("naming linked region " + regInfo.RegionName); + // Try get the map image //regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL); // I need a texture that works for this... the one I tried doesn't seem to be working @@ -433,6 +445,21 @@ namespace OpenSim.Services.GridService RunHGCommand(command, cmdparams); } + + private void RunLinkRegionCommand(string[] cmdparams) + { + int xloc, yloc; + string serverURI; + string remoteName = null; + xloc = Convert.ToInt32(cmdparams[0]) * (int)Constants.RegionSize; + yloc = Convert.ToInt32(cmdparams[1]) * (int)Constants.RegionSize; + serverURI = cmdparams[2]; + if (cmdparams.Length == 4) + remoteName = cmdparams[3]; + string reason = string.Empty; + GridRegion regInfo; + TryCreateLink(UUID.Zero, xloc, yloc, remoteName, 0, null, serverURI, out regInfo, out reason); + } private void RunHGCommand(string command, string[] cmdparams) { @@ -456,6 +483,18 @@ namespace OpenSim.Services.GridService } else if (command.Equals("link-region")) { + if (cmdparams.Length > 0 && cmdparams.Length < 5) + { + RunLinkRegionCommand(cmdparams); + } + else + { + LinkRegionCmdUsage(); + } + return; + } + else if (command.Equals("legacy-link-region")) + { if (cmdparams.Length < 3) { if ((cmdparams.Length == 1) || (cmdparams.Length == 2)) -- cgit v1.1 From fe8d3d5a2bc0ddbc051d8a7ad2412da5f3546075 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 22 Oct 2010 23:52:07 +0100 Subject: Revert "Merge remote branch 'otakup0pe/mantis5110'" This reverts commit 21187f459ea2ae590dda4249fa15ebf116d04fe0, reversing changes made to 8f34e46d7449be1c29419a232a8f7f1e5918f03c. --- OpenSim/Services/GridService/GridService.cs | 2 +- OpenSim/Services/GridService/HypergridLinker.cs | 80 ++++++------------------- 2 files changed, 20 insertions(+), 62 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 125c2be..e7988d6 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -479,7 +479,7 @@ namespace OpenSim.Services.GridService OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]); MainConsole.Instance.Output(String.Format("{0,-20} {1}\n{2,-20} {3}\n{4,-39} {5}\n\n", r.RegionName, r.RegionID, - String.Format("{0},{1}", r.posX, r.posY), r.Data["serverURI"], + String.Format("{0},{1}", r.posX, r.posY), "http://" + r.Data["serverIP"].ToString() + ":" + r.Data["serverPort"].ToString(), r.Data["owner_uuid"].ToString(), flags.ToString())); } return; diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index c273d21..b86fb6f 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -126,12 +126,11 @@ namespace OpenSim.Services.GridService if (MainConsole.Instance != null) { - MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", "link-region []", "Link a HyperGrid Region", RunCommand); - MainConsole.Instance.Commands.AddCommand("hypergrid", false, "legacy-link-region", - "legacy-link-region []", - "Link a hypergrid region (deprecated)", RunCommand); + MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", + "link-region :[:] ", + "Link a hypergrid region", RunCommand); MainConsole.Instance.Commands.AddCommand("hypergrid", false, "unlink-region", - "unlink-region ", + "unlink-region or : ", "Unlink a hypergrid region", RunCommand); MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-mapping", "link-mapping [ ] ", "Set local coordinate to map HG regions to", RunCommand); @@ -199,33 +198,28 @@ 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) - { - return TryCreateLink(scopeID, xloc, yloc, externalRegionName, externalPort, externalHostName, null, 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) + + + // 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) { m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}:{2}, in {3}-{4}", externalHostName, externalPort, externalRegionName, xloc, yloc); reason = string.Empty; regInfo = new GridRegion(); - if ( externalPort > 0) - regInfo.HttpPort = externalPort; - else - regInfo.HttpPort = 0; - if ( externalHostName != null) - regInfo.ExternalHostName = externalHostName; - else - regInfo.ExternalHostName = "0.0.0.0"; - if ( serverURI != null) - regInfo.ServerURI = serverURI; - + regInfo.RegionName = externalRegionName; + regInfo.HttpPort = externalPort; + regInfo.ExternalHostName = externalHostName; regInfo.RegionLocX = xloc; regInfo.RegionLocY = yloc; regInfo.ScopeID = scopeID; + // Big HACK for Simian Grid !!! + // We need to clean up all URLs used in OpenSim !!! + if (externalHostName.Contains("/")) + regInfo.ServerURI = externalHostName; + try { regInfo.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int)0); @@ -256,14 +250,9 @@ namespace OpenSim.Services.GridService } regInfo.RegionID = regionID; + if (regInfo.RegionName == string.Empty) + regInfo.RegionName = regInfo.ExternalHostName; - if ( externalName == string.Empty ) - regInfo.RegionName = regInfo.ServerURI; - else - regInfo.RegionName = externalName; - - m_log.Debug("naming linked region " + regInfo.RegionName); - // Try get the map image //regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL); // I need a texture that works for this... the one I tried doesn't seem to be working @@ -445,21 +434,6 @@ namespace OpenSim.Services.GridService RunHGCommand(command, cmdparams); } - - private void RunLinkRegionCommand(string[] cmdparams) - { - int xloc, yloc; - string serverURI; - string remoteName = null; - xloc = Convert.ToInt32(cmdparams[0]) * (int)Constants.RegionSize; - yloc = Convert.ToInt32(cmdparams[1]) * (int)Constants.RegionSize; - serverURI = cmdparams[2]; - if (cmdparams.Length == 4) - remoteName = cmdparams[3]; - string reason = string.Empty; - GridRegion regInfo; - TryCreateLink(UUID.Zero, xloc, yloc, remoteName, 0, null, serverURI, out regInfo, out reason); - } private void RunHGCommand(string command, string[] cmdparams) { @@ -483,18 +457,6 @@ namespace OpenSim.Services.GridService } else if (command.Equals("link-region")) { - if (cmdparams.Length > 0 && cmdparams.Length < 5) - { - RunLinkRegionCommand(cmdparams); - } - else - { - LinkRegionCmdUsage(); - } - return; - } - else if (command.Equals("legacy-link-region")) - { if (cmdparams.Length < 3) { if ((cmdparams.Length == 1) || (cmdparams.Length == 2)) @@ -547,16 +509,12 @@ namespace OpenSim.Services.GridService int xloc, yloc; uint externalPort; string externalHostName; - string serverURI; try { xloc = Convert.ToInt32(cmdparams[0]); yloc = Convert.ToInt32(cmdparams[1]); externalPort = Convert.ToUInt32(cmdparams[3]); externalHostName = cmdparams[2]; - if ( cmdparams.Length == 4 ) { - - } //internalPort = Convert.ToUInt32(cmdparams[4]); //remotingPort = Convert.ToUInt32(cmdparams[5]); } -- cgit v1.1 From 7b0d6439995cd6c192c2bc0de80a5b4dcc9bb5b0 Mon Sep 17 00:00:00 2001 From: Marck Date: Wed, 27 Oct 2010 19:03:56 +0200 Subject: HypergridLinker optimizations and enable use of owner_uuid/EstateOwner with linked regions. * Added check for already occupied region coordinates. * Optimized Check4096. --- OpenSim/Services/GridService/HypergridLinker.cs | 47 ++++++++++++++----------- 1 file changed, 27 insertions(+), 20 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index b86fb6f..a67404f 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; @@ -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"; string portstr; @@ -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 hyperlinks = m_GridService.GetHyperlinks(m_ScopeID); - // 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) + IEnumerable 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", ""); } -- cgit v1.1 From 0a56cfbfd53e4e5515ecba65466042e0f1b50341 Mon Sep 17 00:00:00 2001 From: Jonathan Freedman Date: Sat, 30 Oct 2010 22:51:52 -0400 Subject: * better semantics for link-region command * actually parse name for new link-region command --- OpenSim/Services/GridService/HypergridLinker.cs | 42 ++++++++++++------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 50da1bd..eed3207 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -128,8 +128,8 @@ namespace OpenSim.Services.GridService if (MainConsole.Instance != null) { MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", "link-region []", "Link a HyperGrid Region", RunCommand); - MainConsole.Instance.Commands.AddCommand("hypergrid", false, "legacy-link-region", - "legacy-link-region []", + MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", + "link-region []", "Link a hypergrid region (deprecated)", RunCommand); MainConsole.Instance.Commands.AddCommand("hypergrid", false, "unlink-region", "unlink-region ", @@ -206,14 +206,14 @@ namespace OpenSim.Services.GridService return null; } - public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string externalRegionName, uint externalPort, string externalHostName, UUID ownerID, out GridRegion regInfo, out string reason) + public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string remoteRegionName, uint externalPort, string externalHostName, UUID ownerID, out GridRegion regInfo, out string reason) { - return TryCreateLink(scopeID, xloc, yloc, externalRegionName, externalPort, externalHostName, null, ownerID, out regInfo, out reason); + return TryCreateLink(scopeID, xloc, yloc, remoteRegionName, 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, UUID ownerID, out GridRegion regInfo, out string reason) + public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string remoteRegionName, 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); + m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}:{2}, in {3}-{4}", externalHostName, externalPort, remoteRegionName, xloc, yloc); reason = string.Empty; regInfo = new GridRegion(); @@ -227,6 +227,9 @@ namespace OpenSim.Services.GridService regInfo.ExternalHostName = "0.0.0.0"; if ( serverURI != null) regInfo.ServerURI = serverURI; + + if ( remoteRegionName != string.Empty ) + regInfo.RegionName = remoteRegionName; regInfo.RegionLocX = xloc; regInfo.RegionLocY = yloc; @@ -326,13 +329,6 @@ namespace OpenSim.Services.GridService } } - //foreach (GridRegion r in m_HyperlinkRegions.Values) - //{ - // m_log.DebugFormat("XXX Comparing {0}:{1} with {2}:{3}", host, port, r.ExternalHostName, r.HttpPort); - // if (host.Equals(r.ExternalHostName) && (port == r.HttpPort)) - // regInfo = r; - //} - if (regInfo != null) { RemoveHyperlinkRegion(regInfo.RegionID); @@ -500,7 +496,7 @@ namespace OpenSim.Services.GridService } return; } - else if (command.Equals("legacy-link-region")) + else if (command.Equals("link-region")) { if (cmdparams.Length < 3) { @@ -515,7 +511,11 @@ namespace OpenSim.Services.GridService return; } - if (cmdparams[2].Contains(":")) + //this should be the prefererred way of setting up hg links now + if ( cmdparams[2].StartsWith("http") && ( cmdparams.Length >= 3 && cmdparams.Length <= 5 )) { + RunLinkRegionCommand(cmdparams); + } + else if (cmdparams[2].Contains(":")) { // New format int xloc, yloc; @@ -578,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, UUID.Zero, out regInfo, out reason)) + if (TryCreateLink(UUID.Zero, xloc, yloc, string.Empty, externalPort, externalHostName, UUID.Zero, out regInfo, out reason)) { if (cmdparams.Length >= 5) { @@ -592,7 +592,7 @@ namespace OpenSim.Services.GridService } else if (command.Equals("unlink-region")) { - if (cmdparams.Length < 1) + if (cmdparams.Length < 1 || cmdparams.Length > 1) { UnlinkRegionCmdUsage(); return; @@ -680,7 +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, UUID.Zero, out regInfo, out reason)) + if (TryCreateLink(UUID.Zero, xloc, yloc, string.Empty, externalPort, externalHostName, UUID.Zero, out regInfo, out reason)) { regInfo.RegionName = config.GetString("localName", ""); } @@ -692,14 +692,14 @@ namespace OpenSim.Services.GridService private void LinkRegionCmdUsage() { - MainConsole.Instance.Output("Usage: link-region :[:]"); - MainConsole.Instance.Output("Usage: link-region []"); + MainConsole.Instance.Output("Usage: link-region []"); + MainConsole.Instance.Output("Usage (deprecated): link-region :[:]"); + MainConsole.Instance.Output("Usage (deprecated): link-region []"); MainConsole.Instance.Output("Usage: link-region []"); } private void UnlinkRegionCmdUsage() { - MainConsole.Instance.Output("Usage: unlink-region :"); MainConsole.Instance.Output("Usage: unlink-region "); } -- cgit v1.1 From 72748746d53df1c033207452a4315d93bc780158 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 5 Dec 2010 19:43:24 -0800 Subject: Fixed some inconsistency with trailing /. Made debug messages consistent. Changed the stored region names of HG regions. Increased the size of regionName in DB. --- OpenSim/Services/GridService/HypergridLinker.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index eed3207..d5d0195 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -127,16 +127,18 @@ namespace OpenSim.Services.GridService if (MainConsole.Instance != null) { - MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", "link-region []", "Link a HyperGrid Region", RunCommand); + MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", + "link-region []", + "Link a HyperGrid Region", RunCommand); MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", "link-region []", "Link a hypergrid region (deprecated)", RunCommand); MainConsole.Instance.Commands.AddCommand("hypergrid", false, "unlink-region", "unlink-region ", "Unlink a hypergrid region", RunCommand); - MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-mapping", "link-mapping [ ] ", + MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-mapping", "link-mapping [ ]", "Set local coordinate to map HG regions to", RunCommand); - MainConsole.Instance.Commands.AddCommand("hypergrid", false, "show hyperlinks", "show hyperlinks ", + MainConsole.Instance.Commands.AddCommand("hypergrid", false, "show hyperlinks", "show hyperlinks", "List the HG regions", HandleShow); } } @@ -281,7 +283,7 @@ namespace OpenSim.Services.GridService else regInfo.RegionName = externalName; - m_log.Debug("naming linked region " + regInfo.RegionName); + m_log.Debug("[HYPERGRID LINKER]: naming linked region " + regInfo.RegionName); // Try get the map image //regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL); -- cgit v1.1 From baa8ddfd2640e5138e8f1287df17e07007d2a3ed Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 9 Dec 2010 08:28:21 -0800 Subject: Minor bug fixes. Hunting down mantis #5259 --- OpenSim/Services/GridService/HypergridLinker.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index d5d0195..2184498 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -215,7 +215,9 @@ namespace OpenSim.Services.GridService public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string remoteRegionName, 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, remoteRegionName, xloc, yloc); + m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}, in {2}-{3}", + ((serverURI == null) ? (externalHostName + ":" + externalPort) : serverURI), + remoteRegionName, xloc / Constants.RegionSize, yloc / Constants.RegionSize); reason = string.Empty; regInfo = new GridRegion(); -- cgit v1.1 From cefdee8aaf365d0395b44176ff46e48e933bf1bf Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 9 Dec 2010 16:52:37 -0800 Subject: Normalized ALL URLs with trailing /'s hopefully. Fixed show hyperlinks command. mantis #5259 --- OpenSim/Services/GridService/HypergridLinker.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 2184498..31c7b80 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -433,7 +433,7 @@ namespace OpenSim.Services.GridService MainConsole.Instance.Output(String.Format("{0,-39} {1}\n{2,-39} {3}\n", r.RegionName, r.RegionID, String.Format("{0},{1} ({2},{3})", r.posX, r.posY, r.posX / 256, r.posY / 256), - "http://" + r.Data["serverIP"].ToString() + ":" + r.Data["serverHttpPort"].ToString())); + r.Data["serverURI"].ToString())); } return; } -- cgit v1.1 From 6f37290f4ccf0d3e516edcc38406cffaf35bcaac Mon Sep 17 00:00:00 2001 From: Marck Date: Fri, 10 Dec 2010 17:48:45 +0100 Subject: Adjust hypergrid console commands to latest changes. --- OpenSim/Services/GridService/HypergridLinker.cs | 105 +++++++++--------------- 1 file changed, 41 insertions(+), 64 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 31c7b80..9863ba0 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -26,6 +26,7 @@ */ using System; +using System.Collections; using System.Collections.Generic; using System.Linq; using System.Net; @@ -244,7 +245,9 @@ namespace OpenSim.Services.GridService 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); + m_log.WarnFormat("[HYPERGRID LINKER]: Coordinates {0}-{1} are already occupied by region {2} with uuid {3}", + regInfo.RegionLocX / Constants.RegionSize, regInfo.RegionLocY / Constants.RegionSize, + region.RegionName, region.RegionID); reason = "Coordinates are already in use"; return false; } @@ -273,7 +276,8 @@ namespace OpenSim.Services.GridService region = m_GridService.GetRegionByUUID(scopeID, regionID); if (region != null) { - m_log.DebugFormat("[HYPERGRID LINKER]: Region already exists in coordinates {0} {1}", region.RegionLocX / Constants.RegionSize, region.RegionLocY / Constants.RegionSize); + m_log.DebugFormat("[HYPERGRID LINKER]: Region already exists in coordinates {0} {1}", + region.RegionLocX / Constants.RegionSize, region.RegionLocY / Constants.RegionSize); regInfo = region; return true; } @@ -425,15 +429,14 @@ namespace OpenSim.Services.GridService return; } - MainConsole.Instance.Output("Region Name Region UUID"); - MainConsole.Instance.Output("Location URI"); - MainConsole.Instance.Output("-------------------------------------------------------------------------------"); + MainConsole.Instance.Output("Region Name"); + MainConsole.Instance.Output("Location Region UUID"); + MainConsole.Instance.Output(new string('-', 72)); foreach (RegionData r in regions) { - MainConsole.Instance.Output(String.Format("{0,-39} {1}\n{2,-39} {3}\n", - r.RegionName, r.RegionID, - String.Format("{0},{1} ({2},{3})", r.posX, r.posY, r.posX / 256, r.posY / 256), - r.Data["serverURI"].ToString())); + MainConsole.Instance.Output(String.Format("{0}\n{2,-32} {1}\n", + r.RegionName, r.RegionID, String.Format("{0},{1} ({2},{3})", r.posX, r.posY, + r.posX / Constants.RegionSize, r.posY / Constants.RegionSize))); } return; } @@ -461,11 +464,14 @@ namespace OpenSim.Services.GridService xloc = Convert.ToInt32(cmdparams[0]) * (int)Constants.RegionSize; yloc = Convert.ToInt32(cmdparams[1]) * (int)Constants.RegionSize; serverURI = cmdparams[2]; - if (cmdparams.Length == 4) - remoteName = cmdparams[3]; + if (cmdparams.Length > 3) + remoteName = string.Join(" ", cmdparams, 3, cmdparams.Length - 3); string reason = string.Empty; GridRegion regInfo; - TryCreateLink(UUID.Zero, xloc, yloc, remoteName, 0, null, serverURI, UUID.Zero, out regInfo, out reason); + if (TryCreateLink(UUID.Zero, xloc, yloc, remoteName, 0, null, serverURI, UUID.Zero, out regInfo, out reason)) + MainConsole.Instance.Output("Hyperlink established"); + else + MainConsole.Instance.Output("Failed to link region: " + reason); } private void RunHGCommand(string command, string[] cmdparams) @@ -490,18 +496,6 @@ namespace OpenSim.Services.GridService } else if (command.Equals("link-region")) { - if (cmdparams.Length > 0 && cmdparams.Length < 5) - { - RunLinkRegionCommand(cmdparams); - } - else - { - LinkRegionCmdUsage(); - } - return; - } - else if (command.Equals("link-region")) - { if (cmdparams.Length < 3) { if ((cmdparams.Length == 1) || (cmdparams.Length == 2)) @@ -516,40 +510,24 @@ namespace OpenSim.Services.GridService } //this should be the prefererred way of setting up hg links now - if ( cmdparams[2].StartsWith("http") && ( cmdparams.Length >= 3 && cmdparams.Length <= 5 )) { + if (cmdparams[2].StartsWith("http")) + { RunLinkRegionCommand(cmdparams); } else if (cmdparams[2].Contains(":")) { // New format - int xloc, yloc; - string mapName; - try - { - xloc = Convert.ToInt32(cmdparams[0]); - yloc = Convert.ToInt32(cmdparams[1]); - mapName = cmdparams[2]; - if (cmdparams.Length > 3) - for (int i = 3; i < cmdparams.Length; i++) - mapName += " " + cmdparams[i]; - - //m_log.Info(">> MapName: " + mapName); - } - catch (Exception e) + string[] parts = cmdparams[2].Split(':'); + if (parts.Length > 2) { - MainConsole.Instance.Output("[HGrid] Wrong format for link-region command: " + e.Message); - LinkRegionCmdUsage(); - return; + // Insert remote region name + ArrayList parameters = new ArrayList(cmdparams); + parameters.Insert(3, parts[2]); + cmdparams = (string[])parameters.ToArray(typeof(string)); } + cmdparams[2] = "http://" + parts[0] + ':' + parts[1]; - // Convert cell coordinates given by the user to meters - xloc = xloc * (int)Constants.RegionSize; - yloc = yloc * (int)Constants.RegionSize; - string reason = string.Empty; - if (TryLinkRegionToCoords(UUID.Zero, mapName, xloc, yloc, out reason) == null) - MainConsole.Instance.Output("Failed to link region: " + reason); - else - MainConsole.Instance.Output("Hyperlink established"); + RunLinkRegionCommand(cmdparams); } else { @@ -558,16 +536,12 @@ namespace OpenSim.Services.GridService int xloc, yloc; uint externalPort; string externalHostName; - string serverURI; try { xloc = Convert.ToInt32(cmdparams[0]); yloc = Convert.ToInt32(cmdparams[1]); externalPort = Convert.ToUInt32(cmdparams[3]); externalHostName = cmdparams[2]; - if ( cmdparams.Length == 4 ) { - - } //internalPort = Convert.ToUInt32(cmdparams[4]); //remotingPort = Convert.ToUInt32(cmdparams[5]); } @@ -584,27 +558,30 @@ namespace OpenSim.Services.GridService string reason = string.Empty; if (TryCreateLink(UUID.Zero, xloc, yloc, string.Empty, externalPort, externalHostName, UUID.Zero, out regInfo, out reason)) { - if (cmdparams.Length >= 5) - { - regInfo.RegionName = ""; - for (int i = 4; i < cmdparams.Length; i++) - regInfo.RegionName += cmdparams[i] + " "; - } + // What is this? The GridRegion instance will be discarded anyway, + // which effectively ignores any local name given with the command. + //if (cmdparams.Length >= 5) + //{ + // regInfo.RegionName = ""; + // for (int i = 4; i < cmdparams.Length; i++) + // regInfo.RegionName += cmdparams[i] + " "; + //} } } return; } else if (command.Equals("unlink-region")) { - if (cmdparams.Length < 1 || cmdparams.Length > 1) + if (cmdparams.Length < 1) { UnlinkRegionCmdUsage(); return; } - if (TryUnlinkRegion(cmdparams[0])) - MainConsole.Instance.Output("Successfully unlinked " + cmdparams[0]); + string region = string.Join(" ", cmdparams); + if (TryUnlinkRegion(region)) + MainConsole.Instance.Output("Successfully unlinked " + region); else - MainConsole.Instance.Output("Unable to unlink " + cmdparams[0] + ", region not found."); + MainConsole.Instance.Output("Unable to unlink " + region + ", region not found."); } } -- cgit v1.1 From 9a24c0b41c786f49766c212c656f8162e4c263ef Mon Sep 17 00:00:00 2001 From: Marck Date: Mon, 13 Dec 2010 21:19:33 +0100 Subject: Show map tile for hyperlinks. Perform Check4096 before adding a hyperlink. Configuration option AssetService in section [GridService] must be set to enable this functionality. Map tiles do currently not show for hyperlinks set in simulators that are connected to grids, see Mantis #5270. --- OpenSim/Services/GridService/HypergridLinker.cs | 76 ++++++++++++++----------- 1 file changed, 42 insertions(+), 34 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 9863ba0..643d0fc 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -28,6 +28,7 @@ using System; using System.Collections; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Net; using System.Reflection; @@ -52,8 +53,6 @@ namespace OpenSim.Services.GridService LogManager.GetLogger( MethodBase.GetCurrentMethod().DeclaringType); - private static UUID m_HGMapImage = new UUID("00000000-0000-1111-9999-000000000013"); - private static uint m_autoMappingX = 0; private static uint m_autoMappingY = 0; private static bool m_enableAutoMapping = false; @@ -65,6 +64,7 @@ namespace OpenSim.Services.GridService protected UUID m_ScopeID = UUID.Zero; protected bool m_Check4096 = true; + protected string m_MapTileDirectory = string.Empty; // Hyperlink regions are hyperlinks on the map public readonly Dictionary m_HyperlinkRegions = new Dictionary(); @@ -121,9 +121,24 @@ namespace OpenSim.Services.GridService m_Check4096 = gridConfig.GetBoolean("Check4096", true); + m_MapTileDirectory = gridConfig.GetString("MapTileDirectory", string.Empty); + m_GatekeeperConnector = new GatekeeperServiceConnector(m_AssetService); - m_log.DebugFormat("[HYPERGRID LINKER]: Loaded all services..."); + m_log.Debug("[HYPERGRID LINKER]: Loaded all services..."); + } + + if (!string.IsNullOrEmpty(m_MapTileDirectory)) + { + try + { + Directory.CreateDirectory(m_MapTileDirectory); + } + catch (Exception e) + { + m_log.WarnFormat("[HYPERGRID LINKER]: Could not create map tile storage directory {0}: {1}", m_MapTileDirectory, e); + m_MapTileDirectory = string.Empty; + } } if (MainConsole.Instance != null) @@ -271,42 +286,22 @@ namespace OpenSim.Services.GridService if (!m_GatekeeperConnector.LinkRegion(regInfo, out regionID, out handle, out externalName, out imageURL, out reason)) return false; - if (regionID != UUID.Zero) - { - region = m_GridService.GetRegionByUUID(scopeID, regionID); - if (region != null) - { - m_log.DebugFormat("[HYPERGRID LINKER]: Region already exists in coordinates {0} {1}", - region.RegionLocX / Constants.RegionSize, region.RegionLocY / Constants.RegionSize); - regInfo = region; - return true; - } - - regInfo.RegionID = regionID; - - if ( externalName == string.Empty ) - regInfo.RegionName = regInfo.ServerURI; - else - regInfo.RegionName = externalName; - - m_log.Debug("[HYPERGRID LINKER]: naming linked region " + regInfo.RegionName); - - // Try get the map image - //regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL); - // I need a texture that works for this... the one I tried doesn't seem to be working - regInfo.TerrainImage = m_HGMapImage; - - AddHyperlinkRegion(regInfo, handle); - m_log.Info("[HYPERGRID LINKER]: Successfully linked to region_uuid " + regInfo.RegionID); - - } - else + if (regionID == UUID.Zero) { m_log.Warn("[HYPERGRID LINKER]: Unable to link region"); reason = "Remote region could not be found"; return false; } + region = m_GridService.GetRegionByUUID(scopeID, regionID); + if (region != null) + { + m_log.DebugFormat("[HYPERGRID LINKER]: Region already exists in coordinates {0} {1}", + region.RegionLocX / Constants.RegionSize, region.RegionLocY / Constants.RegionSize); + regInfo = region; + return true; + } + uint x, y; if (m_Check4096 && !Check4096(handle, out x, out y)) { @@ -316,7 +311,20 @@ namespace OpenSim.Services.GridService return false; } - m_log.Debug("[HYPERGRID LINKER]: link region succeeded"); + regInfo.RegionID = regionID; + + if ( externalName == string.Empty ) + regInfo.RegionName = regInfo.ServerURI; + else + regInfo.RegionName = externalName; + + m_log.Debug("[HYPERGRID LINKER]: naming linked region " + regInfo.RegionName); + + // Get the map image + regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL, m_MapTileDirectory); + + AddHyperlinkRegion(regInfo, handle); + m_log.Info("[HYPERGRID LINKER]: Successfully linked to region_uuid " + regInfo.RegionID); return true; } -- cgit v1.1 From 2a40c8511a972768378452a42aea7a781c30509c Mon Sep 17 00:00:00 2001 From: Marck Date: Sun, 19 Dec 2010 22:59:32 +0100 Subject: Make long help text for new link-region command syntax more explicit. --- OpenSim/Services/GridService/HypergridLinker.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 643d0fc..549c715 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -144,7 +144,7 @@ namespace OpenSim.Services.GridService if (MainConsole.Instance != null) { MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", - "link-region []", + "link-region http://:/ []", "Link a HyperGrid Region", RunCommand); MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", "link-region []", -- cgit v1.1 From 711283d3ca8534d650c1ee8ed25984e75e7c6052 Mon Sep 17 00:00:00 2001 From: Marck Date: Mon, 20 Dec 2010 02:50:19 +0100 Subject: More changes to the long help text for console command link-region. --- OpenSim/Services/GridService/HypergridLinker.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 549c715..c02c813 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -143,9 +143,9 @@ namespace OpenSim.Services.GridService if (MainConsole.Instance != null) { - MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", - "link-region http://:/ []", - "Link a HyperGrid Region", RunCommand); + MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", + "link-region []", + "Link a HyperGrid Region. Examples for : http://grid.net:8002/ or http://example.org/path/foo.php", RunCommand); MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", "link-region []", "Link a hypergrid region (deprecated)", RunCommand); -- cgit v1.1 From 21dedb573be61a52cbbcc519f999f6046e20e070 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 6 Jan 2011 12:48:28 -0800 Subject: HG map tile fetch: handle cached images appropriately. --- OpenSim/Services/GridService/HypergridLinker.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index c02c813..16fcc65 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -324,7 +324,7 @@ namespace OpenSim.Services.GridService regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL, m_MapTileDirectory); AddHyperlinkRegion(regInfo, handle); - m_log.Info("[HYPERGRID LINKER]: Successfully linked to region_uuid " + regInfo.RegionID); + m_log.InfoFormat("[HYPERGRID LINKER]: Successfully linked to region_uuid {0} with image {1}", regInfo.RegionID, regInfo.TerrainImage); return true; } -- cgit v1.1 From 8c0e156b4d534cbc9ad21805529804610b7c78eb Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 7 Jan 2011 11:38:54 -0800 Subject: Make HG map search consistent with new syntax for link-region, i.e. http://foo.org. Old syntax (foo.org) is still supported, but has surprising results when ppl search again, because internally the HG link names start with http. --- OpenSim/Services/GridService/HypergridLinker.cs | 80 +++++++++++++------------ 1 file changed, 42 insertions(+), 38 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 16fcc65..588c1dd 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -162,6 +162,7 @@ namespace OpenSim.Services.GridService #region Link Region + // from map search public GridRegion LinkRegion(UUID scopeID, string regionDescriptor) { string reason = string.Empty; @@ -171,7 +172,7 @@ namespace OpenSim.Services.GridService private static Random random = new Random(); - // From the command line link-region + // From the command line link-region (obsolete) and the map public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, out string reason) { return TryLinkRegionToCoords(scopeID, mapName, xloc, yloc, UUID.Zero, out reason); @@ -180,45 +181,48 @@ namespace OpenSim.Services.GridService 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"; - string portstr; - string regionName = ""; - uint port = 0; - string[] parts = mapName.Split(new char[] { ':' }); - if (parts.Length >= 1) - { - host = parts[0]; - } - if (parts.Length >= 2) - { - portstr = parts[1]; - //m_log.Debug("-- port = " + portstr); - if (!UInt32.TryParse(portstr, out port)) - regionName = parts[1]; - } - // always take the last one - if (parts.Length >= 3) + GridRegion regInfo = null; + + if (!mapName.StartsWith("http")) { - regionName = parts[2]; - } + string host = "127.0.0.1"; + string portstr; + string regionName = ""; + uint port = 0; + string[] parts = mapName.Split(new char[] { ':' }); + if (parts.Length >= 1) + { + host = parts[0]; + } + if (parts.Length >= 2) + { + portstr = parts[1]; + //m_log.Debug("-- port = " + portstr); + if (!UInt32.TryParse(portstr, out port)) + regionName = parts[1]; + } + // always take the last one + if (parts.Length >= 3) + { + regionName = parts[2]; + } - //// Sanity check. - //try - //{ - // Util.GetHostFromDNS(host); - //} - //catch - //{ - // reason = "Malformed hostname"; - // return null; - //} - GridRegion regInfo; - bool success = TryCreateLink(scopeID, xloc, yloc, regionName, port, host, ownerID, out regInfo, out reason); - if (success) + bool success = TryCreateLink(scopeID, xloc, yloc, regionName, port, host, ownerID, out regInfo, out reason); + if (success) + { + regInfo.RegionName = mapName; + return regInfo; + } + } + else { - regInfo.RegionName = mapName; - return regInfo; + string[] parts = mapName.Split(new char[] {' '}); + string regionName = String.Empty; + if (parts.Length > 1) + regionName = parts[1]; + if (TryCreateLink(scopeID, xloc, yloc, regionName, 0, null, parts[0], ownerID, out regInfo, out reason)) + return regInfo; } return null; @@ -231,7 +235,7 @@ namespace OpenSim.Services.GridService public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string remoteRegionName, uint externalPort, string externalHostName, string serverURI, UUID ownerID, out GridRegion regInfo, out string reason) { - m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}, in {2}-{3}", + m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0} {1}, in {2}-{3}", ((serverURI == null) ? (externalHostName + ":" + externalPort) : serverURI), remoteRegionName, xloc / Constants.RegionSize, yloc / Constants.RegionSize); @@ -324,7 +328,7 @@ namespace OpenSim.Services.GridService regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL, m_MapTileDirectory); AddHyperlinkRegion(regInfo, handle); - m_log.InfoFormat("[HYPERGRID LINKER]: Successfully linked to region_uuid {0} with image {1}", regInfo.RegionID, regInfo.TerrainImage); + m_log.InfoFormat("[HYPERGRID LINKER]: Successfully linked to region {0} with image {1}", regInfo.RegionName, regInfo.TerrainImage); return true; } -- cgit v1.1 From 1613d89383574f7bba3102376e6f3a2ee99b1270 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 4 Feb 2011 20:51:51 +0000 Subject: minor: Correct misspelling of neighbour in log messages. Thanks Fly-Man- --- OpenSim/Services/GridService/GridService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 125c2be..aeff9b5 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -286,7 +286,7 @@ namespace OpenSim.Services.GridService } } - m_log.DebugFormat("[GRID SERVICE]: region {0} has {1} neighours", region.RegionName, rinfos.Count); + m_log.DebugFormat("[GRID SERVICE]: region {0} has {1} neighbours", region.RegionName, rinfos.Count); return rinfos; } -- cgit v1.1 From 144f3678631436a252ccd9a149f41e4f3711b50a Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 4 Feb 2011 12:57:22 -0800 Subject: Bug fixed on map search for HG. Affected queries that had a region name at the end. --- OpenSim/Services/GridService/HypergridLinker.cs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 588c1dd..80f2caf 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -220,9 +220,15 @@ namespace OpenSim.Services.GridService string[] parts = mapName.Split(new char[] {' '}); string regionName = String.Empty; if (parts.Length > 1) - regionName = parts[1]; + { + regionName = mapName.Substring(parts[0].Length + 1); + regionName = regionName.Trim(new char[] {'"'}); + } if (TryCreateLink(scopeID, xloc, yloc, regionName, 0, null, parts[0], ownerID, out regInfo, out reason)) + { + regInfo.RegionName = mapName; return regInfo; + } } return null; @@ -311,15 +317,15 @@ namespace OpenSim.Services.GridService { RemoveHyperlinkRegion(regInfo.RegionID); reason = "Region is too far (" + x + ", " + y + ")"; - m_log.Info("[HYPERGRID LINKER]: Unable to link, region is too far (" + x + ", " + y + ")"); + m_log.Info("[HYPERGRID LINKER]: Unable to link, reqgion is too far (" + x + ", " + y + ")"); return false; } regInfo.RegionID = regionID; - if ( externalName == string.Empty ) + if (externalName == string.Empty) regInfo.RegionName = regInfo.ServerURI; - else + else regInfo.RegionName = externalName; m_log.Debug("[HYPERGRID LINKER]: naming linked region " + regInfo.RegionName); -- cgit v1.1 From 456cdee5ce0aa6508702d6d5051e17162bf772eb Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 4 Feb 2011 21:42:45 +0000 Subject: minor: correct a log spelling mistake that was pointed out to me --- OpenSim/Services/GridService/HypergridLinker.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 80f2caf..9d98c8f 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -317,7 +317,7 @@ namespace OpenSim.Services.GridService { RemoveHyperlinkRegion(regInfo.RegionID); reason = "Region is too far (" + x + ", " + y + ")"; - m_log.Info("[HYPERGRID LINKER]: Unable to link, reqgion is too far (" + x + ", " + y + ")"); + m_log.Info("[HYPERGRID LINKER]: Unable to link, region is too far (" + x + ", " + y + ")"); return false; } -- cgit v1.1 From 5c15c5e0ffa2da1bbc57e590d05ca19d46470f89 Mon Sep 17 00:00:00 2001 From: Marck Date: Wed, 16 Feb 2011 17:42:01 +0100 Subject: Changed default directory for storing map tile images from remote regions. --- OpenSim/Services/GridService/HypergridLinker.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 9d98c8f..12ea453 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -121,7 +121,7 @@ namespace OpenSim.Services.GridService m_Check4096 = gridConfig.GetBoolean("Check4096", true); - m_MapTileDirectory = gridConfig.GetString("MapTileDirectory", string.Empty); + m_MapTileDirectory = gridConfig.GetString("MapTileDirectory", "maptiles"); m_GatekeeperConnector = new GatekeeperServiceConnector(m_AssetService); -- cgit v1.1 From 8249d77991352697b4972f7109c014db0ebd5f68 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 18 Feb 2011 23:25:59 +0000 Subject: If GridService.GetNeighbours() could not find the region then log a warning rather than causing a null reference on the normal log line This also extends the TestChildAgentEstablished() test to actually activate the EntityTransferModule, though the test is not yet viable --- OpenSim/Services/GridService/GridService.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index aeff9b5..985d77b 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -271,6 +271,7 @@ namespace OpenSim.Services.GridService { List rinfos = new List(); RegionData region = m_Database.Get(regionID, scopeID); + if (region != null) { // Not really? Maybe? @@ -278,15 +279,24 @@ namespace OpenSim.Services.GridService region.posX + (int)Constants.RegionSize + 1, region.posY + (int)Constants.RegionSize + 1, scopeID); foreach (RegionData rdata in rdatas) + { if (rdata.RegionID != regionID) { int flags = Convert.ToInt32(rdata.Data["flags"]); if ((flags & (int)Data.RegionFlags.Hyperlink) == 0) // no hyperlinks as neighbours rinfos.Add(RegionData2RegionInfo(rdata)); } + } + m_log.DebugFormat("[GRID SERVICE]: region {0} has {1} neighbours", region.RegionName, rinfos.Count); } - m_log.DebugFormat("[GRID SERVICE]: region {0} has {1} neighbours", region.RegionName, rinfos.Count); + else + { + m_log.WarnFormat( + "[GRID SERVICE]: GetNeighbours() called for scope {0}, region {1} but no such region found", + scopeID, regionID); + } + return rinfos; } -- cgit v1.1 From 2d209d3844a58a4d27fe15aa5ccd497bbd530707 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 28 Mar 2011 16:46:04 -0700 Subject: Fix mantis #5413. WARNING: new config variable in section [GridService] of the simulators called Gatekeeper -- intended to have the URL of the grid's Gatekeeper service (so that it can be checked against). See ini.examples. --- OpenSim/Services/GridService/HypergridLinker.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 12ea453..585d088 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -65,6 +65,7 @@ namespace OpenSim.Services.GridService protected UUID m_ScopeID = UUID.Zero; protected bool m_Check4096 = true; protected string m_MapTileDirectory = string.Empty; + protected string m_ThisGatekeeper = string.Empty; // Hyperlink regions are hyperlinks on the map public readonly Dictionary m_HyperlinkRegions = new Dictionary(); @@ -123,6 +124,8 @@ namespace OpenSim.Services.GridService m_MapTileDirectory = gridConfig.GetString("MapTileDirectory", "maptiles"); + m_ThisGatekeeper = gridConfig.GetString("Gatekeeper", string.Empty); + m_GatekeeperConnector = new GatekeeperServiceConnector(m_AssetService); m_log.Debug("[HYPERGRID LINKER]: Loaded all services..."); @@ -266,6 +269,13 @@ namespace OpenSim.Services.GridService regInfo.ScopeID = scopeID; regInfo.EstateOwner = ownerID; + // Make sure we're not hyperlinking to regions on this grid! + if (regInfo.ServerURI.Trim(new char[]{'/', ' '}) == m_ThisGatekeeper.Trim(new char[]{'/', ' '})) + { + reason = "Cannot hyperlink to regions on the same grid"; + return false; + } + // Check for free coordinates GridRegion region = m_GridService.GetRegionByPosition(regInfo.ScopeID, regInfo.RegionLocX, regInfo.RegionLocY); if (region != null) -- cgit v1.1 From 309eb712a32fe14f593941b9f0a5ce41f10bcd7f Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 28 Mar 2011 19:34:55 -0700 Subject: Improvement over 2 commits ago: make the hyperlink check understand port 80. --- OpenSim/Services/GridService/HypergridLinker.cs | 33 ++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 4 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 585d088..c539047 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -66,6 +66,7 @@ namespace OpenSim.Services.GridService protected bool m_Check4096 = true; protected string m_MapTileDirectory = string.Empty; protected string m_ThisGatekeeper = string.Empty; + protected Uri m_ThisGatekeeperURI = null; // Hyperlink regions are hyperlinks on the map public readonly Dictionary m_HyperlinkRegions = new Dictionary(); @@ -125,6 +126,14 @@ namespace OpenSim.Services.GridService m_MapTileDirectory = gridConfig.GetString("MapTileDirectory", "maptiles"); m_ThisGatekeeper = gridConfig.GetString("Gatekeeper", string.Empty); + try + { + m_ThisGatekeeperURI = new Uri(m_ThisGatekeeper); + } + catch + { + m_log.WarnFormat("[HYPERGRID LINKER]: Malformed URL in [GridService], variable Gatekeeper = {0}", m_ThisGatekeeper); + } m_GatekeeperConnector = new GatekeeperServiceConnector(m_AssetService); @@ -249,6 +258,8 @@ namespace OpenSim.Services.GridService remoteRegionName, xloc / Constants.RegionSize, yloc / Constants.RegionSize); reason = string.Empty; + Uri uri = null; + regInfo = new GridRegion(); if ( externalPort > 0) regInfo.HttpPort = externalPort; @@ -259,8 +270,17 @@ namespace OpenSim.Services.GridService else regInfo.ExternalHostName = "0.0.0.0"; if ( serverURI != null) + { regInfo.ServerURI = serverURI; - + try + { + uri = new Uri(serverURI); + regInfo.ExternalHostName = uri.Host; + regInfo.HttpPort = (uint)uri.Port; + } + catch {} + } + if ( remoteRegionName != string.Empty ) regInfo.RegionName = remoteRegionName; @@ -270,11 +290,16 @@ namespace OpenSim.Services.GridService regInfo.EstateOwner = ownerID; // Make sure we're not hyperlinking to regions on this grid! - if (regInfo.ServerURI.Trim(new char[]{'/', ' '}) == m_ThisGatekeeper.Trim(new char[]{'/', ' '})) + if (m_ThisGatekeeperURI != null) { - reason = "Cannot hyperlink to regions on the same grid"; - return false; + if (regInfo.ExternalHostName == m_ThisGatekeeperURI.Host && regInfo.HttpPort == m_ThisGatekeeperURI.Port) + { + reason = "Cannot hyperlink to regions on the same grid"; + return false; + } } + else + m_log.WarnFormat("[HYPERGRID LINKER]: Please set this grid's Gatekeeper's address in [GridService]!"); // Check for free coordinates GridRegion region = m_GridService.GetRegionByPosition(regInfo.ScopeID, regInfo.RegionLocX, regInfo.RegionLocY); -- cgit v1.1 From e14b7ec9e115dd1705d6952f5ecbb19806709944 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 30 May 2011 17:19:46 -0700 Subject: HGWorldMap: don't send map blocks of hyperlinks that are farther than 4096 cells from the current region. --- OpenSim/Services/GridService/HypergridLinker.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index c539047..b7c0e91 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -363,11 +363,14 @@ namespace OpenSim.Services.GridService else regInfo.RegionName = externalName; - m_log.Debug("[HYPERGRID LINKER]: naming linked region " + regInfo.RegionName); + m_log.DebugFormat("[HYPERGRID LINKER]: naming linked region {0}, handle {1}", regInfo.RegionName, handle.ToString()); // Get the map image regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL, m_MapTileDirectory); + // Store the origin's coordinates somewhere + regInfo.RegionSecret = handle.ToString(); + AddHyperlinkRegion(regInfo, handle); m_log.InfoFormat("[HYPERGRID LINKER]: Successfully linked to region {0} with image {1}", regInfo.RegionName, regInfo.TerrainImage); return true; -- cgit v1.1 From b81a304baaeeee4e0dabb42c8e217c3c30be9863 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 30 May 2011 20:12:05 -0700 Subject: Made the GatekeeperConnector a public property. --- OpenSim/Services/GridService/HypergridLinker.cs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index b7c0e91..64935af 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -61,6 +61,10 @@ namespace OpenSim.Services.GridService protected GridService m_GridService; protected IAssetService m_AssetService; protected GatekeeperServiceConnector m_GatekeeperConnector; + public GatekeeperServiceConnector GatekeeperConnector + { + get { return m_GatekeeperConnector; } + } protected UUID m_ScopeID = UUID.Zero; protected bool m_Check4096 = true; -- cgit v1.1 From 44371118a2ac50b21e31995d3bcc309a5e1dc56c Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 30 May 2011 20:23:45 -0700 Subject: Made GetMapImage public in the Hyperlinker --- OpenSim/Services/GridService/HypergridLinker.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 64935af..5262598 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -61,10 +61,6 @@ namespace OpenSim.Services.GridService protected GridService m_GridService; protected IAssetService m_AssetService; protected GatekeeperServiceConnector m_GatekeeperConnector; - public GatekeeperServiceConnector GatekeeperConnector - { - get { return m_GatekeeperConnector; } - } protected UUID m_ScopeID = UUID.Zero; protected bool m_Check4096 = true; @@ -370,7 +366,7 @@ namespace OpenSim.Services.GridService m_log.DebugFormat("[HYPERGRID LINKER]: naming linked region {0}, handle {1}", regInfo.RegionName, handle.ToString()); // Get the map image - regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL, m_MapTileDirectory); + regInfo.TerrainImage = GetMapImage(regionID, imageURL); // Store the origin's coordinates somewhere regInfo.RegionSecret = handle.ToString(); @@ -470,6 +466,10 @@ namespace OpenSim.Services.GridService m_Database.Delete(regionID); } + public UUID GetMapImage(UUID regionID, string imageURL) + { + return m_GatekeeperConnector.GetMapImage(regionID, imageURL, m_MapTileDirectory); + } #endregion -- cgit v1.1 From de20f0603fa419ba16c56d16c2ad55301cad8b83 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 24 Jun 2011 19:49:05 +0100 Subject: Tell hypergridders when their teleports fail because of the 4096 limit rather than just saying "destination not found" Instead of performing the 4096 check when the region is linked (and subsequently removing the link), leave the link in place and perform the check in the entity transfer module This allows us to explicitly tell the hypergridder why the teleport failed (region out of range). It also allows people on regions that are within range (on a large source grid) to teleport. The Check4096 config parameter in the [GridService] section is replaced by a max_distance paramter in a new [EntityTransfer] section in OpenSimDefaults.ini Since the parameter is in OpenSimDefaults.ini no action needs to be taken unless you want to increase this limit. It could also be decreased. The check is being made in the base entity transfer module, since I believe the viewer problem occurs both on extremely large grids and while hypergridding. --- OpenSim/Services/GridService/HypergridLinker.cs | 115 ++++++++++++------------ 1 file changed, 59 insertions(+), 56 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 5262598..83ec122 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -63,7 +63,7 @@ namespace OpenSim.Services.GridService protected GatekeeperServiceConnector m_GatekeeperConnector; protected UUID m_ScopeID = UUID.Zero; - protected bool m_Check4096 = true; +// protected bool m_Check4096 = true; protected string m_MapTileDirectory = string.Empty; protected string m_ThisGatekeeper = string.Empty; protected Uri m_ThisGatekeeperURI = null; @@ -121,7 +121,7 @@ namespace OpenSim.Services.GridService if (scope != string.Empty) UUID.TryParse(scope, out m_ScopeID); - m_Check4096 = gridConfig.GetBoolean("Check4096", true); +// m_Check4096 = gridConfig.GetBoolean("Check4096", true); m_MapTileDirectory = gridConfig.GetString("MapTileDirectory", "maptiles"); @@ -347,14 +347,18 @@ namespace OpenSim.Services.GridService return true; } - uint x, y; - if (m_Check4096 && !Check4096(handle, out x, out y)) - { - RemoveHyperlinkRegion(regInfo.RegionID); - reason = "Region is too far (" + x + ", " + y + ")"; - m_log.Info("[HYPERGRID LINKER]: Unable to link, region is too far (" + x + ", " + y + ")"); - return false; - } + // We are now performing this check for each individual teleport in the EntityTransferModule instead. This + // allows us to give better feedback when teleports fail because of the distance reason (which can't be + // done here) and it also hypergrid teleports that are within range (possibly because the source grid + // itself has regions that are very far apart). +// uint x, y; +// if (m_Check4096 && !Check4096(handle, out x, out y)) +// { +// //RemoveHyperlinkRegion(regInfo.RegionID); +// reason = "Region is too far (" + x + ", " + y + ")"; +// m_log.Info("[HYPERGRID LINKER]: Unable to link, region is too far (" + x + ", " + y + ")"); +// //return false; +// } regInfo.RegionID = regionID; @@ -405,60 +409,59 @@ namespace OpenSim.Services.GridService } } - /// - /// Cope with this viewer limitation. - /// - /// - /// - public bool Check4096(ulong realHandle, out uint x, out uint y) - { - uint ux = 0, uy = 0; - Utils.LongToUInts(realHandle, out ux, out uy); - x = ux / Constants.RegionSize; - y = uy / 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; - } +// Not currently used +// /// +// /// Cope with this viewer limitation. +// /// +// /// +// /// +// public bool Check4096(ulong realHandle, out uint x, out uint y) +// { +// uint ux = 0, uy = 0; +// Utils.LongToUInts(realHandle, out ux, out uy); +// x = ux / Constants.RegionSize; +// y = uy / 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; +// } private void AddHyperlinkRegion(GridRegion regionInfo, ulong regionHandle) { - RegionData rdata = m_GridService.RegionInfo2RegionData(regionInfo); int flags = (int)OpenSim.Data.RegionFlags.Hyperlink + (int)OpenSim.Data.RegionFlags.NoDirectLogin + (int)OpenSim.Data.RegionFlags.RegionOnline; rdata.Data["flags"] = flags.ToString(); m_Database.Store(rdata); - } private void RemoveHyperlinkRegion(UUID regionID) -- cgit v1.1 From 8d33a2eaa10ed75146f45cca4d6c19ac814d5fee Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 2 Aug 2011 00:26:17 +0100 Subject: In GridService, have GetRegionByName() call GetRegionsByName() with a max return of 1 instead of duplicating code. This also fixes the problem where this method would not return a hypergrid region, unlike GetRegionsByName() --- OpenSim/Services/GridService/GridService.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 985d77b..1253b5a 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -322,16 +322,17 @@ namespace OpenSim.Services.GridService public GridRegion GetRegionByName(UUID scopeID, string regionName) { - List rdatas = m_Database.Get(regionName + "%", scopeID); - if ((rdatas != null) && (rdatas.Count > 0)) - return RegionData2RegionInfo(rdatas[0]); // get the first + List rinfos = GetRegionsByName(scopeID, regionName, 1); + + if (rinfos.Count > 0) + return rinfos[0]; return null; } public List GetRegionsByName(UUID scopeID, string name, int maxNumber) { - m_log.DebugFormat("[GRID SERVICE]: GetRegionsByName {0}", name); +// m_log.DebugFormat("[GRID SERVICE]: GetRegionsByName {0}", name); List rdatas = m_Database.Get(name + "%", scopeID); -- cgit v1.1 From e6fb9d74ef10e381731b31367a96ad751484a867 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 2 Aug 2011 00:40:23 +0100 Subject: Revert "In GridService, have GetRegionByName() call GetRegionsByName() with a max return of 1 instead of duplicating code." This reverts commit 8d33a2eaa10ed75146f45cca4d6c19ac814d5fee. Better fix will be along in a minute --- OpenSim/Services/GridService/GridService.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 1253b5a..985d77b 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -322,17 +322,16 @@ namespace OpenSim.Services.GridService public GridRegion GetRegionByName(UUID scopeID, string regionName) { - List rinfos = GetRegionsByName(scopeID, regionName, 1); - - if (rinfos.Count > 0) - return rinfos[0]; + List rdatas = m_Database.Get(regionName + "%", scopeID); + if ((rdatas != null) && (rdatas.Count > 0)) + return RegionData2RegionInfo(rdatas[0]); // get the first return null; } public List GetRegionsByName(UUID scopeID, string name, int maxNumber) { -// m_log.DebugFormat("[GRID SERVICE]: GetRegionsByName {0}", name); + m_log.DebugFormat("[GRID SERVICE]: GetRegionsByName {0}", name); List rdatas = m_Database.Get(name + "%", scopeID); -- cgit v1.1 From 17e9d61f4383627434b7b8249cea1a487f001099 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 2 Aug 2011 00:52:48 +0100 Subject: Change GridService.GetRegionByName() to only return info if there is an exact region name match, unlike GetRegionsByName() This should fix the first part of http://opensimulator.org/mantis/view.php?id=5606, and maybe 5605. Thanks to Melanie for helping with this. --- OpenSim/Services/GridService/GridService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 985d77b..a6fbc00 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -322,7 +322,7 @@ namespace OpenSim.Services.GridService public GridRegion GetRegionByName(UUID scopeID, string regionName) { - List rdatas = m_Database.Get(regionName + "%", scopeID); + List rdatas = m_Database.Get(regionName, scopeID); if ((rdatas != null) && (rdatas.Count > 0)) return RegionData2RegionInfo(rdatas[0]); // get the first -- cgit v1.1 From b7f81d34928cb2d7296b91a8569adb488c264e36 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 2 Aug 2011 01:06:32 +0100 Subject: If GetRegionByName can't match something in the local db, then search the hypergrid if that functionality has been enabled. This should fix the problem today where old style HG addresses (e.g. "hg.osgrid.org:80:Vue-6400") stopped working since 8c3eb324c4b666e7abadef4a714d1bd8d5f71ac2 --- OpenSim/Services/GridService/GridService.cs | 33 +++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index a6fbc00..f663dd6 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -320,18 +320,25 @@ namespace OpenSim.Services.GridService return null; } - public GridRegion GetRegionByName(UUID scopeID, string regionName) + public GridRegion GetRegionByName(UUID scopeID, string name) { - List rdatas = m_Database.Get(regionName, scopeID); + List rdatas = m_Database.Get(name, scopeID); if ((rdatas != null) && (rdatas.Count > 0)) return RegionData2RegionInfo(rdatas[0]); // get the first + if (m_AllowHypergridMapSearch) + { + GridRegion r = GetHypergridRegionByName(scopeID, name); + if (r != null) + return r; + } + return null; } public List GetRegionsByName(UUID scopeID, string name, int maxNumber) { - m_log.DebugFormat("[GRID SERVICE]: GetRegionsByName {0}", name); +// m_log.DebugFormat("[GRID SERVICE]: GetRegionsByName {0}", name); List rdatas = m_Database.Get(name + "%", scopeID); @@ -340,7 +347,7 @@ namespace OpenSim.Services.GridService if (rdatas != null) { - m_log.DebugFormat("[GRID SERVICE]: Found {0} regions", rdatas.Count); +// m_log.DebugFormat("[GRID SERVICE]: Found {0} regions", rdatas.Count); foreach (RegionData rdata in rdatas) { if (count++ < maxNumber) @@ -348,9 +355,9 @@ namespace OpenSim.Services.GridService } } - if (m_AllowHypergridMapSearch && (rdatas == null || (rdatas != null && rdatas.Count == 0)) && name.Contains(".")) + if (m_AllowHypergridMapSearch && (rdatas == null || (rdatas != null && rdatas.Count == 0))) { - GridRegion r = m_HypergridLinker.LinkRegion(scopeID, name); + GridRegion r = GetHypergridRegionByName(scopeID, name); if (r != null) rinfos.Add(r); } @@ -358,6 +365,20 @@ namespace OpenSim.Services.GridService return rinfos; } + /// + /// Get a hypergrid region. + /// + /// + /// + /// null if no hypergrid region could be found. + protected GridRegion GetHypergridRegionByName(UUID scopeID, string name) + { + if (name.Contains(".")) + return m_HypergridLinker.LinkRegion(scopeID, name); + else + return null; + } + public List GetRegionRange(UUID scopeID, int xmin, int xmax, int ymin, int ymax) { int xminSnap = (int)(xmin / Constants.RegionSize) * (int)Constants.RegionSize; -- cgit v1.1 From f18780d0e3a6e5130b1c1d86c71630801dc70c57 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 5 Aug 2011 22:56:53 +0100 Subject: Get "show region" command in GridService to show grid co-ordinates rather than meters co-ord. This makes it consistent with "show regions" Addresses http://opensimulator.org/mantis/view.php?id=5619 --- OpenSim/Services/GridService/GridService.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index f663dd6..0a4372a 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -510,8 +510,9 @@ namespace OpenSim.Services.GridService OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]); MainConsole.Instance.Output(String.Format("{0,-20} {1}\n{2,-20} {3}\n{4,-39} {5}\n\n", r.RegionName, r.RegionID, - String.Format("{0},{1}", r.posX, r.posY), r.Data["serverURI"], - r.Data["owner_uuid"].ToString(), flags.ToString())); + String.Format("{0},{1}", r.posX / Constants.RegionSize, r.posY / Constants.RegionSize), + r.Data["serverURI"], + r.Data["owner_uuid"], flags)); } return; } -- cgit v1.1 From a6c5e00c45b3d64b4e912a65c8ed7f31eb643759 Mon Sep 17 00:00:00 2001 From: Pixel Tomsen Date: Thu, 6 Oct 2011 21:04:20 +0200 Subject: GridService - Region UUID can not be NULL http://opensimulator.org/mantis/view.php?id=3426 --- OpenSim/Services/GridService/GridService.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 0a4372a..0aeae67 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -107,6 +107,8 @@ namespace OpenSim.Services.GridService public string RegisterRegion(UUID scopeID, GridRegion regionInfos) { IConfig gridConfig = m_config.Configs["GridService"]; + // First Check for invalidate NULL-UUID, if true fast quit + if (regionInfos.RegionID == UUID.Zero) return "Invalidate RegionID - can not be UUID-NULL"; // This needs better sanity testing. What if regionInfo is registering in // overlapping coords? RegionData region = m_Database.Get(regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID); -- cgit v1.1 From 156385f48b2b2829f2d427c72f269406c46019fa Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 8 Oct 2011 02:15:04 +0100 Subject: Tweak to language of last commit in rejecting UUID.Zero in GridService.RegisterRegion() Allowing regions with UUID.Zero causes problems elsewhere according to http://opensimulator.org/mantis/view.php?id=3426 It's probably a bad idea to allow these in any case. --- OpenSim/Services/GridService/GridService.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 0aeae67..05cfe5f 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -107,8 +107,10 @@ namespace OpenSim.Services.GridService public string RegisterRegion(UUID scopeID, GridRegion regionInfos) { IConfig gridConfig = m_config.Configs["GridService"]; - // First Check for invalidate NULL-UUID, if true fast quit - if (regionInfos.RegionID == UUID.Zero) return "Invalidate RegionID - can not be UUID-NULL"; + + if (regionInfos.RegionID == UUID.Zero) + return "Invalid RegionID - cannot be zero UUID"; + // This needs better sanity testing. What if regionInfo is registering in // overlapping coords? RegionData region = m_Database.Get(regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID); -- cgit v1.1 From 4b7b9e81f7b33c86f691e2bca756a3639fe9ee04 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 12 Oct 2011 15:41:59 +0100 Subject: Make it possible to disable the HG linker. On non-HG systems it spits yellow spam, so it should not load unless HG is desired. --- OpenSim/Services/GridService/HypergridLinker.cs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 83ec122..90c022f 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -102,6 +102,13 @@ namespace OpenSim.Services.GridService public HypergridLinker(IConfigSource config, GridService gridService, IRegionData db) { + IConfig modulesConfig = config.Configs["Modules"]; + if (modulesConfig == null) + return; + + if (modulesConfig.GetString("HypergridLinker", "") != "HypergridLinker") + return; + m_log.DebugFormat("[HYPERGRID LINKER]: Starting with db {0}", db.GetType()); m_Database = db; -- cgit v1.1 From 01ae916bad672722aa62ee712b7b580d6f5f4370 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 19 Nov 2011 00:07:34 +0000 Subject: Don't register a region twice on both official registration and maptile regeneration. Maptile storage appears orthogonal to region registration --- OpenSim/Services/GridService/GridService.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 05cfe5f..768e4e1 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -156,6 +156,7 @@ namespace OpenSim.Services.GridService regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID); return "Region overlaps another region"; } + if ((region != null) && (region.RegionID == regionInfos.RegionID) && ((region.posX != regionInfos.RegionLocX) || (region.posY != regionInfos.RegionLocY))) { -- cgit v1.1 From 7a180781778a6369799c244ab95f5e6844b3be05 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 19 Nov 2011 00:10:29 +0000 Subject: improve region deregistration log message --- OpenSim/Services/GridService/GridService.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 768e4e1..82a9193 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -244,11 +244,14 @@ namespace OpenSim.Services.GridService public bool DeregisterRegion(UUID regionID) { - m_log.DebugFormat("[GRID SERVICE]: Region {0} deregistered", regionID); RegionData region = m_Database.Get(regionID, UUID.Zero); if (region == null) return false; + m_log.DebugFormat( + "[GRID SERVICE]: Degistering region {0} ({1}) at {2}-{3}", + region.RegionName, region.RegionID, region.posX, region.posY); + int flags = Convert.ToInt32(region.Data["flags"]); if (!m_DeleteOnUnregister || (flags & (int)OpenSim.Data.RegionFlags.Persistent) != 0) -- cgit v1.1 From d05d065d859c8877cb910cf5748e32e1560086a6 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 19 Nov 2011 00:29:52 +0000 Subject: Improve some grid region log messages to express regions at co-ordinate (e.g. 1000, 1000) rather than meter positions (256000, 256000) --- OpenSim/Services/GridService/GridService.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 82a9193..eae10e8 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -237,7 +237,7 @@ namespace OpenSim.Services.GridService } m_log.DebugFormat("[GRID SERVICE]: Region {0} ({1}) registered successfully at {2}-{3}", - regionInfos.RegionName, regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY); + regionInfos.RegionName, regionInfos.RegionID, regionInfos.RegionCoordX, regionInfos.RegionCoordY); return String.Empty; } @@ -250,8 +250,8 @@ namespace OpenSim.Services.GridService m_log.DebugFormat( "[GRID SERVICE]: Degistering region {0} ({1}) at {2}-{3}", - region.RegionName, region.RegionID, region.posX, region.posY); - + region.RegionName, region.RegionID, region.coordX, region.coordY); + int flags = Convert.ToInt32(region.Data["flags"]); if (!m_DeleteOnUnregister || (flags & (int)OpenSim.Data.RegionFlags.Persistent) != 0) -- cgit v1.1 From 10a23a823edb261af2c0b7895ce0898ea6918ef1 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 19 Nov 2011 01:16:07 +0000 Subject: Get rid of the spurious [WEB UTIL] couldn't decode : Invalid character 'O' in input string messages These are just the result of an attempt to canonicalize received messages - it's not important that we constantly log them. Also finally get the deregister grid service message working properly --- OpenSim/Services/GridService/GridService.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index eae10e8..89f0716 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -249,7 +249,7 @@ namespace OpenSim.Services.GridService return false; m_log.DebugFormat( - "[GRID SERVICE]: Degistering region {0} ({1}) at {2}-{3}", + "[GRID SERVICE]: Deregistering region {0} ({1}) at {2}-{3}", region.RegionName, region.RegionID, region.coordX, region.coordY); int flags = Convert.ToInt32(region.Data["flags"]); @@ -296,7 +296,7 @@ namespace OpenSim.Services.GridService } } - m_log.DebugFormat("[GRID SERVICE]: region {0} has {1} neighbours", region.RegionName, rinfos.Count); +// m_log.DebugFormat("[GRID SERVICE]: region {0} has {1} neighbours", region.RegionName, rinfos.Count); } else { -- cgit v1.1 From 5d8ed077bc01b46cdd4a6854cc08c735ebb66c24 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 30 Dec 2011 19:17:35 -0800 Subject: Bring back the Hyperlinker to the Robust console. Moved the config to [GridService]. Changed all HG-related .inis, including HyperSimianGrid. No changes in user-facing inis. --- OpenSim/Services/GridService/HypergridLinker.cs | 55 +++++++++++-------------- 1 file changed, 25 insertions(+), 30 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 90c022f..78eab3d 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -102,50 +102,45 @@ namespace OpenSim.Services.GridService public HypergridLinker(IConfigSource config, GridService gridService, IRegionData db) { - IConfig modulesConfig = config.Configs["Modules"]; - if (modulesConfig == null) - return; - - if (modulesConfig.GetString("HypergridLinker", "") != "HypergridLinker") - return; + IConfig gridConfig = config.Configs["GridService"]; + if (gridConfig == null) + return; - m_log.DebugFormat("[HYPERGRID LINKER]: Starting with db {0}", db.GetType()); + if (!gridConfig.GetBoolean("HypergridLinker", false)) + return; m_Database = db; m_GridService = gridService; + m_log.DebugFormat("[HYPERGRID LINKER]: Starting with db {0}", db.GetType()); - IConfig gridConfig = config.Configs["GridService"]; - if (gridConfig != null) - { - string assetService = gridConfig.GetString("AssetService", string.Empty); + string assetService = gridConfig.GetString("AssetService", string.Empty); - Object[] args = new Object[] { config }; + Object[] args = new Object[] { config }; - if (assetService != string.Empty) - m_AssetService = ServerUtils.LoadPlugin(assetService, args); + if (assetService != string.Empty) + m_AssetService = ServerUtils.LoadPlugin(assetService, args); - string scope = gridConfig.GetString("ScopeID", string.Empty); - if (scope != string.Empty) - UUID.TryParse(scope, out m_ScopeID); + string scope = gridConfig.GetString("ScopeID", string.Empty); + if (scope != string.Empty) + UUID.TryParse(scope, out m_ScopeID); // m_Check4096 = gridConfig.GetBoolean("Check4096", true); - m_MapTileDirectory = gridConfig.GetString("MapTileDirectory", "maptiles"); + m_MapTileDirectory = gridConfig.GetString("MapTileDirectory", "maptiles"); - m_ThisGatekeeper = gridConfig.GetString("Gatekeeper", string.Empty); - try - { - m_ThisGatekeeperURI = new Uri(m_ThisGatekeeper); - } - catch - { - m_log.WarnFormat("[HYPERGRID LINKER]: Malformed URL in [GridService], variable Gatekeeper = {0}", m_ThisGatekeeper); - } + m_ThisGatekeeper = gridConfig.GetString("Gatekeeper", string.Empty); + try + { + m_ThisGatekeeperURI = new Uri(m_ThisGatekeeper); + } + catch + { + m_log.WarnFormat("[HYPERGRID LINKER]: Malformed URL in [GridService], variable Gatekeeper = {0}", m_ThisGatekeeper); + } - m_GatekeeperConnector = new GatekeeperServiceConnector(m_AssetService); + m_GatekeeperConnector = new GatekeeperServiceConnector(m_AssetService); - m_log.Debug("[HYPERGRID LINKER]: Loaded all services..."); - } + m_log.Debug("[HYPERGRID LINKER]: Loaded all services..."); if (!string.IsNullOrEmpty(m_MapTileDirectory)) { -- cgit v1.1 From 749c3fef8ad2d3af97fcd9ab9c72740675e46715 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 8 Mar 2012 01:51:37 +0000 Subject: Change "help" to display categories/module list then "help " to display commands in a category. This is to deal with the hundred lines of command splurge when one previously typed "help" Modelled somewhat on the mysql console One can still type help to get per command help at any point. Categories capitalized to avoid conflict with the all-lowercase commands (except for commander system, as of yet). Does not affect command parsing or any other aspects of the console apart from the help system. Backwards compatible with existing modules. --- OpenSim/Services/GridService/GridService.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 89f0716..3dc87bc 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -84,14 +84,14 @@ namespace OpenSim.Services.GridService if (MainConsole.Instance != null) { - MainConsole.Instance.Commands.AddCommand("grid", true, + MainConsole.Instance.Commands.AddCommand("Regions", true, "show region", "show region ", "Show details on a region", String.Empty, HandleShowRegion); - MainConsole.Instance.Commands.AddCommand("grid", true, + MainConsole.Instance.Commands.AddCommand("Regions", true, "set region flags", "set region flags ", "Set database flags for region", -- cgit v1.1 From 050007b44da97bf155fca95cadc32cb27924e263 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 23 May 2012 02:30:16 +0100 Subject: Lay out "show region" information in an easier to read line by line format --- OpenSim/Services/GridService/GridService.cs | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 3dc87bc..b17fca7 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -509,19 +509,21 @@ namespace OpenSim.Services.GridService return; } - MainConsole.Instance.Output("Region Name Region UUID"); - MainConsole.Instance.Output("Location URI"); - MainConsole.Instance.Output("Owner ID Flags"); - MainConsole.Instance.Output("-------------------------------------------------------------------------------"); + ICommandConsole con = MainConsole.Instance; + foreach (RegionData r in regions) { OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]); - MainConsole.Instance.Output(String.Format("{0,-20} {1}\n{2,-20} {3}\n{4,-39} {5}\n\n", - r.RegionName, r.RegionID, - String.Format("{0},{1}", r.posX / Constants.RegionSize, r.posY / Constants.RegionSize), - r.Data["serverURI"], - r.Data["owner_uuid"], flags)); + + con.OutputFormat("{0,-11}: {1}", "Region Name", r.RegionName); + con.OutputFormat("{0,-11}: {1}", "Region ID", r.RegionID); + con.OutputFormat("{0,-11}: {1}", "Location", r.coordX, r.coordY); + con.OutputFormat("{0,-11}: {1}", "URI", r.Data["serverURI"]); + con.OutputFormat("{0,-11}: {1}", "Owner ID", r.Data["owner_uuid"]); + con.OutputFormat("{0,-11}: {1}", "Flags", flags); + con.Output("\n"); } + return; } -- cgit v1.1 From c6ce41bfbab310eae2366ad494a0dbb42cebc070 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 23 May 2012 02:31:53 +0100 Subject: Add missing Y co-ord in "show region" console command information --- OpenSim/Services/GridService/GridService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index b17fca7..9d81eb5 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -517,7 +517,7 @@ namespace OpenSim.Services.GridService con.OutputFormat("{0,-11}: {1}", "Region Name", r.RegionName); con.OutputFormat("{0,-11}: {1}", "Region ID", r.RegionID); - con.OutputFormat("{0,-11}: {1}", "Location", r.coordX, r.coordY); + con.OutputFormat("{0,-11}: {1},{2}", "Location", r.coordX, r.coordY); con.OutputFormat("{0,-11}: {1}", "URI", r.Data["serverURI"]); con.OutputFormat("{0,-11}: {1}", "Owner ID", r.Data["owner_uuid"]); con.OutputFormat("{0,-11}: {1}", "Flags", flags); -- cgit v1.1 From 059a1e90b92c3c1ca027c0ec59f3628d87a954a6 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 23 May 2012 03:19:25 +0100 Subject: Add ConsoleDisplayList for more consistent formatting of console output in list form. Convert "show region" to use this structure rather than hand-constructing --- OpenSim/Services/GridService/GridService.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 9d81eb5..8a60ca5 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -509,19 +509,19 @@ namespace OpenSim.Services.GridService return; } - ICommandConsole con = MainConsole.Instance; - foreach (RegionData r in regions) { OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]); - con.OutputFormat("{0,-11}: {1}", "Region Name", r.RegionName); - con.OutputFormat("{0,-11}: {1}", "Region ID", r.RegionID); - con.OutputFormat("{0,-11}: {1},{2}", "Location", r.coordX, r.coordY); - con.OutputFormat("{0,-11}: {1}", "URI", r.Data["serverURI"]); - con.OutputFormat("{0,-11}: {1}", "Owner ID", r.Data["owner_uuid"]); - con.OutputFormat("{0,-11}: {1}", "Flags", flags); - con.Output("\n"); + ConsoleDisplayList dispList = new ConsoleDisplayList(); + dispList.AddRow("Region Name", r.RegionName); + dispList.AddRow("Region ID", r.RegionID); + dispList.AddRow("Location", string.Format("{0},{1}", r.coordX, r.coordY)); + dispList.AddRow("URI", r.Data["serverURI"]); + dispList.AddRow("Owner ID", r.Data["owner_uuid"]); + dispList.AddRow("Flags", flags); + + MainConsole.Instance.Output(dispList.ToString()); } return; -- cgit v1.1 From 5145356467244d6a4d66cd36eef22a23d6fc73a1 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 13 Jun 2012 03:49:22 +0100 Subject: Add "deregister region" by uuid command to grid service to allow manual deregistration of simulators. Useful if a simulator has crashed without removing its regions and those regions have been reconfigured differently --- OpenSim/Services/GridService/GridService.cs | 45 +++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 8a60ca5..11897f8 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -85,6 +85,13 @@ namespace OpenSim.Services.GridService if (MainConsole.Instance != null) { MainConsole.Instance.Commands.AddCommand("Regions", true, + "deregister region", + "deregister region ", + "Deregister a region manually.", + String.Empty, + HandleDeregisterRegion); + + MainConsole.Instance.Commands.AddCommand("Regions", true, "show region", "show region ", "Show details on a region", @@ -495,6 +502,44 @@ namespace OpenSim.Services.GridService return -1; } + private void HandleDeregisterRegion(string module, string[] cmd) + { + if (cmd.Length != 3) + { + MainConsole.Instance.Output("Syntax: degregister region "); + return; + } + + string rawRegionUuid = cmd[2]; + UUID regionUuid; + + if (!UUID.TryParse(rawRegionUuid, out regionUuid)) + { + MainConsole.Instance.OutputFormat("{0} is not a valid region uuid", rawRegionUuid); + return; + } + + GridRegion region = GetRegionByUUID(UUID.Zero, regionUuid); + + if (region == null) + { + MainConsole.Instance.OutputFormat("No region with UUID {0}", regionUuid); + return; + } + + if (DeregisterRegion(regionUuid)) + { + MainConsole.Instance.OutputFormat("Deregistered {0} {1}", region.RegionName, regionUuid); + } + else + { + // I don't think this can ever occur if we know that the region exists. + MainConsole.Instance.OutputFormat("Error deregistering {0} {1}", region.RegionName, regionUuid); + } + + return; + } + private void HandleShowRegion(string module, string[] cmd) { if (cmd.Length != 3) -- cgit v1.1 From 854f2a913cdedfa252b69d5c3118d35604ab6b4a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 25 Jun 2012 23:55:14 +0100 Subject: Add "show region at" command to grid service to get the details of a region at a specific location. "show region" command becomes "show region name" to disambiguate This is the same format as used by "show object name", etc. "deregister region" also becomes "deregister region id" --- OpenSim/Services/GridService/GridService.cs | 91 ++++++++++++++++++++++------- 1 file changed, 69 insertions(+), 22 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 11897f8..7d2dadb 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -85,20 +85,27 @@ namespace OpenSim.Services.GridService if (MainConsole.Instance != null) { MainConsole.Instance.Commands.AddCommand("Regions", true, - "deregister region", - "deregister region ", + "deregister region id", + "deregister region id ", "Deregister a region manually.", String.Empty, HandleDeregisterRegion); MainConsole.Instance.Commands.AddCommand("Regions", true, - "show region", - "show region ", + "show region name", + "show region name ", "Show details on a region", String.Empty, HandleShowRegion); MainConsole.Instance.Commands.AddCommand("Regions", true, + "show region at", + "show region at ", + "Show details on a region at the given co-ordinate.", + "For example, show region at 1000 1000", + HandleShowRegionAt); + + MainConsole.Instance.Commands.AddCommand("Regions", true, "set region flags", "set region flags ", "Set database flags for region", @@ -504,13 +511,13 @@ namespace OpenSim.Services.GridService private void HandleDeregisterRegion(string module, string[] cmd) { - if (cmd.Length != 3) + if (cmd.Length != 4) { - MainConsole.Instance.Output("Syntax: degregister region "); + MainConsole.Instance.Output("Syntax: degregister region id "); return; } - string rawRegionUuid = cmd[2]; + string rawRegionUuid = cmd[3]; UUID regionUuid; if (!UUID.TryParse(rawRegionUuid, out regionUuid)) @@ -542,34 +549,74 @@ namespace OpenSim.Services.GridService private void HandleShowRegion(string module, string[] cmd) { - if (cmd.Length != 3) + if (cmd.Length != 4) { - MainConsole.Instance.Output("Syntax: show region "); + MainConsole.Instance.Output("Syntax: show region name "); return; } - List regions = m_Database.Get(cmd[2], UUID.Zero); + + string regionName = cmd[3]; + + List regions = m_Database.Get(regionName, UUID.Zero); if (regions == null || regions.Count < 1) { - MainConsole.Instance.Output("Region not found"); + MainConsole.Instance.Output("No region with name {0} found", regionName); return; } - foreach (RegionData r in regions) + OutputRegionsToConsole(regions); + } + + private void HandleShowRegionAt(string module, string[] cmd) + { + if (cmd.Length != 5) { - OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]); + MainConsole.Instance.Output("Syntax: show region at "); + return; + } - ConsoleDisplayList dispList = new ConsoleDisplayList(); - dispList.AddRow("Region Name", r.RegionName); - dispList.AddRow("Region ID", r.RegionID); - dispList.AddRow("Location", string.Format("{0},{1}", r.coordX, r.coordY)); - dispList.AddRow("URI", r.Data["serverURI"]); - dispList.AddRow("Owner ID", r.Data["owner_uuid"]); - dispList.AddRow("Flags", flags); + int x, y; + if (!int.TryParse(cmd[3], out x)) + { + MainConsole.Instance.Output("x-coord must be an integer"); + return; + } - MainConsole.Instance.Output(dispList.ToString()); + if (!int.TryParse(cmd[4], out y)) + { + MainConsole.Instance.Output("y-coord must be an integer"); + return; } - return; + RegionData region = m_Database.Get(x * (int)Constants.RegionSize, y * (int)Constants.RegionSize, UUID.Zero); + if (region == null) + { + MainConsole.Instance.OutputFormat("No region found at {0},{1}", x, y); + return; + } + + OutputRegionToConsole(region); + } + + private void OutputRegionToConsole(RegionData r) + { + OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]); + + ConsoleDisplayList dispList = new ConsoleDisplayList(); + dispList.AddRow("Region Name", r.RegionName); + dispList.AddRow("Region ID", r.RegionID); + dispList.AddRow("Location", string.Format("{0},{1}", r.coordX, r.coordY)); + dispList.AddRow("URI", r.Data["serverURI"]); + dispList.AddRow("Owner ID", r.Data["owner_uuid"]); + dispList.AddRow("Flags", flags); + + MainConsole.Instance.Output(dispList.ToString()); + } + + private void OutputRegionsToConsole(List regions) + { + foreach (RegionData r in regions) + OutputRegionToConsole(r); } private int ParseFlags(int prev, string flags) -- cgit v1.1 From 5292b8b8be85696604f4f8086376da568b8342b5 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 26 Jun 2012 00:34:37 +0100 Subject: Add "show regions" console command to ROBUST to show all regions currently registered. Command is not added in standalone, which has its own version of "show regions" that can also show estate name --- OpenSim/Services/GridService/GridService.cs | 44 +++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 7d2dadb..e4c3246 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -91,6 +91,18 @@ namespace OpenSim.Services.GridService String.Empty, HandleDeregisterRegion); + // A messy way of stopping this command being added if we are in standalone (since the simulator + // has an identically named command + // + // XXX: We're relying on the OpenSimulator version being registered first, which is not well defined. + if (MainConsole.Instance.Commands.Resolve(new string[] { "show", "regions" }).Length == 0) + MainConsole.Instance.Commands.AddCommand("Regions", true, + "show regions", + "show all regions", + "Show details on all regions", + String.Empty, + HandleShowRegions); + MainConsole.Instance.Commands.AddCommand("Regions", true, "show region name", "show region name ", @@ -547,6 +559,20 @@ namespace OpenSim.Services.GridService return; } + private void HandleShowRegions(string module, string[] cmd) + { + if (cmd.Length != 2) + { + MainConsole.Instance.Output("Syntax: show regions"); + return; + } + + List regions = m_Database.Get(int.MinValue, int.MinValue, int.MaxValue, int.MaxValue, UUID.Zero); + + OutputRegionsToConsoleSummary(regions); + } + + private void HandleShowRegion(string module, string[] cmd) { if (cmd.Length != 4) @@ -619,6 +645,24 @@ namespace OpenSim.Services.GridService OutputRegionToConsole(r); } + private void OutputRegionsToConsoleSummary(List regions) + { + ConsoleDisplayTable dispTable = new ConsoleDisplayTable(); + dispTable.Columns.Add(new ConsoleDisplayTableColumn("Name", 16)); + dispTable.Columns.Add(new ConsoleDisplayTableColumn("ID", 36)); + dispTable.Columns.Add(new ConsoleDisplayTableColumn("Owner ID", 36)); + dispTable.Columns.Add(new ConsoleDisplayTableColumn("Flags", 60)); + + foreach (RegionData r in regions) + { + OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]); + dispTable.Rows.Add( + new ConsoleDisplayTableRow(new List { r.RegionName, r.RegionID.ToString(), r.Data["owner_uuid"].ToString(), flags.ToString() })); + } + + MainConsole.Instance.Output(dispTable.ToString()); + } + private int ParseFlags(int prev, string flags) { OpenSim.Data.RegionFlags f = (OpenSim.Data.RegionFlags)prev; -- cgit v1.1 From 1f22b29ca3d172624087185a4e9056a931f19703 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 26 Jun 2012 00:40:46 +0100 Subject: Add much easier ConsoleDisplayTable AddColumn() and AddRow() methods. Use these for new "show regions" command rather than old cumbersome stuff. --- OpenSim/Services/GridService/GridService.cs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index e4c3246..842a697 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -648,16 +648,15 @@ namespace OpenSim.Services.GridService private void OutputRegionsToConsoleSummary(List regions) { ConsoleDisplayTable dispTable = new ConsoleDisplayTable(); - dispTable.Columns.Add(new ConsoleDisplayTableColumn("Name", 16)); - dispTable.Columns.Add(new ConsoleDisplayTableColumn("ID", 36)); - dispTable.Columns.Add(new ConsoleDisplayTableColumn("Owner ID", 36)); - dispTable.Columns.Add(new ConsoleDisplayTableColumn("Flags", 60)); + dispTable.AddColumn("Name", 16); + dispTable.AddColumn("ID", 36); + dispTable.AddColumn("Owner ID", 36); + dispTable.AddColumn("Flags", 60); foreach (RegionData r in regions) { OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]); - dispTable.Rows.Add( - new ConsoleDisplayTableRow(new List { r.RegionName, r.RegionID.ToString(), r.Data["owner_uuid"].ToString(), flags.ToString() })); + dispTable.AddRow(r.RegionName, r.RegionID.ToString(), r.Data["owner_uuid"].ToString(), flags.ToString()); } MainConsole.Instance.Output(dispTable.ToString()); -- cgit v1.1 From 25245179868990b07d4431e2dc2e800a4de372e5 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 26 Jun 2012 22:54:41 +0100 Subject: minor: correct GridService "show regions" cibsike cinnabd usage statement --- OpenSim/Services/GridService/GridService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 842a697..36cd573 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -98,7 +98,7 @@ namespace OpenSim.Services.GridService if (MainConsole.Instance.Commands.Resolve(new string[] { "show", "regions" }).Length == 0) MainConsole.Instance.Commands.AddCommand("Regions", true, "show regions", - "show all regions", + "show regions", "Show details on all regions", String.Empty, HandleShowRegions); -- cgit v1.1 From 97437feb06060fa58f8209e32c362bfe91c279f5 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 26 Jun 2012 23:05:10 +0100 Subject: Show region positions in "show regions" robust console command --- OpenSim/Services/GridService/GridService.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 36cd573..aab403a 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -650,13 +650,19 @@ namespace OpenSim.Services.GridService ConsoleDisplayTable dispTable = new ConsoleDisplayTable(); dispTable.AddColumn("Name", 16); dispTable.AddColumn("ID", 36); + dispTable.AddColumn("Position", 11); dispTable.AddColumn("Owner ID", 36); dispTable.AddColumn("Flags", 60); foreach (RegionData r in regions) { OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]); - dispTable.AddRow(r.RegionName, r.RegionID.ToString(), r.Data["owner_uuid"].ToString(), flags.ToString()); + dispTable.AddRow( + r.RegionName, + r.RegionID.ToString(), + string.Format("{0},{1}", r.coordX, r.coordY), + r.Data["owner_uuid"].ToString(), + flags.ToString()); } MainConsole.Instance.Output(dispTable.ToString()); -- cgit v1.1 From 6ea95a329451c803048f179abb4b4ea5014dd7b1 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 25 Aug 2012 17:32:00 +0100 Subject: Fix and refactor region registration. Reorder checks to short-curcuit expensive and destructive ones. Properly fix region reservation and authentication. Make region moves and flags preservation work again as intended. Prevent failes reservation take-over from damging reservation data. --- OpenSim/Services/GridService/GridService.cs | 53 +++++++++++++++-------------- 1 file changed, 28 insertions(+), 25 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index aab403a..5bdea06 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -137,9 +137,14 @@ namespace OpenSim.Services.GridService if (regionInfos.RegionID == UUID.Zero) return "Invalid RegionID - cannot be zero UUID"; - // This needs better sanity testing. What if regionInfo is registering in - // overlapping coords? RegionData region = m_Database.Get(regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID); + if ((region != null) && (region.RegionID != regionInfos.RegionID)) + { + m_log.WarnFormat("[GRID SERVICE]: Region {0} tried to register in coordinates {1}, {2} which are already in use in scope {3}.", + regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID); + return "Region overlaps another region"; + } + if (region != null) { // There is a preexisting record @@ -176,19 +181,36 @@ namespace OpenSim.Services.GridService } } - if ((region != null) && (region.RegionID != regionInfos.RegionID)) + // If we get here, the destination is clear. Now for the real check. + + if (!m_AllowDuplicateNames) { - m_log.WarnFormat("[GRID SERVICE]: Region {0} tried to register in coordinates {1}, {2} which are already in use in scope {3}.", - regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID); - return "Region overlaps another region"; + List dupe = m_Database.Get(regionInfos.RegionName, scopeID); + if (dupe != null && dupe.Count > 0) + { + foreach (RegionData d in dupe) + { + if (d.RegionID != regionInfos.RegionID) + { + m_log.WarnFormat("[GRID SERVICE]: Region {0} tried to register duplicate name with ID {1}.", + regionInfos.RegionName, regionInfos.RegionID); + return "Duplicate region name"; + } + } + } } + // If there is an old record for us, delete it if it is elsewhere. + region = m_Database.Get(regionInfos.RegionID, scopeID); if ((region != null) && (region.RegionID == regionInfos.RegionID) && ((region.posX != regionInfos.RegionLocX) || (region.posY != regionInfos.RegionLocY))) { if ((Convert.ToInt32(region.Data["flags"]) & (int)OpenSim.Data.RegionFlags.NoMove) != 0) return "Can't move this region"; + if ((Convert.ToInt32(region.Data["flags"]) & (int)OpenSim.Data.RegionFlags.LockedOut) != 0) + return "Region locked out"; + // Region reregistering in other coordinates. Delete the old entry m_log.DebugFormat("[GRID SERVICE]: Region {0} ({1}) was previously registered at {2}-{3}. Deleting old entry.", regionInfos.RegionName, regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY); @@ -203,23 +225,6 @@ namespace OpenSim.Services.GridService } } - if (!m_AllowDuplicateNames) - { - List dupe = m_Database.Get(regionInfos.RegionName, scopeID); - if (dupe != null && dupe.Count > 0) - { - foreach (RegionData d in dupe) - { - if (d.RegionID != regionInfos.RegionID) - { - m_log.WarnFormat("[GRID SERVICE]: Region {0} tried to register duplicate name with ID {1}.", - regionInfos.RegionName, regionInfos.RegionID); - return "Duplicate region name"; - } - } - } - } - // Everything is ok, let's register RegionData rdata = RegionInfo2RegionData(regionInfos); rdata.ScopeID = scopeID; @@ -227,8 +232,6 @@ namespace OpenSim.Services.GridService if (region != null) { int oldFlags = Convert.ToInt32(region.Data["flags"]); - if ((oldFlags & (int)OpenSim.Data.RegionFlags.LockedOut) != 0) - return "Region locked out"; oldFlags &= ~(int)OpenSim.Data.RegionFlags.Reservation; -- cgit v1.1 From 73c9abf5f2e2017bf924d6183502e337d28a7232 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 9 Oct 2012 01:35:27 +0100 Subject: Move OpenSim.Data.RegionFlags -> OpenSim.Framework.RegionFlags to make it easier for other code to use (e.g. LSL_Api) without having to reference OpenSim.Data just for this. --- OpenSim/Services/GridService/GridService.cs | 48 ++++++++++++------------- OpenSim/Services/GridService/HypergridLinker.cs | 6 ++-- 2 files changed, 27 insertions(+), 27 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 5bdea06..ee3b858 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -151,11 +151,11 @@ namespace OpenSim.Services.GridService // // Get it's flags // - OpenSim.Data.RegionFlags rflags = (OpenSim.Data.RegionFlags)Convert.ToInt32(region.Data["flags"]); + OpenSim.Framework.RegionFlags rflags = (OpenSim.Framework.RegionFlags)Convert.ToInt32(region.Data["flags"]); // Is this a reservation? // - if ((rflags & OpenSim.Data.RegionFlags.Reservation) != 0) + if ((rflags & OpenSim.Framework.RegionFlags.Reservation) != 0) { // Regions reserved for the null key cannot be taken. if ((string)region.Data["PrincipalID"] == UUID.Zero.ToString()) @@ -166,10 +166,10 @@ namespace OpenSim.Services.GridService // NOTE: Fudging the flags value here, so these flags // should not be used elsewhere. Don't optimize // this with the later retrieval of the same flags! - rflags |= OpenSim.Data.RegionFlags.Authenticate; + rflags |= OpenSim.Framework.RegionFlags.Authenticate; } - if ((rflags & OpenSim.Data.RegionFlags.Authenticate) != 0) + if ((rflags & OpenSim.Framework.RegionFlags.Authenticate) != 0) { // Can we authenticate at all? // @@ -205,10 +205,10 @@ namespace OpenSim.Services.GridService if ((region != null) && (region.RegionID == regionInfos.RegionID) && ((region.posX != regionInfos.RegionLocX) || (region.posY != regionInfos.RegionLocY))) { - if ((Convert.ToInt32(region.Data["flags"]) & (int)OpenSim.Data.RegionFlags.NoMove) != 0) + if ((Convert.ToInt32(region.Data["flags"]) & (int)OpenSim.Framework.RegionFlags.NoMove) != 0) return "Can't move this region"; - if ((Convert.ToInt32(region.Data["flags"]) & (int)OpenSim.Data.RegionFlags.LockedOut) != 0) + if ((Convert.ToInt32(region.Data["flags"]) & (int)OpenSim.Framework.RegionFlags.LockedOut) != 0) return "Region locked out"; // Region reregistering in other coordinates. Delete the old entry @@ -233,7 +233,7 @@ namespace OpenSim.Services.GridService { int oldFlags = Convert.ToInt32(region.Data["flags"]); - oldFlags &= ~(int)OpenSim.Data.RegionFlags.Reservation; + oldFlags &= ~(int)OpenSim.Framework.RegionFlags.Reservation; rdata.Data["flags"] = oldFlags.ToString(); // Preserve flags } @@ -252,7 +252,7 @@ namespace OpenSim.Services.GridService } int flags = Convert.ToInt32(rdata.Data["flags"]); - flags |= (int)OpenSim.Data.RegionFlags.RegionOnline; + flags |= (int)OpenSim.Framework.RegionFlags.RegionOnline; rdata.Data["flags"] = flags.ToString(); try @@ -283,9 +283,9 @@ namespace OpenSim.Services.GridService int flags = Convert.ToInt32(region.Data["flags"]); - if (!m_DeleteOnUnregister || (flags & (int)OpenSim.Data.RegionFlags.Persistent) != 0) + if (!m_DeleteOnUnregister || (flags & (int)OpenSim.Framework.RegionFlags.Persistent) != 0) { - flags &= ~(int)OpenSim.Data.RegionFlags.RegionOnline; + flags &= ~(int)OpenSim.Framework.RegionFlags.RegionOnline; region.Data["flags"] = flags.ToString(); region.Data["last_seen"] = Util.UnixTimeSinceEpoch(); try @@ -320,7 +320,7 @@ namespace OpenSim.Services.GridService if (rdata.RegionID != regionID) { int flags = Convert.ToInt32(rdata.Data["flags"]); - if ((flags & (int)Data.RegionFlags.Hyperlink) == 0) // no hyperlinks as neighbours + if ((flags & (int)Framework.RegionFlags.Hyperlink) == 0) // no hyperlinks as neighbours rinfos.Add(RegionData2RegionInfo(rdata)); } } @@ -470,7 +470,7 @@ namespace OpenSim.Services.GridService foreach (RegionData r in regions) { - if ((Convert.ToInt32(r.Data["flags"]) & (int)OpenSim.Data.RegionFlags.RegionOnline) != 0) + if ((Convert.ToInt32(r.Data["flags"]) & (int)OpenSim.Framework.RegionFlags.RegionOnline) != 0) ret.Add(RegionData2RegionInfo(r)); } @@ -486,7 +486,7 @@ namespace OpenSim.Services.GridService foreach (RegionData r in regions) { - if ((Convert.ToInt32(r.Data["flags"]) & (int)OpenSim.Data.RegionFlags.RegionOnline) != 0) + if ((Convert.ToInt32(r.Data["flags"]) & (int)OpenSim.Framework.RegionFlags.RegionOnline) != 0) ret.Add(RegionData2RegionInfo(r)); } @@ -502,7 +502,7 @@ namespace OpenSim.Services.GridService foreach (RegionData r in regions) { - if ((Convert.ToInt32(r.Data["flags"]) & (int)OpenSim.Data.RegionFlags.RegionOnline) != 0) + if ((Convert.ToInt32(r.Data["flags"]) & (int)OpenSim.Framework.RegionFlags.RegionOnline) != 0) ret.Add(RegionData2RegionInfo(r)); } @@ -629,7 +629,7 @@ namespace OpenSim.Services.GridService private void OutputRegionToConsole(RegionData r) { - OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]); + OpenSim.Framework.RegionFlags flags = (OpenSim.Framework.RegionFlags)Convert.ToInt32(r.Data["flags"]); ConsoleDisplayList dispList = new ConsoleDisplayList(); dispList.AddRow("Region Name", r.RegionName); @@ -659,7 +659,7 @@ namespace OpenSim.Services.GridService foreach (RegionData r in regions) { - OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]); + OpenSim.Framework.RegionFlags flags = (OpenSim.Framework.RegionFlags)Convert.ToInt32(r.Data["flags"]); dispTable.AddRow( r.RegionName, r.RegionID.ToString(), @@ -673,7 +673,7 @@ namespace OpenSim.Services.GridService private int ParseFlags(int prev, string flags) { - OpenSim.Data.RegionFlags f = (OpenSim.Data.RegionFlags)prev; + OpenSim.Framework.RegionFlags f = (OpenSim.Framework.RegionFlags)prev; string[] parts = flags.Split(new char[] {',', ' '}, StringSplitOptions.RemoveEmptyEntries); @@ -685,18 +685,18 @@ namespace OpenSim.Services.GridService { if (p.StartsWith("+")) { - val = (int)Enum.Parse(typeof(OpenSim.Data.RegionFlags), p.Substring(1)); - f |= (OpenSim.Data.RegionFlags)val; + val = (int)Enum.Parse(typeof(OpenSim.Framework.RegionFlags), p.Substring(1)); + f |= (OpenSim.Framework.RegionFlags)val; } else if (p.StartsWith("-")) { - val = (int)Enum.Parse(typeof(OpenSim.Data.RegionFlags), p.Substring(1)); - f &= ~(OpenSim.Data.RegionFlags)val; + val = (int)Enum.Parse(typeof(OpenSim.Framework.RegionFlags), p.Substring(1)); + f &= ~(OpenSim.Framework.RegionFlags)val; } else { - val = (int)Enum.Parse(typeof(OpenSim.Data.RegionFlags), p); - f |= (OpenSim.Data.RegionFlags)val; + val = (int)Enum.Parse(typeof(OpenSim.Framework.RegionFlags), p); + f |= (OpenSim.Framework.RegionFlags)val; } } catch (Exception) @@ -728,7 +728,7 @@ namespace OpenSim.Services.GridService int flags = Convert.ToInt32(r.Data["flags"]); flags = ParseFlags(flags, cmd[4]); r.Data["flags"] = flags.ToString(); - OpenSim.Data.RegionFlags f = (OpenSim.Data.RegionFlags)flags; + OpenSim.Framework.RegionFlags f = (OpenSim.Framework.RegionFlags)flags; MainConsole.Instance.Output(String.Format("Set region {0} to {1}", r.RegionName, f)); m_Database.Store(r); diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 78eab3d..743d089 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -390,8 +390,8 @@ namespace OpenSim.Services.GridService List regions = m_Database.Get(mapName, m_ScopeID); if (regions != null && regions.Count > 0) { - OpenSim.Data.RegionFlags rflags = (OpenSim.Data.RegionFlags)Convert.ToInt32(regions[0].Data["flags"]); - if ((rflags & OpenSim.Data.RegionFlags.Hyperlink) != 0) + OpenSim.Framework.RegionFlags rflags = (OpenSim.Framework.RegionFlags)Convert.ToInt32(regions[0].Data["flags"]); + if ((rflags & OpenSim.Framework.RegionFlags.Hyperlink) != 0) { regInfo = new GridRegion(); regInfo.RegionID = regions[0].RegionID; @@ -460,7 +460,7 @@ namespace OpenSim.Services.GridService private void AddHyperlinkRegion(GridRegion regionInfo, ulong regionHandle) { RegionData rdata = m_GridService.RegionInfo2RegionData(regionInfo); - int flags = (int)OpenSim.Data.RegionFlags.Hyperlink + (int)OpenSim.Data.RegionFlags.NoDirectLogin + (int)OpenSim.Data.RegionFlags.RegionOnline; + int flags = (int)OpenSim.Framework.RegionFlags.Hyperlink + (int)OpenSim.Framework.RegionFlags.NoDirectLogin + (int)OpenSim.Framework.RegionFlags.RegionOnline; rdata.Data["flags"] = flags.ToString(); m_Database.Store(rdata); -- cgit v1.1 From df62d113abf5d9264caca7f2e554d061c260e522 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 14 Nov 2012 21:18:18 -0800 Subject: The last few AssemblyInfos. Finished! --- .../GridService/Properties/AssemblyInfo.cs | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 OpenSim/Services/GridService/Properties/AssemblyInfo.cs (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/Properties/AssemblyInfo.cs b/OpenSim/Services/GridService/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..5c0c8f4 --- /dev/null +++ b/OpenSim/Services/GridService/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("OpenSim.Services.GridService")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("http://opensimulator.org")] +[assembly: AssemblyProduct("OpenSim")] +[assembly: AssemblyCopyright("OpenSimulator developers")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("96526d7b-4943-4b8e-9f0f-5908af621090")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +[assembly: AssemblyVersion("0.7.5.*")] +[assembly: AssemblyFileVersion("1.0.0.0")] -- cgit v1.1 From 1b826b487739220503458ccc6b07ec40c54e1164 Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Sun, 16 Dec 2012 09:48:37 +0200 Subject: Allow registering regions whose names are equivalent under LIKE but not truly equal --- OpenSim/Services/GridService/GridService.cs | 14 +++++++------- OpenSim/Services/GridService/HypergridLinker.cs | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index ee3b858..daebf8b 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -185,15 +185,15 @@ namespace OpenSim.Services.GridService if (!m_AllowDuplicateNames) { - List dupe = m_Database.Get(regionInfos.RegionName, scopeID); + List dupe = m_Database.Get(Util.EscapeForLike(regionInfos.RegionName), scopeID); if (dupe != null && dupe.Count > 0) { foreach (RegionData d in dupe) { if (d.RegionID != regionInfos.RegionID) { - m_log.WarnFormat("[GRID SERVICE]: Region {0} tried to register duplicate name with ID {1}.", - regionInfos.RegionName, regionInfos.RegionID); + m_log.WarnFormat("[GRID SERVICE]: Region tried to register using a duplicate name. New region: {0} ({1}), existing region: {2} ({3}).", + regionInfos.RegionName, regionInfos.RegionID, d.RegionName, d.RegionID); return "Duplicate region name"; } } @@ -359,7 +359,7 @@ namespace OpenSim.Services.GridService public GridRegion GetRegionByName(UUID scopeID, string name) { - List rdatas = m_Database.Get(name, scopeID); + List rdatas = m_Database.Get(Util.EscapeForLike(name), scopeID); if ((rdatas != null) && (rdatas.Count > 0)) return RegionData2RegionInfo(rdatas[0]); // get the first @@ -377,7 +377,7 @@ namespace OpenSim.Services.GridService { // m_log.DebugFormat("[GRID SERVICE]: GetRegionsByName {0}", name); - List rdatas = m_Database.Get(name + "%", scopeID); + List rdatas = m_Database.Get(Util.EscapeForLike(name) + "%", scopeID); int count = 0; List rinfos = new List(); @@ -586,7 +586,7 @@ namespace OpenSim.Services.GridService string regionName = cmd[3]; - List regions = m_Database.Get(regionName, UUID.Zero); + List regions = m_Database.Get(Util.EscapeForLike(regionName), UUID.Zero); if (regions == null || regions.Count < 1) { MainConsole.Instance.Output("No region with name {0} found", regionName); @@ -716,7 +716,7 @@ namespace OpenSim.Services.GridService return; } - List regions = m_Database.Get(cmd[3], UUID.Zero); + List regions = m_Database.Get(Util.EscapeForLike(cmd[3]), UUID.Zero); if (regions == null || regions.Count < 1) { MainConsole.Instance.Output("Region not found"); diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 743d089..073197f 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -387,7 +387,7 @@ namespace OpenSim.Services.GridService m_log.DebugFormat("[HYPERGRID LINKER]: Request to unlink {0}", mapName); GridRegion regInfo = null; - List regions = m_Database.Get(mapName, m_ScopeID); + List regions = m_Database.Get(Util.EscapeForLike(mapName), m_ScopeID); if (regions != null && regions.Count > 0) { OpenSim.Framework.RegionFlags rflags = (OpenSim.Framework.RegionFlags)Convert.ToInt32(regions[0].Data["flags"]); -- cgit v1.1 From 1f1da230976451d30d920c237d53c699ba96b9d9 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 5 Feb 2013 00:23:17 +0000 Subject: Bump version and assembly version numbers from 0.7.5 to 0.7.6 This is mostly Bluewall's work but I am also bumping the general version number OpenSimulator 0.7.5 remains in the release candidate stage. I'm doing this because master is significantly adding things that will not be in 0.7.5 This update should not cause issues with existing external binary DLLs because our DLLs do not have strong names and so the exact version match requirement is not in force. --- OpenSim/Services/GridService/Properties/AssemblyInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/Properties/AssemblyInfo.cs b/OpenSim/Services/GridService/Properties/AssemblyInfo.cs index 5c0c8f4..09084d3 100644 --- a/OpenSim/Services/GridService/Properties/AssemblyInfo.cs +++ b/OpenSim/Services/GridService/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("0.7.5.*")] +[assembly: AssemblyVersion("0.7.6.*")] [assembly: AssemblyFileVersion("1.0.0.0")] -- cgit v1.1 From 4779f7d7d5ce0e284d9ed15104389f8479b11545 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 19 Feb 2013 17:14:55 -0800 Subject: Deleted all AssemblyFileVersion directives --- OpenSim/Services/GridService/Properties/AssemblyInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/Properties/AssemblyInfo.cs b/OpenSim/Services/GridService/Properties/AssemblyInfo.cs index 09084d3..b1e5e12 100644 --- a/OpenSim/Services/GridService/Properties/AssemblyInfo.cs +++ b/OpenSim/Services/GridService/Properties/AssemblyInfo.cs @@ -30,4 +30,4 @@ using System.Runtime.InteropServices; // Revision // [assembly: AssemblyVersion("0.7.6.*")] -[assembly: AssemblyFileVersion("1.0.0.0")] + -- cgit v1.1 From e515cdddec435e97e9ed4722de08ee410e94a7e6 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 21 Feb 2013 17:26:19 -0800 Subject: Simplification of HG configs: HomeURI and GatekeeperURI now are defined as default under [Startup]. They can then be overwritten in the other sections (but probably shouldn't). I kept the existing code for backwards compatibility, so this should not cause any breaks from people's current configurations. But people should move to have these 2 vars under [Startup] -- see OpenSim.ini.example and Robust.HG.ini.example. And yes, both names now end with "URI" for consistency. --- OpenSim/Services/GridService/HypergridLinker.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 073197f..3e7c556 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -128,7 +128,9 @@ namespace OpenSim.Services.GridService m_MapTileDirectory = gridConfig.GetString("MapTileDirectory", "maptiles"); - m_ThisGatekeeper = gridConfig.GetString("Gatekeeper", string.Empty); + m_ThisGatekeeper = Util.GetConfigVarWithDefaultSection(config, "GatekeeperURI", "GridService"); + // Legacy. Remove soon! + m_ThisGatekeeper = gridConfig.GetString("Gatekeeper", m_ThisGatekeeper); try { m_ThisGatekeeperURI = new Uri(m_ThisGatekeeper); -- cgit v1.1 From 0e8289cd002b1947e172d1bfc77fdd0b16d92ffb Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 22 Feb 2013 15:57:33 -0800 Subject: Added new Util function for reading config vars that's more generic than the one I added yesterday -- this is for helping move config vars out of [Startup] --- OpenSim/Services/GridService/HypergridLinker.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 3e7c556..80575ee 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -128,7 +128,7 @@ namespace OpenSim.Services.GridService m_MapTileDirectory = gridConfig.GetString("MapTileDirectory", "maptiles"); - m_ThisGatekeeper = Util.GetConfigVarWithDefaultSection(config, "GatekeeperURI", "GridService"); + m_ThisGatekeeper = Util.GetConfigVarFromSections(config, "GatekeeperURI", new string[] {"Startup", "GridService"}); // Legacy. Remove soon! m_ThisGatekeeper = gridConfig.GetString("Gatekeeper", m_ThisGatekeeper); try -- cgit v1.1 From f1010d7b152b68e2961b40482006221e28e976af Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 27 Feb 2013 20:49:41 -0800 Subject: Moved the HG default variables out of [Startup] and into their own section [Hypergrid] in *Common.ini.example. Backwards compatible for now. --- OpenSim/Services/GridService/HypergridLinker.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 80575ee..885c2aa 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -128,7 +128,7 @@ namespace OpenSim.Services.GridService m_MapTileDirectory = gridConfig.GetString("MapTileDirectory", "maptiles"); - m_ThisGatekeeper = Util.GetConfigVarFromSections(config, "GatekeeperURI", new string[] {"Startup", "GridService"}); + m_ThisGatekeeper = Util.GetConfigVarFromSections(config, "GatekeeperURI", new string[] { "Startup", "Hypergrid", "GridService" }); // Legacy. Remove soon! m_ThisGatekeeper = gridConfig.GetString("Gatekeeper", m_ThisGatekeeper); try -- cgit v1.1 From bb447581795cb622e88a071d3050370c64ace946 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 27 Feb 2013 20:59:16 -0800 Subject: Switched to using the other Util function with a default value. --- OpenSim/Services/GridService/HypergridLinker.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 885c2aa..8335724 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -128,7 +128,8 @@ namespace OpenSim.Services.GridService m_MapTileDirectory = gridConfig.GetString("MapTileDirectory", "maptiles"); - m_ThisGatekeeper = Util.GetConfigVarFromSections(config, "GatekeeperURI", new string[] { "Startup", "Hypergrid", "GridService" }); + m_ThisGatekeeper = Util.GetConfigVarFromSections(config, "GatekeeperURI", + new string[] { "Startup", "Hypergrid", "GridService" }, String.Empty); // Legacy. Remove soon! m_ThisGatekeeper = gridConfig.GetString("Gatekeeper", m_ThisGatekeeper); try -- cgit v1.1 From 2be786709badc9913f348932e75d3481d445caf8 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 23 Aug 2013 01:03:27 +0100 Subject: Make it possible for the "deregister region id" command to accept more than one id --- OpenSim/Services/GridService/GridService.cs | 51 +++++++++++++++-------------- 1 file changed, 27 insertions(+), 24 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index daebf8b..59b150b 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -86,7 +86,7 @@ namespace OpenSim.Services.GridService { MainConsole.Instance.Commands.AddCommand("Regions", true, "deregister region id", - "deregister region id ", + "deregister region id +", "Deregister a region manually.", String.Empty, HandleDeregisterRegion); @@ -526,37 +526,40 @@ namespace OpenSim.Services.GridService private void HandleDeregisterRegion(string module, string[] cmd) { - if (cmd.Length != 4) + if (cmd.Length < 4) { - MainConsole.Instance.Output("Syntax: degregister region id "); + MainConsole.Instance.Output("Usage: degregister region id +"); return; } - string rawRegionUuid = cmd[3]; - UUID regionUuid; - - if (!UUID.TryParse(rawRegionUuid, out regionUuid)) + for (int i = 3; i < cmd.Length; i++) { - MainConsole.Instance.OutputFormat("{0} is not a valid region uuid", rawRegionUuid); - return; - } + string rawRegionUuid = cmd[i]; + UUID regionUuid; - GridRegion region = GetRegionByUUID(UUID.Zero, regionUuid); + if (!UUID.TryParse(rawRegionUuid, out regionUuid)) + { + MainConsole.Instance.OutputFormat("{0} is not a valid region uuid", rawRegionUuid); + return; + } - if (region == null) - { - MainConsole.Instance.OutputFormat("No region with UUID {0}", regionUuid); - return; - } + GridRegion region = GetRegionByUUID(UUID.Zero, regionUuid); - if (DeregisterRegion(regionUuid)) - { - MainConsole.Instance.OutputFormat("Deregistered {0} {1}", region.RegionName, regionUuid); - } - else - { - // I don't think this can ever occur if we know that the region exists. - MainConsole.Instance.OutputFormat("Error deregistering {0} {1}", region.RegionName, regionUuid); + if (region == null) + { + MainConsole.Instance.OutputFormat("No region with UUID {0}", regionUuid); + return; + } + + if (DeregisterRegion(regionUuid)) + { + MainConsole.Instance.OutputFormat("Deregistered {0} {1}", region.RegionName, regionUuid); + } + else + { + // I don't think this can ever occur if we know that the region exists. + MainConsole.Instance.OutputFormat("Error deregistering {0} {1}", region.RegionName, regionUuid); + } } return; -- cgit v1.1 From 04f4dd3dc7da5657ce3f792ef6d5f9191a7281f7 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 23 Aug 2013 01:04:03 +0100 Subject: remove redundant return at end of HandleDeregisterRegion() --- OpenSim/Services/GridService/GridService.cs | 2 -- 1 file changed, 2 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 59b150b..a1485c8 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -561,8 +561,6 @@ namespace OpenSim.Services.GridService MainConsole.Instance.OutputFormat("Error deregistering {0} {1}", region.RegionName, regionUuid); } } - - return; } private void HandleShowRegions(string module, string[] cmd) -- cgit v1.1 From 4cbadc3c4984b8bebc7098a720846309f645ad7b Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 2 Sep 2013 17:27:45 +0100 Subject: Allow one to specify a DefaultHGRegion flag in [GridService] in order to allow different default regions for HG and direct grid logins. This requires a new GridService.GetDefaultHypergridRegions() so ROBUST services require updating but not simulators. This method still returns regions flagged with just DefaultRegion after any DefaultHGRegions, so if no DefaultHGRegions are specified then existing configured defaults will still work. Immediate use is for conference where we need to be able to specify different defaults However, this is also generally useful to send experienced HG users to one default location and local users whose specified region fails (e.g. no "home" or "last") to another. --- OpenSim/Services/GridService/GridService.cs | 32 +++++++++++++++++++++++-- OpenSim/Services/GridService/HypergridLinker.cs | 2 +- 2 files changed, 31 insertions(+), 3 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index a1485c8..e72b7f9 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -265,8 +265,9 @@ namespace OpenSim.Services.GridService m_log.DebugFormat("[GRID SERVICE]: Database exception: {0}", e); } - m_log.DebugFormat("[GRID SERVICE]: Region {0} ({1}) registered successfully at {2}-{3}", - regionInfos.RegionName, regionInfos.RegionID, regionInfos.RegionCoordX, regionInfos.RegionCoordY); + m_log.DebugFormat("[GRID SERVICE]: Region {0} ({1}) registered successfully at {2}-{3} with flags {4}", + regionInfos.RegionName, regionInfos.RegionID, regionInfos.RegionCoordX, regionInfos.RegionCoordY, + (OpenSim.Framework.RegionFlags)flags); return String.Empty; } @@ -478,6 +479,33 @@ namespace OpenSim.Services.GridService return ret; } + public List GetDefaultHypergridRegions(UUID scopeID) + { + List ret = new List(); + + List regions = m_Database.GetDefaultHypergridRegions(scopeID); + + foreach (RegionData r in regions) + { + if ((Convert.ToInt32(r.Data["flags"]) & (int)OpenSim.Framework.RegionFlags.RegionOnline) != 0) + ret.Add(RegionData2RegionInfo(r)); + } + + int hgDefaultRegionsFoundOnline = regions.Count; + + // For now, hypergrid default regions will always be given precedence but we will also return simple default + // regions in case no specific hypergrid regions are specified. + ret.AddRange(GetDefaultRegions(scopeID)); + + int normalDefaultRegionsFoundOnline = ret.Count - hgDefaultRegionsFoundOnline; + + m_log.DebugFormat( + "[GRID SERVICE]: GetDefaultHypergridRegions returning {0} hypergrid default and {1} normal default regions", + hgDefaultRegionsFoundOnline, normalDefaultRegionsFoundOnline); + + return ret; + } + public List GetFallbackRegions(UUID scopeID, int x, int y) { List ret = new List(); diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 8335724..4024295 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -79,7 +79,7 @@ namespace OpenSim.Services.GridService { if (m_DefaultRegion == null) { - List defs = m_GridService.GetDefaultRegions(m_ScopeID); + List defs = m_GridService.GetDefaultHypergridRegions(m_ScopeID); if (defs != null && defs.Count > 0) m_DefaultRegion = defs[0]; else -- cgit v1.1 From 42bdf446585007029faf4cd21abd289487f0f797 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 4 Oct 2013 23:33:47 +0100 Subject: Bump OPenSimulator version and assembly versions up to 0.8.0 Dev --- OpenSim/Services/GridService/Properties/AssemblyInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/Properties/AssemblyInfo.cs b/OpenSim/Services/GridService/Properties/AssemblyInfo.cs index b1e5e12..bd84123 100644 --- a/OpenSim/Services/GridService/Properties/AssemblyInfo.cs +++ b/OpenSim/Services/GridService/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("0.7.6.*")] +[assembly: AssemblyVersion("0.8.0.*")] -- cgit v1.1 From 6df7d4219d7a82b0323d9fe294473860c0aef0dd Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sat, 2 Nov 2013 15:40:48 -0700 Subject: varregion: add linkage for region size in creations and conversions of GridRegion. New variables for size and code to initialize same. --- OpenSim/Services/GridService/GridService.cs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index e72b7f9..9fa2dc5 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -441,6 +441,8 @@ namespace OpenSim.Services.GridService RegionData rdata = new RegionData(); rdata.posX = (int)rinfo.RegionLocX; rdata.posY = (int)rinfo.RegionLocY; + rdata.sizeX = rinfo.RegionSizeX; + rdata.sizeY = rinfo.RegionSizeY; rdata.RegionID = rinfo.RegionID; rdata.RegionName = rinfo.RegionName; rdata.Data = rinfo.ToKeyValuePairs(); @@ -454,6 +456,8 @@ namespace OpenSim.Services.GridService GridRegion rinfo = new GridRegion(rdata.Data); rinfo.RegionLocX = rdata.posX; rinfo.RegionLocY = rdata.posY; + rinfo.RegionSizeX = rdata.sizeX; + rinfo.RegionSizeY = rdata.sizeY; rinfo.RegionID = rdata.RegionID; rinfo.RegionName = rdata.RegionName; rinfo.ScopeID = rdata.ScopeID; -- cgit v1.1 From 7aa00632b90f9c24ff6b0fa0da385744a6573c32 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Thu, 28 Nov 2013 08:20:16 -0800 Subject: varregion: many replacements of in-place arithmetic with calls to the Util functions for converting world addresses to region addresses and converting region handles to locations. --- OpenSim/Services/GridService/GridService.cs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 9fa2dc5..aa7ffc1 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -347,6 +347,11 @@ namespace OpenSim.Services.GridService return null; } + // Get a region given its base coordinates. + // NOTE: this is NOT 'get a region by some point in the region'. The coordinate MUST + // be the base coordinate of the region. + // The snapping is technically unnecessary but is harmless because regions are always + // multiples of the legacy region size (256). public GridRegion GetRegionByPosition(UUID scopeID, int x, int y) { int snapX = (int)(x / Constants.RegionSize) * (int)Constants.RegionSize; -- cgit v1.1 From 2d2bea4aa75ff6e82384f0842fe3719bf946b1cc Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Thu, 26 Dec 2013 22:45:59 -0800 Subject: varregion: many more updates removing the constant RegionSize and replacing with a passed region size. This time in the map code and grid services code. --- OpenSim/Services/GridService/GridService.cs | 14 +++--- OpenSim/Services/GridService/HypergridLinker.cs | 61 ++++++++++++++----------- 2 files changed, 42 insertions(+), 33 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index aa7ffc1..8198592 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -313,8 +313,10 @@ namespace OpenSim.Services.GridService if (region != null) { // Not really? Maybe? - List rdatas = m_Database.Get(region.posX - (int)Constants.RegionSize - 1, region.posY - (int)Constants.RegionSize - 1, - region.posX + (int)Constants.RegionSize + 1, region.posY + (int)Constants.RegionSize + 1, scopeID); + // The adjacent regions are presumed to be the same size as the current region + List rdatas = m_Database.Get( + region.posX - region.sizeX - 1, region.posY - region.sizeY - 1, + region.posX + region.sizeX + 1, region.posY + region.sizeY + 1, scopeID); foreach (RegionData rdata in rdatas) { @@ -642,20 +644,20 @@ namespace OpenSim.Services.GridService return; } - int x, y; - if (!int.TryParse(cmd[3], out x)) + uint x, y; + if (!uint.TryParse(cmd[3], out x)) { MainConsole.Instance.Output("x-coord must be an integer"); return; } - if (!int.TryParse(cmd[4], out y)) + if (!uint.TryParse(cmd[4], out y)) { MainConsole.Instance.Output("y-coord must be an integer"); return; } - RegionData region = m_Database.Get(x * (int)Constants.RegionSize, y * (int)Constants.RegionSize, UUID.Zero); + RegionData region = m_Database.Get((int)Util.RegionToWorldLoc(x), (int)Util.RegionToWorldLoc(y), UUID.Zero); if (region == null) { MainConsole.Instance.OutputFormat("No region found at {0},{1}", x, y); diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 4024295..4ebfd5c 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -183,8 +183,8 @@ namespace OpenSim.Services.GridService public GridRegion LinkRegion(UUID scopeID, string regionDescriptor) { string reason = string.Empty; - int xloc = random.Next(0, Int16.MaxValue) * (int)Constants.RegionSize; - return TryLinkRegionToCoords(scopeID, regionDescriptor, xloc, 0, out reason); + uint xloc = Util.RegionToWorldLoc((uint)random.Next(0, Int16.MaxValue)); + return TryLinkRegionToCoords(scopeID, regionDescriptor, (int)xloc, 0, out reason); } private static Random random = new Random(); @@ -260,7 +260,7 @@ namespace OpenSim.Services.GridService { m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0} {1}, in {2}-{3}", ((serverURI == null) ? (externalHostName + ":" + externalPort) : serverURI), - remoteRegionName, xloc / Constants.RegionSize, yloc / Constants.RegionSize); + remoteRegionName, Util.WorldToRegionLoc((uint)xloc), Util.WorldToRegionLoc((uint)yloc)); reason = string.Empty; Uri uri = null; @@ -311,7 +311,7 @@ namespace OpenSim.Services.GridService if (region != null) { m_log.WarnFormat("[HYPERGRID LINKER]: Coordinates {0}-{1} are already occupied by region {2} with uuid {3}", - regInfo.RegionLocX / Constants.RegionSize, regInfo.RegionLocY / Constants.RegionSize, + Util.WorldToRegionLoc((uint)regInfo.RegionLocX), Util.WorldToRegionLoc((uint)regInfo.RegionLocY), region.RegionName, region.RegionID); reason = "Coordinates are already in use"; return false; @@ -347,7 +347,7 @@ namespace OpenSim.Services.GridService if (region != null) { m_log.DebugFormat("[HYPERGRID LINKER]: Region already exists in coordinates {0} {1}", - region.RegionLocX / Constants.RegionSize, region.RegionLocY / Constants.RegionSize); + Util.WorldToRegionLoc((uint)regInfo.RegionLocX), Util.WorldToRegionLoc((uint)regInfo.RegionLocY)); regInfo = region; return true; } @@ -424,10 +424,10 @@ namespace OpenSim.Services.GridService // { // uint ux = 0, uy = 0; // Utils.LongToUInts(realHandle, out ux, out uy); -// x = ux / Constants.RegionSize; -// y = uy / Constants.RegionSize; +// x = Util.WorldToRegionLoc(ux); +// y = Util.WorldToRegionLoc(uy); // -// const uint limit = (4096 - 1) * Constants.RegionSize; +// const uint limit = Util.RegionToWorldLoc(4096 - 1); // uint xmin = ux - limit; // uint xmax = ux + limit; // uint ymin = uy - limit; @@ -502,9 +502,14 @@ namespace OpenSim.Services.GridService MainConsole.Instance.Output(new string('-', 72)); foreach (RegionData r in regions) { - MainConsole.Instance.Output(String.Format("{0}\n{2,-32} {1}\n", - r.RegionName, r.RegionID, String.Format("{0},{1} ({2},{3})", r.posX, r.posY, - r.posX / Constants.RegionSize, r.posY / Constants.RegionSize))); + MainConsole.Instance.Output( + String.Format("{0}\n{2,-32} {1}\n", + r.RegionName, r.RegionID, + String.Format("{0},{1} ({2},{3})", r.posX, r.posY, + Util.WorldToRegionLoc((uint)r.posX), Util.WorldToRegionLoc((uint)r.posY) + ) + ) + ); } return; } @@ -529,8 +534,8 @@ namespace OpenSim.Services.GridService int xloc, yloc; string serverURI; string remoteName = null; - xloc = Convert.ToInt32(cmdparams[0]) * (int)Constants.RegionSize; - yloc = Convert.ToInt32(cmdparams[1]) * (int)Constants.RegionSize; + xloc = (int)Util.RegionToWorldLoc((uint)Convert.ToInt32(cmdparams[0])); + yloc = (int)Util.RegionToWorldLoc((uint)Convert.ToInt32(cmdparams[1])); serverURI = cmdparams[2]; if (cmdparams.Length > 3) remoteName = string.Join(" ", cmdparams, 3, cmdparams.Length - 3); @@ -601,13 +606,13 @@ namespace OpenSim.Services.GridService { // old format GridRegion regInfo; - int xloc, yloc; + uint xloc, yloc; uint externalPort; string externalHostName; try { - xloc = Convert.ToInt32(cmdparams[0]); - yloc = Convert.ToInt32(cmdparams[1]); + xloc = Convert.ToUInt32(cmdparams[0]); + yloc = Convert.ToUInt32(cmdparams[1]); externalPort = Convert.ToUInt32(cmdparams[3]); externalHostName = cmdparams[2]; //internalPort = Convert.ToUInt32(cmdparams[4]); @@ -621,10 +626,11 @@ namespace OpenSim.Services.GridService } // Convert cell coordinates given by the user to meters - xloc = xloc * (int)Constants.RegionSize; - yloc = yloc * (int)Constants.RegionSize; + xloc = Util.RegionToWorldLoc(xloc); + yloc = Util.RegionToWorldLoc(yloc); string reason = string.Empty; - if (TryCreateLink(UUID.Zero, xloc, yloc, string.Empty, externalPort, externalHostName, UUID.Zero, out regInfo, out reason)) + if (TryCreateLink(UUID.Zero, (int)xloc, (int)yloc, + string.Empty, externalPort, externalHostName, UUID.Zero, out regInfo, out reason)) { // What is this? The GridRegion instance will be discarded anyway, // which effectively ignores any local name given with the command. @@ -704,13 +710,13 @@ namespace OpenSim.Services.GridService private void ReadLinkFromConfig(IConfig config) { GridRegion regInfo; - int xloc, yloc; + uint xloc, yloc; uint externalPort; string externalHostName; uint realXLoc, realYLoc; - xloc = Convert.ToInt32(config.GetString("xloc", "0")); - yloc = Convert.ToInt32(config.GetString("yloc", "0")); + xloc = Convert.ToUInt32(config.GetString("xloc", "0")); + yloc = Convert.ToUInt32(config.GetString("yloc", "0")); externalPort = Convert.ToUInt32(config.GetString("externalPort", "0")); externalHostName = config.GetString("externalHostName", ""); realXLoc = Convert.ToUInt32(config.GetString("real-xloc", "0")); @@ -718,18 +724,19 @@ namespace OpenSim.Services.GridService if (m_enableAutoMapping) { - xloc = (int)((xloc % 100) + m_autoMappingX); - yloc = (int)((yloc % 100) + m_autoMappingY); + xloc = (xloc % 100) + m_autoMappingX; + yloc = (yloc % 100) + m_autoMappingY; } if (((realXLoc == 0) && (realYLoc == 0)) || (((realXLoc - xloc < 3896) || (xloc - realXLoc < 3896)) && ((realYLoc - yloc < 3896) || (yloc - realYLoc < 3896)))) { - xloc = xloc * (int)Constants.RegionSize; - yloc = yloc * (int)Constants.RegionSize; + xloc = Util.RegionToWorldLoc(xloc); + yloc = Util.RegionToWorldLoc(yloc); string reason = string.Empty; - if (TryCreateLink(UUID.Zero, xloc, yloc, string.Empty, externalPort, externalHostName, UUID.Zero, out regInfo, out reason)) + if (TryCreateLink(UUID.Zero, (int)xloc, (int)yloc, + string.Empty, externalPort, externalHostName, UUID.Zero, out regInfo, out reason)) { regInfo.RegionName = config.GetString("localName", ""); } -- cgit v1.1 From e1dd228f1851bc3ac6da896d5564c19746065d0f Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Sun, 13 Apr 2014 11:51:47 +0300 Subject: Better error checking when creating hyperlinks: a) Reject invalid strings; b) Default port is 80, not 0 The change of default port may fix http://opensimulator.org/mantis/view.php?id=7108 , where a user was able to create a Hyperlink to OSGrid from inside OSGrid. --- OpenSim/Services/GridService/HypergridLinker.cs | 53 +++++++++++++++++-------- 1 file changed, 36 insertions(+), 17 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 4ebfd5c..1cc75c1 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -202,18 +202,27 @@ namespace OpenSim.Services.GridService if (!mapName.StartsWith("http")) { - string host = "127.0.0.1"; - string portstr; + // Formats: grid.example.com:8002:region name + // grid.example.com:region name + // grid.example.com + + string host; + uint port = 80; string regionName = ""; - uint port = 0; + string[] parts = mapName.Split(new char[] { ':' }); - if (parts.Length >= 1) + + if (parts.Length == 0) { - host = parts[0]; + reason = "Wrong format for link-region"; + return null; } + + host = parts[0]; + if (parts.Length >= 2) { - portstr = parts[1]; + string portstr = parts[1]; //m_log.Debug("-- port = " + portstr); if (!UInt32.TryParse(portstr, out port)) regionName = parts[1]; @@ -234,13 +243,22 @@ namespace OpenSim.Services.GridService } else { - string[] parts = mapName.Split(new char[] {' '}); - string regionName = String.Empty; - if (parts.Length > 1) + // Formats: http://grid.example.com region name + // http://grid.example.com "region name" + + string regionName; + + string[] parts = mapName.Split(new char[] { ' ' }); + + if (parts.Length < 2) { - regionName = mapName.Substring(parts[0].Length + 1); - regionName = regionName.Trim(new char[] {'"'}); + reason = "Wrong format for link-region"; + return null; } + + regionName = mapName.Substring(parts[0].Length + 1); + regionName = regionName.Trim(new char[] {'"'}); + if (TryCreateLink(scopeID, xloc, yloc, regionName, 0, null, parts[0], ownerID, out regInfo, out reason)) { regInfo.RegionName = mapName; @@ -258,7 +276,7 @@ namespace OpenSim.Services.GridService public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string remoteRegionName, uint externalPort, string externalHostName, string serverURI, UUID ownerID, out GridRegion regInfo, out string reason) { - m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0} {1}, in {2}-{3}", + m_log.InfoFormat("[HYPERGRID LINKER]: Link to {0} {1}, in {2}-{3}", ((serverURI == null) ? (externalHostName + ":" + externalPort) : serverURI), remoteRegionName, Util.WorldToRegionLoc((uint)xloc), Util.WorldToRegionLoc((uint)yloc)); @@ -266,15 +284,15 @@ namespace OpenSim.Services.GridService Uri uri = null; regInfo = new GridRegion(); - if ( externalPort > 0) + if (externalPort > 0) regInfo.HttpPort = externalPort; else - regInfo.HttpPort = 0; - if ( externalHostName != null) + regInfo.HttpPort = 80; + if (externalHostName != null) regInfo.ExternalHostName = externalHostName; else regInfo.ExternalHostName = "0.0.0.0"; - if ( serverURI != null) + if (serverURI != null) { regInfo.ServerURI = serverURI; try @@ -286,7 +304,7 @@ namespace OpenSim.Services.GridService catch {} } - if ( remoteRegionName != string.Empty ) + if (remoteRegionName != string.Empty) regInfo.RegionName = remoteRegionName; regInfo.RegionLocX = xloc; @@ -299,6 +317,7 @@ namespace OpenSim.Services.GridService { if (regInfo.ExternalHostName == m_ThisGatekeeperURI.Host && regInfo.HttpPort == m_ThisGatekeeperURI.Port) { + m_log.InfoFormat("[HYPERGRID LINKER]: Cannot hyperlink to regions on the same grid"); reason = "Cannot hyperlink to regions on the same grid"; return false; } -- cgit v1.1 From 6efc203ce88566a1288eb1f7225f93db1c0af541 Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Thu, 24 Apr 2014 08:19:05 +0300 Subject: Fixed: hypergrid-linking stopped accepting the following format: "http://grid.example.com" (without a region name) Fixes http://opensimulator.org/mantis/view.php?id=7128 --- OpenSim/Services/GridService/HypergridLinker.cs | 32 ++++++++++++++++--------- 1 file changed, 21 insertions(+), 11 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 1cc75c1..bf52660 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -200,10 +200,13 @@ namespace OpenSim.Services.GridService reason = string.Empty; GridRegion regInfo = null; + mapName = mapName.Trim(); + if (!mapName.StartsWith("http")) { // Formats: grid.example.com:8002:region name // grid.example.com:region name + // grid.example.com:8002 // grid.example.com string host; @@ -222,11 +225,11 @@ namespace OpenSim.Services.GridService if (parts.Length >= 2) { - string portstr = parts[1]; - //m_log.Debug("-- port = " + portstr); - if (!UInt32.TryParse(portstr, out port)) + // If it's a number then assume it's a port. Otherwise, it's a region name. + if (!UInt32.TryParse(parts[1], out port)) regionName = parts[1]; } + // always take the last one if (parts.Length >= 3) { @@ -245,21 +248,28 @@ namespace OpenSim.Services.GridService { // Formats: http://grid.example.com region name // http://grid.example.com "region name" - - string regionName; + // http://grid.example.com + + string serverURI; + string regionName = ""; string[] parts = mapName.Split(new char[] { ' ' }); - if (parts.Length < 2) + if (parts.Length == 0) { reason = "Wrong format for link-region"; return null; } - - regionName = mapName.Substring(parts[0].Length + 1); - regionName = regionName.Trim(new char[] {'"'}); - - if (TryCreateLink(scopeID, xloc, yloc, regionName, 0, null, parts[0], ownerID, out regInfo, out reason)) + + serverURI = parts[0]; + + if (parts.Length >= 2) + { + regionName = mapName.Substring(serverURI.Length); + regionName = regionName.Trim(new char[] { '"', ' ' }); + } + + if (TryCreateLink(scopeID, xloc, yloc, regionName, 0, null, serverURI, ownerID, out regInfo, out reason)) { regInfo.RegionName = mapName; return regInfo; -- cgit v1.1 From 463d0b2f8f0cd5f02c14391b763680b23c16e438 Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Thu, 24 Apr 2014 18:57:55 +0300 Subject: When linking a Hypergrid region, set the region's flags on the in-memory GridRegion immediately. (When using llTeleportAgent() this *specific* object is used for the teleport, so it should have the correct flags.) --- OpenSim/Services/GridService/HypergridLinker.cs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index bf52660..8a60264 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -68,10 +68,6 @@ namespace OpenSim.Services.GridService protected string m_ThisGatekeeper = string.Empty; protected Uri m_ThisGatekeeperURI = null; - // Hyperlink regions are hyperlinks on the map - public readonly Dictionary m_HyperlinkRegions = new Dictionary(); - protected Dictionary m_HyperlinkHandles = new Dictionary(); - protected GridRegion m_DefaultRegion; protected GridRegion DefaultRegion { @@ -409,7 +405,7 @@ namespace OpenSim.Services.GridService // Store the origin's coordinates somewhere regInfo.RegionSecret = handle.ToString(); - AddHyperlinkRegion(regInfo, handle); + AddHyperlinkRegion(ref regInfo, handle); m_log.InfoFormat("[HYPERGRID LINKER]: Successfully linked to region {0} with image {1}", regInfo.RegionName, regInfo.TerrainImage); return true; } @@ -489,11 +485,11 @@ namespace OpenSim.Services.GridService // return true; // } - private void AddHyperlinkRegion(GridRegion regionInfo, ulong regionHandle) + private void AddHyperlinkRegion(ref GridRegion regionInfo, ulong regionHandle) { RegionData rdata = m_GridService.RegionInfo2RegionData(regionInfo); - int flags = (int)OpenSim.Framework.RegionFlags.Hyperlink + (int)OpenSim.Framework.RegionFlags.NoDirectLogin + (int)OpenSim.Framework.RegionFlags.RegionOnline; - rdata.Data["flags"] = flags.ToString(); + regionInfo.Flags = OpenSim.Framework.RegionFlags.Hyperlink | OpenSim.Framework.RegionFlags.NoDirectLogin | OpenSim.Framework.RegionFlags.RegionOnline; + rdata.Data["flags"] = ((int)regionInfo.Flags).ToString(); m_Database.Store(rdata); } -- cgit v1.1 From 0d898d8d8a4dc5920dd17fbfd4f596da474862a6 Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Thu, 24 Apr 2014 19:08:50 +0300 Subject: Revert "When linking a Hypergrid region, set the region's flags on the in-memory GridRegion immediately." This reverts commit 463d0b2f8f0cd5f02c14391b763680b23c16e438. --- OpenSim/Services/GridService/HypergridLinker.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 8a60264..c6d2ee3 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -405,7 +405,7 @@ namespace OpenSim.Services.GridService // Store the origin's coordinates somewhere regInfo.RegionSecret = handle.ToString(); - AddHyperlinkRegion(ref regInfo, handle); + AddHyperlinkRegion(regInfo, handle); m_log.InfoFormat("[HYPERGRID LINKER]: Successfully linked to region {0} with image {1}", regInfo.RegionName, regInfo.TerrainImage); return true; } @@ -485,11 +485,11 @@ namespace OpenSim.Services.GridService // return true; // } - private void AddHyperlinkRegion(ref GridRegion regionInfo, ulong regionHandle) + private void AddHyperlinkRegion(GridRegion regionInfo, ulong regionHandle) { RegionData rdata = m_GridService.RegionInfo2RegionData(regionInfo); - regionInfo.Flags = OpenSim.Framework.RegionFlags.Hyperlink | OpenSim.Framework.RegionFlags.NoDirectLogin | OpenSim.Framework.RegionFlags.RegionOnline; - rdata.Data["flags"] = ((int)regionInfo.Flags).ToString(); + int flags = (int)OpenSim.Framework.RegionFlags.Hyperlink + (int)OpenSim.Framework.RegionFlags.NoDirectLogin + (int)OpenSim.Framework.RegionFlags.RegionOnline; + rdata.Data["flags"] = flags.ToString(); m_Database.Store(rdata); } -- cgit v1.1 From f41809e07d354654642f45583ec759024d83db05 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 8 May 2014 22:39:17 +0100 Subject: minor: Capitalize Hypergrid help category like others --- OpenSim/Services/GridService/HypergridLinker.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index c6d2ee3..09c7938 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -156,18 +156,18 @@ namespace OpenSim.Services.GridService if (MainConsole.Instance != null) { - MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", + MainConsole.Instance.Commands.AddCommand("Hypergrid", false, "link-region", "link-region []", "Link a HyperGrid Region. Examples for : http://grid.net:8002/ or http://example.org/path/foo.php", RunCommand); - MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", + MainConsole.Instance.Commands.AddCommand("Hypergrid", false, "link-region", "link-region []", "Link a hypergrid region (deprecated)", RunCommand); - MainConsole.Instance.Commands.AddCommand("hypergrid", false, "unlink-region", + MainConsole.Instance.Commands.AddCommand("Hypergrid", false, "unlink-region", "unlink-region ", "Unlink a hypergrid region", RunCommand); - MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-mapping", "link-mapping [ ]", + MainConsole.Instance.Commands.AddCommand("Hypergrid", false, "link-mapping", "link-mapping [ ]", "Set local coordinate to map HG regions to", RunCommand); - MainConsole.Instance.Commands.AddCommand("hypergrid", false, "show hyperlinks", "show hyperlinks", + MainConsole.Instance.Commands.AddCommand("Hypergrid", false, "show hyperlinks", "show hyperlinks", "List the HG regions", HandleShow); } } -- cgit v1.1 From 0300ec45ebc7b8696c64bf4575bf674a6b1a8fa7 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sat, 31 May 2014 12:10:50 -0700 Subject: Modifications to debugging printouts. No functional changes. --- OpenSim/Services/GridService/GridService.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 8198592..36957a7 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -46,6 +46,7 @@ namespace OpenSim.Services.GridService private static readonly ILog m_log = LogManager.GetLogger( MethodBase.GetCurrentMethod().DeclaringType); + private string LogHeader = "[GRID SERVICE]"; private bool m_DeleteOnUnregister = true; private static GridService m_RootInstance = null; @@ -328,7 +329,11 @@ namespace OpenSim.Services.GridService } } -// m_log.DebugFormat("[GRID SERVICE]: region {0} has {1} neighbours", region.RegionName, rinfos.Count); + // string rNames = ""; + // foreach (GridRegion gr in rinfos) + // rNames += gr.RegionName + ","; + // m_log.DebugFormat("{0} region {1} has {2} neighbours ({3})", + // LogHeader, region.RegionName, rinfos.Count, rNames); } else { @@ -657,7 +662,7 @@ namespace OpenSim.Services.GridService return; } - RegionData region = m_Database.Get((int)Util.RegionToWorldLoc(x), (int)Util.RegionToWorldLoc(y), UUID.Zero); + RegionData region = m_Database.Get((int)Util.RegionToWorldLoc(x), (int)Util.RegionToWorldLoc(y), UUID.Zero); if (region == null) { MainConsole.Instance.OutputFormat("No region found at {0},{1}", x, y); -- cgit v1.1 From 5450b1b0247bb3907f60f2b3f9b0582903de4f83 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 17 Jun 2014 18:37:15 +0100 Subject: Change assembly versions to 0.8.1 --- OpenSim/Services/GridService/Properties/AssemblyInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/Properties/AssemblyInfo.cs b/OpenSim/Services/GridService/Properties/AssemblyInfo.cs index bd84123..6703b3c 100644 --- a/OpenSim/Services/GridService/Properties/AssemblyInfo.cs +++ b/OpenSim/Services/GridService/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("0.8.0.*")] +[assembly: AssemblyVersion("0.8.1.*")] -- cgit v1.1 From 82a5d00bc847b4bf5e5ba7b8e47ee109929c63bf Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 4 Jul 2014 23:57:24 +0100 Subject: Adjust "show regions" and "show region" robust service console output to show size "show regions" drops the owner id column but is till present in "show region" "show regions" name column expanded to allow for longer hg regions (probably still too short, may eventually have to truncate rather than taking up huge screen space) --- OpenSim/Services/GridService/GridService.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 36957a7..477f54b 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -620,7 +620,6 @@ namespace OpenSim.Services.GridService OutputRegionsToConsoleSummary(regions); } - private void HandleShowRegion(string module, string[] cmd) { if (cmd.Length != 4) @@ -679,7 +678,8 @@ namespace OpenSim.Services.GridService ConsoleDisplayList dispList = new ConsoleDisplayList(); dispList.AddRow("Region Name", r.RegionName); dispList.AddRow("Region ID", r.RegionID); - dispList.AddRow("Location", string.Format("{0},{1}", r.coordX, r.coordY)); + dispList.AddRow("Position", string.Format("{0},{1}", r.coordX, r.coordY)); + dispList.AddRow("Size", string.Format("{0}x{1}", r.sizeX, r.sizeY)); dispList.AddRow("URI", r.Data["serverURI"]); dispList.AddRow("Owner ID", r.Data["owner_uuid"]); dispList.AddRow("Flags", flags); @@ -696,10 +696,10 @@ namespace OpenSim.Services.GridService private void OutputRegionsToConsoleSummary(List regions) { ConsoleDisplayTable dispTable = new ConsoleDisplayTable(); - dispTable.AddColumn("Name", 16); + dispTable.AddColumn("Name", 44); dispTable.AddColumn("ID", 36); dispTable.AddColumn("Position", 11); - dispTable.AddColumn("Owner ID", 36); + dispTable.AddColumn("Size", 11); dispTable.AddColumn("Flags", 60); foreach (RegionData r in regions) @@ -709,7 +709,7 @@ namespace OpenSim.Services.GridService r.RegionName, r.RegionID.ToString(), string.Format("{0},{1}", r.coordX, r.coordY), - r.Data["owner_uuid"].ToString(), + string.Format("{0}x{1}", r.sizeX, r.sizeY), flags.ToString()); } -- cgit v1.1 From 219d2734181e615199ccfd6c10d595ea6aa41b14 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 5 Jul 2014 00:48:01 +0100 Subject: Add experimental "show grid size" robust console command. This will show an approximate grid size that doesn't count regions that are hyperlinks Not particularly trustworthy since it will still count regions that are not active but were not deregistered (deliberately or due to simulator crash or similar) --- OpenSim/Services/GridService/GridService.cs | 39 +++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 5 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 477f54b..e0e2f03 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -118,12 +118,19 @@ namespace OpenSim.Services.GridService "For example, show region at 1000 1000", HandleShowRegionAt); - MainConsole.Instance.Commands.AddCommand("Regions", true, - "set region flags", - "set region flags ", - "Set database flags for region", + MainConsole.Instance.Commands.AddCommand("General", true, + "show grid size", + "show grid size", + "Show the current grid size (excluding hyperlink references)", String.Empty, - HandleSetFlags); + HandleShowGridSize); + + MainConsole.Instance.Commands.AddCommand("Regions", true, + "set region flags", + "set region flags ", + "Set database flags for region", + String.Empty, + HandleSetFlags); } m_HypergridLinker = new HypergridLinker(m_config, this, m_Database); } @@ -620,6 +627,28 @@ namespace OpenSim.Services.GridService OutputRegionsToConsoleSummary(regions); } + private void HandleShowGridSize(string module, string[] cmd) + { + List regions = m_Database.Get(int.MinValue, int.MinValue, int.MaxValue, int.MaxValue, UUID.Zero); + + double size = 0; + + foreach (RegionData region in regions) + { + int flags = Convert.ToInt32(region.Data["flags"]); + + if ((flags & (int)Framework.RegionFlags.Hyperlink) == 0) + size += region.sizeX * region.sizeY; + } + + MainConsole.Instance.Output("This is a very rough approximation."); + MainConsole.Instance.Output("Although it will not count regions that are actually links to others over the Hypergrid, "); + MainConsole.Instance.Output("it will count regions that are inactive but were not deregistered from the grid service"); + MainConsole.Instance.Output("(e.g. simulator crashed rather than shutting down cleanly).\n"); + + MainConsole.Instance.OutputFormat("Grid size: {0} km squared.", size / 1000000); + } + private void HandleShowRegion(string module, string[] cmd) { if (cmd.Length != 4) -- cgit v1.1 From e008d54cd4453b22a9572fb3fb2df7592448db49 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 14 Jul 2014 19:28:43 +0100 Subject: minor: Remove compiler warning in GridService --- OpenSim/Services/GridService/GridService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index e0e2f03..02ed90e 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -46,7 +46,7 @@ namespace OpenSim.Services.GridService private static readonly ILog m_log = LogManager.GetLogger( MethodBase.GetCurrentMethod().DeclaringType); - private string LogHeader = "[GRID SERVICE]"; +// private string LogHeader = "[GRID SERVICE]"; private bool m_DeleteOnUnregister = true; private static GridService m_RootInstance = null; -- cgit v1.1 From 9be935ac6d74fd3b8c0c95058a575e400dd916a4 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 18 Jul 2014 22:27:39 +0100 Subject: Add ICommands.HasCommand() method so that we can detect whether a command has already been registered without needing to also run it --- OpenSim/Services/GridService/GridService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 02ed90e..aa19fc7 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -96,7 +96,7 @@ namespace OpenSim.Services.GridService // has an identically named command // // XXX: We're relying on the OpenSimulator version being registered first, which is not well defined. - if (MainConsole.Instance.Commands.Resolve(new string[] { "show", "regions" }).Length == 0) + if (!MainConsole.Instance.Commands.HasCommand("show regions")) MainConsole.Instance.Commands.AddCommand("Regions", true, "show regions", "show regions", -- cgit v1.1 From 6048dfcd715615c0c90b485a72ebbe2641f16d41 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 18 Jul 2014 22:57:04 +0100 Subject: In grid mode, add SuppressConsoleCommands flag to [GridService] so that we can stop misleading grid service only console commands from registering. We need to do this because the simulator initializes and internal copy of the GridService in grid mode for internal purposes --- OpenSim/Services/GridService/GridService.cs | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index aa19fc7..2836236 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -64,6 +64,9 @@ namespace OpenSim.Services.GridService m_config = config; IConfig gridConfig = config.Configs["GridService"]; + + bool suppressConsoleCommands = false; + if (gridConfig != null) { m_DeleteOnUnregister = gridConfig.GetBoolean("DeleteOnUnregister", true); @@ -77,13 +80,17 @@ namespace OpenSim.Services.GridService } m_AllowDuplicateNames = gridConfig.GetBoolean("AllowDuplicateNames", m_AllowDuplicateNames); m_AllowHypergridMapSearch = gridConfig.GetBoolean("AllowHypergridMapSearch", m_AllowHypergridMapSearch); + + // This service is also used locally by a simulator running in grid mode. This switches prevents + // inappropriate console commands from being registered + suppressConsoleCommands = gridConfig.GetBoolean("SuppressConsoleCommands", suppressConsoleCommands); } - + if (m_RootInstance == null) { m_RootInstance = this; - if (MainConsole.Instance != null) + if (!suppressConsoleCommands && MainConsole.Instance != null) { MainConsole.Instance.Commands.AddCommand("Regions", true, "deregister region id", @@ -92,17 +99,12 @@ namespace OpenSim.Services.GridService String.Empty, HandleDeregisterRegion); - // A messy way of stopping this command being added if we are in standalone (since the simulator - // has an identically named command - // - // XXX: We're relying on the OpenSimulator version being registered first, which is not well defined. - if (!MainConsole.Instance.Commands.HasCommand("show regions")) - MainConsole.Instance.Commands.AddCommand("Regions", true, - "show regions", - "show regions", - "Show details on all regions", - String.Empty, - HandleShowRegions); + MainConsole.Instance.Commands.AddCommand("Regions", true, + "show regions", + "show regions", + "Show details on all regions", + String.Empty, + HandleShowRegions); MainConsole.Instance.Commands.AddCommand("Regions", true, "show region name", @@ -132,6 +134,7 @@ namespace OpenSim.Services.GridService String.Empty, HandleSetFlags); } + m_HypergridLinker = new HypergridLinker(m_config, this, m_Database); } } -- cgit v1.1 From aa8b44c001445e0fc72ec5fe68a79bbd970e8753 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sun, 20 Jul 2014 10:34:09 -0700 Subject: Add code to GridService to check for overlapping of varregions when registering a new region. Adds parameter "[GridService]SuppressVarRegionOverlapCheckOnRegistration=false" that can be turned on to suppress the error check if a simulator's database has old regions that overlap. --- OpenSim/Services/GridService/GridService.cs | 129 ++++++++++++++++++++++++++-- 1 file changed, 123 insertions(+), 6 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 2836236..013cc53 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -46,7 +46,7 @@ namespace OpenSim.Services.GridService private static readonly ILog m_log = LogManager.GetLogger( MethodBase.GetCurrentMethod().DeclaringType); -// private string LogHeader = "[GRID SERVICE]"; + private string LogHeader = "[GRID SERVICE]"; private bool m_DeleteOnUnregister = true; private static GridService m_RootInstance = null; @@ -57,6 +57,8 @@ namespace OpenSim.Services.GridService protected bool m_AllowDuplicateNames = false; protected bool m_AllowHypergridMapSearch = false; + protected bool m_SuppressVarregionOverlapCheckOnRegistration = false; + public GridService(IConfigSource config) : base(config) { @@ -81,6 +83,8 @@ namespace OpenSim.Services.GridService m_AllowDuplicateNames = gridConfig.GetBoolean("AllowDuplicateNames", m_AllowDuplicateNames); m_AllowHypergridMapSearch = gridConfig.GetBoolean("AllowHypergridMapSearch", m_AllowHypergridMapSearch); + m_SuppressVarregionOverlapCheckOnRegistration = gridConfig.GetBoolean("SuppressVarregionOverlapCheckOnRegistration", m_SuppressVarregionOverlapCheckOnRegistration); + // This service is also used locally by a simulator running in grid mode. This switches prevents // inappropriate console commands from being registered suppressConsoleCommands = gridConfig.GetBoolean("SuppressConsoleCommands", suppressConsoleCommands); @@ -148,12 +152,19 @@ namespace OpenSim.Services.GridService if (regionInfos.RegionID == UUID.Zero) return "Invalid RegionID - cannot be zero UUID"; - RegionData region = m_Database.Get(regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID); - if ((region != null) && (region.RegionID != regionInfos.RegionID)) + String reason = "Region overlaps another region"; + RegionData region = FindAnyConflictingRegion(regionInfos, scopeID, out reason); + // If there is a conflicting region, if it has the same ID and same coordinates + // then it is a region re-registering (permissions and ownership checked later). + if ((region != null) + && ( (region.coordX != regionInfos.RegionCoordX) + || (region.coordY != regionInfos.RegionCoordY) + || (region.RegionID != regionInfos.RegionID) ) + ) { - m_log.WarnFormat("[GRID SERVICE]: Region {0} tried to register in coordinates {1}, {2} which are already in use in scope {3}.", - regionInfos.RegionID, regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID); - return "Region overlaps another region"; + // If not same ID and same coordinates, this new region has conflicts and can't be registered. + m_log.WarnFormat("{0} Register region conflict in scope {1}. {2}", LogHeader, scopeID, reason); + return reason; } if (region != null) @@ -283,6 +294,112 @@ namespace OpenSim.Services.GridService return String.Empty; } + /// + /// Search the region map for regions conflicting with this region. + /// The region to be added is passed and we look for any existing regions that are + /// in the requested location, that are large varregions that overlap this region, or + /// are previously defined regions that would lie under this new region. + /// + /// Information on region requested to be added to the world map + /// Grid id for region + /// The reason the returned region conflicts with passed region + /// + private RegionData FindAnyConflictingRegion(GridRegion regionInfos, UUID scopeID, out string reason) + { + reason = "Reregistration"; + // First see if there is an existing region right where this region is trying to go + // (We keep this result so it can be returned if suppressing errors) + RegionData noErrorRegion = m_Database.Get(regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID); + RegionData region = noErrorRegion; + if (region != null + && region.RegionID == regionInfos.RegionID + && region.sizeX == regionInfos.RegionSizeX + && region.sizeY == regionInfos.RegionSizeY) + { + // If this seems to be exactly the same region, return this as it could be + // a re-registration (permissions checked by calling routine). + m_log.DebugFormat("{0} FindAnyConflictingRegion: re-register of {1}", + LogHeader, RegionString(regionInfos)); + return region; + } + + // No region exactly there or we're resizing an existing region. + // Fetch regions that could be varregions overlapping requested location. + int xmin = regionInfos.RegionLocX - (int)Constants.MaximumRegionSize + 10; + int xmax = regionInfos.RegionLocX; + int ymin = regionInfos.RegionLocY - (int)Constants.MaximumRegionSize + 10; + int ymax = regionInfos.RegionLocY; + List rdatas = m_Database.Get(xmin, ymin, xmax, ymax, scopeID); + foreach (RegionData rdata in rdatas) + { + // m_log.DebugFormat("{0} FindAnyConflictingRegion: find existing. Checking {1}", LogHeader, RegionString(rdata) ); + if ( (rdata.posX + rdata.sizeX > regionInfos.RegionLocX) + && (rdata.posY + rdata.sizeY > regionInfos.RegionLocY) ) + { + region = rdata; + m_log.WarnFormat("{0} FindAnyConflictingRegion: conflict of {1} by existing varregion {2}", + LogHeader, RegionString(regionInfos), RegionString(region)); + reason = String.Format("Region location is overlapped by existing varregion {0}", + RegionString(region)); + + if (m_SuppressVarregionOverlapCheckOnRegistration) + region = noErrorRegion; + return region; + } + } + + // There isn't a region that overlaps this potential region. + // See if this potential region overlaps an existing region. + // First, a shortcut of not looking for overlap if new region is legacy region sized + // and connot overlap anything. + if (regionInfos.RegionSizeX != Constants.RegionSize + || regionInfos.RegionSizeY != Constants.RegionSize) + { + // trim range looked for so we don't pick up neighbor regions just off the edges + xmin = regionInfos.RegionLocX; + xmax = regionInfos.RegionLocX + regionInfos.RegionSizeX - 10; + ymin = regionInfos.RegionLocY; + ymax = regionInfos.RegionLocY + regionInfos.RegionSizeY - 10; + rdatas = m_Database.Get(xmin, ymin, xmax, ymax, scopeID); + + // If the region is being resized, the found region could be ourself. + foreach (RegionData rdata in rdatas) + { + // m_log.DebugFormat("{0} FindAnyConflictingRegion: see if overlap. Checking {1}", LogHeader, RegionString(rdata) ); + if (region == null || region.RegionID != regionInfos.RegionID) + { + region = rdata; + m_log.WarnFormat("{0} FindAnyConflictingRegion: conflict of varregion {1} overlaps existing region {2}", + LogHeader, RegionString(regionInfos), RegionString(region)); + reason = String.Format("Region {0} would overlap existing region {1}", + RegionString(regionInfos), RegionString(region)); + + if (m_SuppressVarregionOverlapCheckOnRegistration) + region = noErrorRegion; + return region; + } + } + } + + // If we get here, region is either null (nothing found here) or + // is the non-conflicting region found at the location being requested. + return region; + } + + // String describing name and region location of passed region + private String RegionString(RegionData reg) + { + return String.Format("{0}/{1} at <{2},{3}>", + reg.RegionName, reg.RegionID, reg.coordX, reg.coordY); + } + + // String describing name and region location of passed region + private String RegionString(GridRegion reg) + { + return String.Format("{0}/{1} at <{2},{3}>", + reg.RegionName, reg.RegionID, reg.RegionCoordX, reg.RegionCoordY); + } + public bool DeregisterRegion(UUID regionID) { RegionData region = m_Database.Get(regionID, UUID.Zero); -- cgit v1.1 From 10a8d2852e529fddb029ae333a3ae6a0f06f0182 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Sun, 3 Aug 2014 20:33:40 -0400 Subject: OpenSimExtras Move the experimental extra features functionality into the GridService. This sends default values for map, search and destination guide, plus ExportSupported control to the region on startup. Please watch http://opensimulator.org/wiki/SimulatorFeatures_Extras for changes and documentation. --- OpenSim/Services/GridService/GridService.cs | 43 +++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 013cc53..e8a545c 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -59,6 +59,8 @@ namespace OpenSim.Services.GridService protected bool m_SuppressVarregionOverlapCheckOnRegistration = false; + private static Dictionary m_ExtraFeatures = new Dictionary(); + public GridService(IConfigSource config) : base(config) { @@ -139,10 +141,38 @@ namespace OpenSim.Services.GridService HandleSetFlags); } + if (!suppressConsoleCommands) + SetExtraServiceURLs(config); + m_HypergridLinker = new HypergridLinker(m_config, this, m_Database); } } + private void SetExtraServiceURLs(IConfigSource config) + { + IConfig loginConfig = config.Configs["LoginService"]; + IConfig gridConfig = config.Configs["GridService"]; + + if (loginConfig == null || gridConfig == null) + return; + + string configVal; + + configVal = loginConfig.GetString("SearchURL", string.Empty); + if (!string.IsNullOrEmpty(configVal)) + m_ExtraFeatures["search-server-url"] = configVal; + + configVal = loginConfig.GetString("MapTileURL", string.Empty); + if (!string.IsNullOrEmpty(configVal)) + m_ExtraFeatures["map-server-url"] = configVal; + + configVal = loginConfig.GetString("DestinationGuide", string.Empty); + if (!string.IsNullOrEmpty(configVal)) + m_ExtraFeatures["destination-guide-url"] = configVal; + + m_ExtraFeatures["ExportSupported"] = gridConfig.GetString("ExportSupported", "true"); + } + #region IGridService public string RegisterRegion(UUID scopeID, GridRegion regionInfos) @@ -928,5 +958,18 @@ namespace OpenSim.Services.GridService m_Database.Store(r); } } + + /// + /// Gets the grid extra service URls we wish for the region to send in OpenSimExtras to dynamically refresh + /// parameters in the viewer used to access services like map, search and destination guides. + /// see "SimulatorFeaturesModule" + /// + /// + /// The grid extra service URls. + /// + public Dictionary GetExtraFeatures() + { + return m_ExtraFeatures; + } } } -- cgit v1.1 From 2d2aa6e07645b3b9f1577b41d0f73803ccafba80 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 3 Dec 2014 21:40:39 +0000 Subject: minor: Just have one message that displays successful registration of a region with its parameters rather than 2 --- OpenSim/Services/GridService/GridService.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index e8a545c..29723d8 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -317,8 +317,10 @@ namespace OpenSim.Services.GridService m_log.DebugFormat("[GRID SERVICE]: Database exception: {0}", e); } - m_log.DebugFormat("[GRID SERVICE]: Region {0} ({1}) registered successfully at {2}-{3} with flags {4}", - regionInfos.RegionName, regionInfos.RegionID, regionInfos.RegionCoordX, regionInfos.RegionCoordY, + m_log.DebugFormat + ("[GRID SERVICE]: Region {0} ({1}, {2}x{3}) registered at {4},{5} with flags {6}", + regionInfos.RegionName, regionInfos.RegionID, regionInfos.RegionSizeX, regionInfos.RegionSizeY, + regionInfos.RegionCoordX, regionInfos.RegionCoordY, (OpenSim.Framework.RegionFlags)flags); return String.Empty; -- cgit v1.1 From 2fd252f5a9ffc06fcaabf2a1e0889f01dcba4889 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 10 Jan 2015 10:32:33 -0800 Subject: SimulatorFeatures: the viewer also takes GridName in OpenSim extras. Added that (plus GridURL, in case viewers want to use it too) to the GridService that gives out that info to simulators. --- OpenSim/Services/GridService/GridService.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 29723d8..3b1a07e 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -170,6 +170,19 @@ namespace OpenSim.Services.GridService if (!string.IsNullOrEmpty(configVal)) m_ExtraFeatures["destination-guide-url"] = configVal; + configVal = Util.GetConfigVarFromSections( + config, "GatekeeperURI", new string[] { "Startup", "Hypergrid" }, String.Empty); + if (!string.IsNullOrEmpty(configVal)) + m_ExtraFeatures["GridURL"] = configVal; + + configVal = Util.GetConfigVarFromSections( + config, "GridName", new string[] { "Const", "Hypergrid" }, String.Empty); + if (string.IsNullOrEmpty(configVal)) + configVal = Util.GetConfigVarFromSections( + config, "gridname", new string[] { "GridInfo" }, String.Empty); + if (!string.IsNullOrEmpty(configVal)) + m_ExtraFeatures["GridName"] = configVal; + m_ExtraFeatures["ExportSupported"] = gridConfig.GetString("ExportSupported", "true"); } -- cgit v1.1 From 185e7048c8dc51fe0705bd26728440cf361564c7 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 22 Jan 2015 10:45:07 -0800 Subject: On the GridService, the central simulator features: ensure that the map tile url ends with '/' because the viewer is dumb and just appends to it. --- OpenSim/Services/GridService/GridService.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 3b1a07e..af7a511 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -164,8 +164,14 @@ namespace OpenSim.Services.GridService configVal = loginConfig.GetString("MapTileURL", string.Empty); if (!string.IsNullOrEmpty(configVal)) + { + // This URL must end with '/', the viewer doesn't check + configVal = configVal.Trim(); + if (!configVal.EndsWith("/")) + configVal = configVal + "/"; m_ExtraFeatures["map-server-url"] = configVal; - + } + configVal = loginConfig.GetString("DestinationGuide", string.Empty); if (!string.IsNullOrEmpty(configVal)) m_ExtraFeatures["destination-guide-url"] = configVal; -- cgit v1.1 From da32512ea449c2de2d4a6069f899fbd4a8bb03fa Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 29 Apr 2015 18:47:17 -0700 Subject: Updated all occurrences of AssemblyVersion("0.8.1.*") to AssemblyVersion("0.8.2.*") --- OpenSim/Services/GridService/Properties/AssemblyInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/Properties/AssemblyInfo.cs b/OpenSim/Services/GridService/Properties/AssemblyInfo.cs index 6703b3c..ebe3c44 100644 --- a/OpenSim/Services/GridService/Properties/AssemblyInfo.cs +++ b/OpenSim/Services/GridService/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("0.8.1.*")] +[assembly: AssemblyVersion("0.8.2.*")] -- cgit v1.1 From 3a2d4c8b055d906b4a790bf1bf9fb1f09f9781ea Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Wed, 22 Jul 2015 20:13:53 +0300 Subject: Added logging in places where regions are searched for by their location This commit also fixes the log message "Region already exists in coordinates <{0},{1}>": it was actually showing the *requested* coordinates, instead of the coordinates of the previously-existing link. --- OpenSim/Services/GridService/GridService.cs | 19 +++++++++++++++---- OpenSim/Services/GridService/HypergridLinker.cs | 11 ++++++----- 2 files changed, 21 insertions(+), 9 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index af7a511..8807397 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -539,13 +539,24 @@ namespace OpenSim.Services.GridService // multiples of the legacy region size (256). public GridRegion GetRegionByPosition(UUID scopeID, int x, int y) { - int snapX = (int)(x / Constants.RegionSize) * (int)Constants.RegionSize; - int snapY = (int)(y / Constants.RegionSize) * (int)Constants.RegionSize; + uint regionX = Util.WorldToRegionLoc((uint)x); + uint regionY = Util.WorldToRegionLoc((uint)y); + int snapX = (int)Util.RegionToWorldLoc(regionX); + int snapY = (int)Util.RegionToWorldLoc(regionY); + RegionData rdata = m_Database.Get(snapX, snapY, scopeID); if (rdata != null) + { + m_log.DebugFormat("{0} GetRegionByPosition. Found region {1} in database. Pos=<{2},{3}>", + LogHeader, rdata.RegionName, regionX, regionY); return RegionData2RegionInfo(rdata); - - return null; + } + else + { + m_log.DebugFormat("{0} GetRegionByPosition. Did not find region in database. Pos=<{1},{2}>", + LogHeader, regionX, regionY); + return null; + } } public GridRegion GetRegionByName(UUID scopeID, string name) diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 09c7938..0fd059f 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -282,7 +282,7 @@ namespace OpenSim.Services.GridService public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string remoteRegionName, uint externalPort, string externalHostName, string serverURI, UUID ownerID, out GridRegion regInfo, out string reason) { - m_log.InfoFormat("[HYPERGRID LINKER]: Link to {0} {1}, in {2}-{3}", + m_log.InfoFormat("[HYPERGRID LINKER]: Link to {0} {1}, in <{2},{3}>", ((serverURI == null) ? (externalHostName + ":" + externalPort) : serverURI), remoteRegionName, Util.WorldToRegionLoc((uint)xloc), Util.WorldToRegionLoc((uint)yloc)); @@ -335,7 +335,7 @@ namespace OpenSim.Services.GridService 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}", + m_log.WarnFormat("[HYPERGRID LINKER]: Coordinates <{0},{1}> are already occupied by region {2} with uuid {3}", Util.WorldToRegionLoc((uint)regInfo.RegionLocX), Util.WorldToRegionLoc((uint)regInfo.RegionLocY), region.RegionName, region.RegionID); reason = "Coordinates are already in use"; @@ -371,8 +371,8 @@ namespace OpenSim.Services.GridService region = m_GridService.GetRegionByUUID(scopeID, regionID); if (region != null) { - m_log.DebugFormat("[HYPERGRID LINKER]: Region already exists in coordinates {0} {1}", - Util.WorldToRegionLoc((uint)regInfo.RegionLocX), Util.WorldToRegionLoc((uint)regInfo.RegionLocY)); + m_log.DebugFormat("[HYPERGRID LINKER]: Region already exists in coordinates <{0},{1}>", + Util.WorldToRegionLoc((uint)region.RegionLocX), Util.WorldToRegionLoc((uint)region.RegionLocY)); regInfo = region; return true; } @@ -406,7 +406,8 @@ namespace OpenSim.Services.GridService regInfo.RegionSecret = handle.ToString(); AddHyperlinkRegion(regInfo, handle); - m_log.InfoFormat("[HYPERGRID LINKER]: Successfully linked to region {0} with image {1}", regInfo.RegionName, regInfo.TerrainImage); + m_log.InfoFormat("[HYPERGRID LINKER]: Successfully linked to region {0} at <{1},{2}> with image {3}", + regInfo.RegionName, Util.WorldToRegionLoc((uint)regInfo.RegionLocX), Util.WorldToRegionLoc((uint)regInfo.RegionLocY), regInfo.TerrainImage); return true; } -- cgit v1.1 From 43c8e2396e2d25036027638ca0e61606876f11c7 Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Wed, 22 Jul 2015 20:39:30 +0300 Subject: Added locking to HypergridLinker, to prevent problems if multiple linking requests for the same region are handled simultaneously --- OpenSim/Services/GridService/HypergridLinker.cs | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 0fd059f..a774303 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -186,12 +186,12 @@ namespace OpenSim.Services.GridService private static Random random = new Random(); // From the command line link-region (obsolete) and the map - public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, out string reason) + private 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) + private GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, UUID ownerID, out string reason) { reason = string.Empty; GridRegion regInfo = null; @@ -274,13 +274,21 @@ namespace OpenSim.Services.GridService return null; } - - public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string remoteRegionName, uint externalPort, string externalHostName, UUID ownerID, out GridRegion regInfo, out string reason) + + private bool TryCreateLink(UUID scopeID, int xloc, int yloc, string remoteRegionName, uint externalPort, string externalHostName, UUID ownerID, out GridRegion regInfo, out string reason) { return TryCreateLink(scopeID, xloc, yloc, remoteRegionName, externalPort, externalHostName, null, ownerID, out regInfo, out reason); } - - public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string remoteRegionName, uint externalPort, string externalHostName, string serverURI, UUID ownerID, out GridRegion regInfo, out string reason) + + private bool TryCreateLink(UUID scopeID, int xloc, int yloc, string remoteRegionName, uint externalPort, string externalHostName, string serverURI, UUID ownerID, out GridRegion regInfo, out string reason) + { + lock (this) + { + return TryCreateLinkImpl(scopeID, xloc, yloc, remoteRegionName, externalPort, externalHostName, serverURI, ownerID, out regInfo, out reason); + } + } + + private bool TryCreateLinkImpl(UUID scopeID, int xloc, int yloc, string remoteRegionName, uint externalPort, string externalHostName, string serverURI, UUID ownerID, out GridRegion regInfo, out string reason) { m_log.InfoFormat("[HYPERGRID LINKER]: Link to {0} {1}, in <{2},{3}>", ((serverURI == null) ? (externalHostName + ":" + externalPort) : serverURI), -- cgit v1.1 From 32d87aa168bf89996a8741b8d67c92afd1bb2531 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 1 Aug 2015 09:30:34 -0700 Subject: Mantis #7664: Added IHypergridLinker interface to establish a contract about what implementers need to provide publicly. This is used by 3rd-party addons such as Wifi. --- OpenSim/Services/GridService/HypergridLinker.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Services/GridService') diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index a774303..9d016fc 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -47,7 +47,7 @@ using OpenMetaverse; namespace OpenSim.Services.GridService { - public class HypergridLinker + public class HypergridLinker : IHypergridLinker { private static readonly ILog m_log = LogManager.GetLogger( @@ -191,7 +191,7 @@ namespace OpenSim.Services.GridService return TryLinkRegionToCoords(scopeID, mapName, xloc, yloc, UUID.Zero, out reason); } - private GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, UUID ownerID, out string reason) + public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, UUID ownerID, out string reason) { reason = string.Empty; GridRegion regInfo = null; -- cgit v1.1