From 5e4d6cab00cb29cd088ab7b62ab13aff103b64cb Mon Sep 17 00:00:00 2001 From: onefang Date: Sun, 19 May 2019 21:24:15 +1000 Subject: Dump OpenSim 0.9.0.1 into it's own branch. --- OpenSim/Services/Interfaces/IGridService.cs | 102 ++++++++-------------------- 1 file changed, 29 insertions(+), 73 deletions(-) (limited to 'OpenSim/Services/Interfaces/IGridService.cs') diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs index f5f1f75..ead5d3c 100644 --- a/OpenSim/Services/Interfaces/IGridService.cs +++ b/OpenSim/Services/Interfaces/IGridService.cs @@ -85,7 +85,7 @@ namespace OpenSim.Services.Interfaces GridRegion GetRegionByName(UUID scopeID, string regionName); /// - /// Get information about regions starting with the provided name. + /// Get information about regions starting with the provided name. /// /// /// The name to match against. @@ -95,7 +95,7 @@ namespace OpenSim.Services.Interfaces /// /// /// A list of s of regions with matching name. If the - /// grid-server couldn't be contacted or returned an error, return null. + /// grid-server couldn't be contacted or returned an error, return null. /// List GetRegionsByName(UUID scopeID, string name, int maxNumber); @@ -139,7 +139,7 @@ namespace OpenSim.Services.Interfaces #pragma warning restore 414 /// - /// The port by which http communication occurs with the region + /// The port by which http communication occurs with the region /// public uint HttpPort { get; set; } @@ -148,7 +148,7 @@ namespace OpenSim.Services.Interfaces /// public string ServerURI { - get { + get { if (!String.IsNullOrEmpty(m_serverURI)) { return m_serverURI; } else { @@ -158,14 +158,25 @@ namespace OpenSim.Services.Interfaces return "http://" + m_externalHostName + ":" + HttpPort + "/"; } } - set { - if (value.EndsWith("/")) { + set { + if ( value == null) + { + m_serverURI = String.Empty; + return; + } + + if ( value.EndsWith("/") ) + { + m_serverURI = value; - } else { + } + else + { m_serverURI = value + '/'; } } } + protected string m_serverURI; /// @@ -260,31 +271,6 @@ namespace OpenSim.Services.Interfaces m_serverURI = string.Empty; } - /* - public GridRegion(int regionLocX, int regionLocY, IPEndPoint internalEndPoint, string externalUri) - { - m_regionLocX = regionLocX; - m_regionLocY = regionLocY; - RegionSizeX = (int)Constants.RegionSize; - RegionSizeY = (int)Constants.RegionSize; - - m_internalEndPoint = internalEndPoint; - m_externalHostName = externalUri; - } - - public GridRegion(int regionLocX, int regionLocY, string externalUri, uint port) - { - m_regionLocX = regionLocX; - m_regionLocY = regionLocY; - RegionSizeX = (int)Constants.RegionSize; - RegionSizeY = (int)Constants.RegionSize; - - m_externalHostName = externalUri; - - m_internalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int)port); - } - */ - public GridRegion(uint xcell, uint ycell) { m_regionLocX = (int)Util.RegionToWorldLoc(xcell); @@ -333,7 +319,7 @@ namespace OpenSim.Services.Interfaces RegionSecret = ConvertFrom.RegionSecret; EstateOwner = ConvertFrom.EstateOwner; } - + public GridRegion(Dictionary kvp) { if (kvp.ContainsKey("uuid")) @@ -358,6 +344,13 @@ namespace OpenSim.Services.Interfaces if (kvp.ContainsKey("regionName")) RegionName = (string)kvp["regionName"]; + if (kvp.ContainsKey("access")) + { + byte access = Convert.ToByte((string)kvp["access"]); + Access = access; + Maturity = (int)Util.ConvertAccessLevelToMaturity(access); + } + if (kvp.ContainsKey("flags") && kvp["flags"] != null) RegionFlags = (OpenSim.Framework.RegionFlags?)Convert.ToInt32((string)kvp["flags"]); @@ -394,9 +387,6 @@ namespace OpenSim.Services.Interfaces if (kvp.ContainsKey("parcelMapTexture")) UUID.TryParse((string)kvp["parcelMapTexture"], out ParcelImage); - if (kvp.ContainsKey("access")) - Access = Byte.Parse((string)kvp["access"]); - if (kvp.ContainsKey("regionSecret")) RegionSecret =(string)kvp["regionSecret"]; @@ -409,7 +399,7 @@ namespace OpenSim.Services.Interfaces // m_log.DebugFormat("{0} New GridRegion. id={1}, loc=<{2},{3}>, size=<{4},{5}>", // LogHeader, RegionID, RegionLocX, RegionLocY, RegionSizeX, RegionSizeY); } - + public Dictionary ToKeyValuePairs() { Dictionary kvp = new Dictionary(); @@ -472,41 +462,7 @@ namespace OpenSim.Services.Interfaces /// public IPEndPoint ExternalEndPoint { - get - { - // Old one defaults to IPv6 - //return new IPEndPoint(Dns.GetHostAddresses(m_externalHostName)[0], m_internalEndPoint.Port); - - IPAddress ia = null; - // If it is already an IP, don't resolve it - just return directly - if (IPAddress.TryParse(m_externalHostName, out ia)) - return new IPEndPoint(ia, m_internalEndPoint.Port); - - // Reset for next check - ia = null; - try - { - foreach (IPAddress Adr in Dns.GetHostAddresses(m_externalHostName)) - { - if (ia == null) - ia = Adr; - - if (Adr.AddressFamily == AddressFamily.InterNetwork) - { - ia = Adr; - break; - } - } - } - catch (SocketException e) - { - throw new Exception( - "Unable to resolve local hostname " + m_externalHostName + " innerException of type '" + - e + "' attached to this exception", e); - } - - return new IPEndPoint(ia, m_internalEndPoint.Port); - } + get { return Util.getEndPoint(m_externalHostName, m_internalEndPoint.Port); } } public string ExternalHostName @@ -526,4 +482,4 @@ namespace OpenSim.Services.Interfaces get { return Util.UIntsToLong((uint)RegionLocX, (uint)RegionLocY); } } } -} \ No newline at end of file +} -- cgit v1.1