Hopefully fixed MySQL DB crash on startup issue (so we can remove 3 sec wait).
Added option to try alternate UDP ports if the one configured is in use. UDP packets are now bound to the actual outside IP address and hopefully won't "randomly" select IP on multihomed systems.ThreadPoolClientBranch
parent
41516fa2c3
commit
b089ccfa3d
|
@ -67,7 +67,19 @@ namespace OpenSim.Framework.Console
|
|||
|
||||
System.Console.WriteLine("Logs will be saved to current directory in " + LogFile);
|
||||
|
||||
Log = File.AppendText(LogFile);
|
||||
try
|
||||
{
|
||||
Log = File.AppendText(LogFile);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Console.WriteLine("Unable to open log file. Do you already have another copy of OpenSim running? Permission problem?");
|
||||
System.Console.WriteLine(ex.Message);
|
||||
System.Console.WriteLine("");
|
||||
System.Console.WriteLine("Application is terminating.");
|
||||
System.Console.WriteLine("");
|
||||
System.Threading.Thread.CurrentThread.Abort();
|
||||
}
|
||||
Log.WriteLine("========================================================================");
|
||||
Log.WriteLine(componentname + " Started at " + DateTime.Now.ToString());
|
||||
}
|
||||
|
|
|
@ -417,8 +417,9 @@ namespace OpenSim.Framework.Data.MySQL
|
|||
|
||||
public void StoreLandObject(Land parcel, LLUUID regionUUID)
|
||||
{
|
||||
MainLog.Instance.Verbose("DATASTORE", "Tedds temp fix: Waiting 3 seconds for stuff to catch up. (Someone please fix! :))");
|
||||
System.Threading.Thread.Sleep(3000);
|
||||
// Does the new locking fix it?
|
||||
//MainLog.Instance.Verbose("DATASTORE", "Tedds temp fix: Waiting 3 seconds for stuff to catch up. (Someone please fix! :))");
|
||||
//System.Threading.Thread.Sleep(3000);
|
||||
|
||||
lock (DBAccessLock)
|
||||
{
|
||||
|
|
|
@ -67,6 +67,7 @@ namespace OpenSim.Framework
|
|||
m_internalEndPoint = ConvertFrom.InternalEndPoint;
|
||||
m_externalHostName = ConvertFrom.ExternalHostName;
|
||||
m_remotingPort = ConvertFrom.RemotingPort;
|
||||
m_allow_alternate_ports = ConvertFrom.m_allow_alternate_ports;
|
||||
RemotingAddress = ConvertFrom.RemotingAddress;
|
||||
RegionID = LLUUID.Zero;
|
||||
}
|
||||
|
@ -80,6 +81,7 @@ namespace OpenSim.Framework
|
|||
get { return m_remotingPort; }
|
||||
set { m_remotingPort = value; }
|
||||
}
|
||||
public bool m_allow_alternate_ports;
|
||||
|
||||
public string RemotingAddress;
|
||||
|
||||
|
@ -125,6 +127,8 @@ namespace OpenSim.Framework
|
|||
set { m_externalHostName = value; }
|
||||
}
|
||||
|
||||
protected bool Allow_Alternate_Ports;
|
||||
|
||||
protected IPEndPoint m_internalEndPoint;
|
||||
|
||||
public IPEndPoint InternalEndPoint
|
||||
|
@ -163,6 +167,8 @@ namespace OpenSim.Framework
|
|||
public bool isSandbox = false;
|
||||
public bool commFailTF = false;
|
||||
|
||||
public bool m_allow_alternate_ports;
|
||||
|
||||
public LLUUID MasterAvatarAssignedUUID = LLUUID.Zero;
|
||||
public LLUUID CovenantID = LLUUID.Zero;
|
||||
public string MasterAvatarFirstName = String.Empty;
|
||||
|
@ -217,6 +223,7 @@ namespace OpenSim.Framework
|
|||
m_internalEndPoint = ConvertFrom.InternalEndPoint;
|
||||
m_externalHostName = ConvertFrom.ExternalHostName;
|
||||
m_remotingPort = ConvertFrom.RemotingPort;
|
||||
m_allow_alternate_ports = ConvertFrom.m_allow_alternate_ports;
|
||||
RemotingAddress = ConvertFrom.RemotingAddress;
|
||||
RegionID = LLUUID.Zero;
|
||||
}
|
||||
|
@ -228,6 +235,7 @@ namespace OpenSim.Framework
|
|||
m_internalEndPoint = ConvertFrom.InternalEndPoint;
|
||||
m_externalHostName = ConvertFrom.ExternalHostName;
|
||||
m_remotingPort = ConvertFrom.RemotingPort;
|
||||
m_allow_alternate_ports = ConvertFrom.m_allow_alternate_ports;
|
||||
RemotingAddress = ConvertFrom.RemotingAddress;
|
||||
RegionID = LLUUID.Zero;
|
||||
}
|
||||
|
@ -300,6 +308,9 @@ namespace OpenSim.Framework
|
|||
configMember.addConfigurationOption("internal_ip_port", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
|
||||
"Internal IP Port for incoming UDP client connections",
|
||||
NetworkServersInfo.DefaultHttpListenerPort.ToString(), false);
|
||||
configMember.addConfigurationOption("allow_alternate_ports", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN,
|
||||
"Allow sim to find alternate UDP ports when ports are in use?",
|
||||
"false", false);
|
||||
configMember.addConfigurationOption("external_host_name",
|
||||
ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
|
||||
"External Host Name", "127.0.0.1", false);
|
||||
|
@ -357,7 +368,10 @@ namespace OpenSim.Framework
|
|||
m_internalEndPoint = new IPEndPoint(address, 0);
|
||||
break;
|
||||
case "internal_ip_port":
|
||||
m_internalEndPoint.Port = (int) configuration_result;
|
||||
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")
|
||||
|
|
|
@ -49,6 +49,7 @@ namespace OpenSim.Framework
|
|||
m_internalEndPoint = ConvertFrom.InternalEndPoint;
|
||||
m_externalHostName = ConvertFrom.ExternalHostName;
|
||||
m_remotingPort = ConvertFrom.RemotingPort;
|
||||
m_allow_alternate_ports = ConvertFrom.m_allow_alternate_ports;
|
||||
RemotingAddress = ConvertFrom.RemotingAddress;
|
||||
}
|
||||
|
||||
|
@ -80,6 +81,7 @@ namespace OpenSim.Framework
|
|||
get { return m_remotingPort; }
|
||||
set { m_remotingPort = value; }
|
||||
}
|
||||
public bool m_allow_alternate_ports;
|
||||
|
||||
public string RemotingAddress;
|
||||
|
||||
|
|
|
@ -109,7 +109,13 @@ namespace OpenSim.Region.ClientStack
|
|||
protected Scene SetupScene(RegionInfo regionInfo, out UDPServer udpServer, bool m_permissions)
|
||||
{
|
||||
AgentCircuitManager circuitManager = new AgentCircuitManager();
|
||||
udpServer = new UDPServer((uint) regionInfo.InternalEndPoint.Port, m_assetCache, m_log, circuitManager);
|
||||
IPAddress listenIP;
|
||||
if (!IPAddress.TryParse(regionInfo.ExternalHostName, out listenIP))
|
||||
listenIP = IPAddress.Parse("0.0.0.0");
|
||||
|
||||
uint port = (uint) regionInfo.InternalEndPoint.Port;
|
||||
udpServer = new UDPServer(listenIP, ref port, regionInfo.m_allow_alternate_ports, m_assetCache, m_log, circuitManager);
|
||||
regionInfo.InternalEndPoint.Port = (int)port;
|
||||
|
||||
Scene scene = CreateScene(regionInfo, m_storageManager, circuitManager);
|
||||
|
||||
|
|
|
@ -52,6 +52,8 @@ namespace OpenSim.Region.ClientStack
|
|||
protected ulong m_regionHandle;
|
||||
|
||||
protected uint listenPort;
|
||||
protected bool Allow_Alternate_Port;
|
||||
protected IPAddress listenIP = IPAddress.Parse("0.0.0.0");
|
||||
protected IScene m_localScene;
|
||||
protected AssetCache m_assetCache;
|
||||
protected LogBase m_log;
|
||||
|
@ -82,13 +84,20 @@ namespace OpenSim.Region.ClientStack
|
|||
{
|
||||
}
|
||||
|
||||
public UDPServer(uint port, AssetCache assetCache, LogBase console, AgentCircuitManager authenticateClass)
|
||||
public UDPServer(IPAddress _listenIP, ref uint port, bool allow_alternate_port, AssetCache assetCache, LogBase console, AgentCircuitManager authenticateClass)
|
||||
{
|
||||
listenIP = _listenIP;
|
||||
listenPort = port;
|
||||
Allow_Alternate_Port = allow_alternate_port;
|
||||
m_assetCache = assetCache;
|
||||
m_log = console;
|
||||
m_authenticateSessionsClass = authenticateClass;
|
||||
CreatePacketServer();
|
||||
|
||||
// Return new port
|
||||
// This because in Grid mode it is not really important what port the region listens to as long as it is correctly registered.
|
||||
// So the option allow_alternate_ports="true" was added to default.xml
|
||||
port = listenPort;
|
||||
}
|
||||
|
||||
protected virtual void CreatePacketServer()
|
||||
|
@ -98,7 +107,7 @@ namespace OpenSim.Region.ClientStack
|
|||
|
||||
protected virtual void OnReceivedData(IAsyncResult result)
|
||||
{
|
||||
ipeSender = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0);
|
||||
ipeSender = new IPEndPoint(listenIP, 0);
|
||||
epSender = (EndPoint) ipeSender;
|
||||
Packet packet = null;
|
||||
|
||||
|
@ -246,20 +255,40 @@ namespace OpenSim.Region.ClientStack
|
|||
|
||||
public void ServerListener()
|
||||
{
|
||||
m_log.Verbose("SERVER", "Opening UDP socket on " + listenPort.ToString());
|
||||
|
||||
ServerIncoming = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int) listenPort);
|
||||
Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
|
||||
Server.Bind(ServerIncoming);
|
||||
uint newPort = listenPort;
|
||||
for (uint i = 0; i < 10; i++)
|
||||
{
|
||||
newPort = listenPort + i;
|
||||
m_log.Verbose("SERVER", "Opening UDP socket on " + listenIP.ToString() + " " + newPort + ". Allow alternate ports: " + Allow_Alternate_Port.ToString());
|
||||
try
|
||||
{
|
||||
ServerIncoming = new IPEndPoint(listenIP, (int) newPort);
|
||||
Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
|
||||
Server.Bind(ServerIncoming);
|
||||
listenPort = newPort;
|
||||
break;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// We are not looking for alternate ports?
|
||||
if (!Allow_Alternate_Port)
|
||||
throw (ex);
|
||||
|
||||
// We are looking for alternate ports!
|
||||
m_log.Verbose("SERVER", "UDP socket on " + listenIP.ToString() + " " + listenPort.ToString() + " is not available, trying next.");
|
||||
}
|
||||
System.Threading.Thread.Sleep(100); // Wait before we retry socket
|
||||
}
|
||||
|
||||
m_log.Verbose("SERVER", "UDP socket bound, getting ready to listen");
|
||||
|
||||
ipeSender = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0);
|
||||
ipeSender = new IPEndPoint(listenIP, 0);
|
||||
epSender = (EndPoint) ipeSender;
|
||||
ReceivedData = new AsyncCallback(OnReceivedData);
|
||||
Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null);
|
||||
|
||||
m_log.Status("SERVER", "Listening...");
|
||||
m_log.Status("SERVER", "Listening on port " + newPort);
|
||||
}
|
||||
|
||||
public virtual void RegisterPacketServer(PacketServer server)
|
||||
|
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue