Remove the AllowAlternatePorts option. It wasn't implemented anyway.

Instead, handle the port being 0 as "any port" and assign a random
port for regions in that case.
melanie
Melanie Thielker 2016-12-13 19:47:26 +00:00
parent ee58beddec
commit 69776aa70c
5 changed files with 21 additions and 40 deletions

View File

@ -138,8 +138,6 @@ namespace OpenSim.Framework
protected uint m_httpPort;
protected string m_serverURI;
protected string m_regionName = String.Empty;
protected bool Allow_Alternate_Ports;
public bool m_allow_alternate_ports;
protected string m_externalHostName;
protected IPEndPoint m_internalEndPoint;
protected uint m_remotingPort;
@ -673,20 +671,6 @@ namespace OpenSim.Framework
}
m_internalEndPoint = new IPEndPoint(address, port);
// AllowAlternatePorts
//
allKeys.Remove("AllowAlternatePorts");
if (config.Contains("AllowAlternatePorts"))
{
m_allow_alternate_ports = config.GetBoolean("AllowAlternatePorts", true);
}
else
{
m_allow_alternate_ports = Convert.ToBoolean(MainConsole.Instance.CmdPrompt("Allow alternate ports", "False"));
config.Set("AllowAlternatePorts", m_allow_alternate_ports.ToString());
}
// ResolveAddress
//
allKeys.Remove("ResolveAddress");
@ -925,8 +909,6 @@ namespace OpenSim.Framework
config.Set("InternalAddress", m_internalEndPoint.Address.ToString());
config.Set("InternalPort", m_internalEndPoint.Port);
config.Set("AllowAlternatePorts", m_allow_alternate_ports.ToString());
config.Set("ExternalHostName", m_externalHostName);
if (m_nonphysPrimMin > 0)
@ -1019,10 +1001,6 @@ namespace OpenSim.Framework
configMember.addConfigurationOption("internal_ip_port", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
"Internal IP Port for incoming UDP client connections",
m_internalEndPoint.Port.ToString(), true);
configMember.addConfigurationOption("allow_alternate_ports",
ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN,
"Allow sim to find alternate UDP ports when ports are in use?",
m_allow_alternate_ports.ToString(), true);
configMember.addConfigurationOption("external_host_name",
ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
"External Host Name", m_externalHostName, true);
@ -1092,9 +1070,6 @@ namespace OpenSim.Framework
configMember.addConfigurationOption("internal_ip_port", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
"Internal IP Port for incoming UDP client connections",
ConfigSettings.DefaultRegionHttpPort.ToString(), false);
configMember.addConfigurationOption("allow_alternate_ports", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN,
"Allow sim to find alternate UDP ports when ports are in use?",
"false", true);
configMember.addConfigurationOption("external_host_name",
ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
"External Host Name", "127.0.0.1", false);
@ -1165,9 +1140,6 @@ namespace OpenSim.Framework
case "internal_ip_port":
m_internalEndPoint.Port = (int) configuration_result;
break;
case "allow_alternate_ports":
m_allow_alternate_ports = (bool) configuration_result;
break;
case "external_host_name":
if ((string) configuration_result != "SYSTEMIP")
{
@ -1244,7 +1216,6 @@ namespace OpenSim.Framework
if ((RemotingAddress != null) && !RemotingAddress.Equals(""))
args["remoting_address"] = OSD.FromString(RemotingAddress);
args["remoting_port"] = OSD.FromString(RemotingPort.ToString());
args["allow_alt_ports"] = OSD.FromBoolean(m_allow_alternate_ports);
if ((proxyUrl != null) && !proxyUrl.Equals(""))
args["proxy_url"] = OSD.FromString(proxyUrl);
if (RegionType != String.Empty)
@ -1299,8 +1270,6 @@ namespace OpenSim.Framework
RemotingAddress = args["remoting_address"].AsString();
if (args["remoting_port"] != null)
UInt32.TryParse(args["remoting_port"].AsString(), out m_remotingPort);
if (args["allow_alt_ports"] != null)
m_allow_alternate_ports = args["allow_alt_ports"].AsBoolean();
if (args["proxy_url"] != null)
proxyUrl = args["proxy_url"].AsString();
if (args["region_type"] != null)
@ -1338,7 +1307,8 @@ namespace OpenSim.Framework
kvp["http_port"] = HttpPort.ToString();
kvp["internal_ip_address"] = InternalEndPoint.Address.ToString();
kvp["internal_port"] = InternalEndPoint.Port.ToString();
kvp["alternate_ports"] = m_allow_alternate_ports.ToString();
// TODO: Remove in next major version
kvp["alternate_ports"] = "False";
kvp["server_uri"] = ServerURI;
return kvp;

View File

@ -81,7 +81,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
uint port = (uint)scene.RegionInfo.InternalEndPoint.Port;
IPAddress listenIP = scene.RegionInfo.InternalEndPoint.Address;
Initialise(listenIP, ref port, scene.RegionInfo.ProxyOffset, scene.RegionInfo.m_allow_alternate_ports, m_Config, scene.AuthenticateHandler);
Initialise(listenIP, ref port, scene.RegionInfo.ProxyOffset, m_Config, scene.AuthenticateHandler);
scene.RegionInfo.InternalEndPoint.Port = (int)port;
AddScene(scene);
@ -98,9 +98,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
#endregion
public virtual void Initialise(IPAddress listenIP, ref uint port, int proxyPortOffsetParm, bool allow_alternate_port, IConfigSource configSource, AgentCircuitManager circuitManager)
public virtual void Initialise(IPAddress listenIP, ref uint port, int proxyPortOffsetParm, IConfigSource configSource, AgentCircuitManager circuitManager)
{
m_udpServer = new LLUDPServer(listenIP, ref port, proxyPortOffsetParm, allow_alternate_port, configSource, circuitManager);
m_udpServer = new LLUDPServer(listenIP, ref port, proxyPortOffsetParm, configSource, circuitManager);
}
public virtual void AddScene(IScene scene)
@ -430,12 +430,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public JobEngine OqrEngine { get; protected set; }
public LLUDPServer(
IPAddress listenIP, ref uint port, int proxyPortOffsetParm, bool allow_alternate_port,
IPAddress listenIP, ref uint port, int proxyPortOffsetParm,
IConfigSource configSource, AgentCircuitManager circuitManager)
: base(listenIP, (int)port)
{
#region Environment.TickCount Measurement
// Update the port with the one we actually got
port = (uint)Port;
// Measure the resolution of Environment.TickCount
TickCountResolution = 0f;
for (int i = 0; i < 10; i++)

View File

@ -107,6 +107,11 @@ namespace OpenMetaverse
/// </summary>
public float AverageReceiveTicksForLastSamplePeriod { get; private set; }
public int Port
{
get { return m_udpPort; }
}
#region PacketDropDebugging
/// <summary>
/// For debugging purposes only... random number generator for dropping
@ -257,6 +262,9 @@ namespace OpenMetaverse
m_udpSocket.Bind(ipep);
if (m_udpPort == 0)
m_udpPort = ((IPEndPoint)m_udpSocket.LocalEndPoint).Port;
IsRunningInbound = true;
// kick off an async receive. The Start() method will return, the

View File

@ -86,7 +86,7 @@ namespace OpenSim.Tests.Common
uint port = 0;
AgentCircuitManager acm = scene.AuthenticateHandler;
TestLLUDPServer udpServer = new TestLLUDPServer(IPAddress.Any, ref port, 0, false, configSource, acm);
TestLLUDPServer udpServer = new TestLLUDPServer(IPAddress.Any, ref port, 0, configSource, acm);
udpServer.AddScene(scene);
return udpServer;

View File

@ -43,8 +43,8 @@ namespace OpenSim.Tests.Common
{
public List<Packet> PacketsSent { get; private set; }
public TestLLUDPServer(IPAddress listenIP, ref uint port, int proxyPortOffsetParm, bool allow_alternate_port, IConfigSource configSource, AgentCircuitManager circuitManager)
: base(listenIP, ref port, proxyPortOffsetParm, allow_alternate_port, configSource, circuitManager)
public TestLLUDPServer(IPAddress listenIP, ref uint port, int proxyPortOffsetParm, IConfigSource configSource, AgentCircuitManager circuitManager)
: base(listenIP, ref port, proxyPortOffsetParm, configSource, circuitManager)
{
PacketsSent = new List<Packet>();
}