1
0
Fork 0

add patches

master
Christopher 2022-03-18 13:06:13 +01:00
parent b8fbd70e9d
commit 5f98d7c3cf
2 changed files with 115 additions and 0 deletions

View File

@ -0,0 +1,44 @@
From affb6e69909f26090497e8e3dae11544c269cd27 Mon Sep 17 00:00:00 2001
From: Christopher <git@clatza.dev>
Date: Fri, 18 Mar 2022 12:52:23 +0100
Subject: [PATCH] Add External Hostname == DYNDNSIP to call current external ip
from aws services
---
OpenSim/Framework/RegionInfo.cs | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs
index 507c51852b..4282fe06c0 100755
--- a/OpenSim/Framework/RegionInfo.cs
+++ b/OpenSim/Framework/RegionInfo.cs
@@ -596,6 +596,26 @@ namespace OpenSim.Framework
m_log.InfoFormat(
"[REGIONINFO]: Resolving SYSTEMIP to {0} for external hostname of region {1}",
m_externalHostName, name);
+ }else if(externalName == "DYNDNSIP")
+ {
+ m_externalHostName = Util.GetLocalHost().ToString();
+
+ try
+ {
+ using (WebClient getIpClient = new WebClient())
+ {
+ m_externalHostName = getIpClient.DownloadString("http://checkip.amazonaws.com/");
+
+ m_log.InfoFormat(
+ "[REGIONINFO]: Resolving DYNDNSIP to {0} for region {1}",
+ m_externalHostName, name);
+ }
+ }catch(Exception error)
+ {
+ m_log.ErrorFormat(
+ "[REGIONINFO]: Resolving DYNDNSIP failed for region {0}: {1}",
+ name, error.Message);
+ }
}
else if (!m_resolveAddress)
{
--
2.30.0.windows.2

View File

@ -0,0 +1,71 @@
From 7e58dc4db0838486a90fd8ee718b120ccd99f89b Mon Sep 17 00:00:00 2001
From: Christopher <git@clatza.dev>
Date: Fri, 18 Mar 2022 13:02:10 +0100
Subject: [PATCH] Add checking udp port available and use other port than
already in use.
---
OpenSim/Framework/RegionInfo.cs | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs
index 4282fe06c0..79ca997ee5 100755
--- a/OpenSim/Framework/RegionInfo.cs
+++ b/OpenSim/Framework/RegionInfo.cs
@@ -36,6 +36,7 @@ using log4net;
using Nini.Config;
using OpenMetaverse;
using OpenMetaverse.StructuredData;
+using System.Net.NetworkInformation;
//using OpenSim.Framework.Console;
namespace OpenSim.Framework
@@ -560,6 +561,15 @@ namespace OpenSim.Framework
port = Convert.ToInt32(MainConsole.Instance.Prompt("Internal port", "9000"));
config.Set("InternalPort", port);
}
+
+ if(!CheckAvailableServerPort(port))
+ {
+ while(!CheckAvailableServerPort(port))
+ {
+ port++;
+ }
+ }
+
m_internalEndPoint = new IPEndPoint(address, port);
// ResolveAddress
@@ -699,6 +709,29 @@ namespace OpenSim.Framework
}
}
+ private bool CheckAvailableServerPort(int port)
+ {
+ bool isAvailable = true;
+
+ // Evaluate current system tcp connections. This is the same information provided
+ // by the netstat command line application, just in .Net strongly-typed object
+ // form. We will look through the list, and if our port we would like to use
+ // in our TcpClient is occupied, we will set isAvailable to false.
+ IPGlobalProperties ipGlobalProperties = IPGlobalProperties.GetIPGlobalProperties();
+ IPEndPoint[] udpConnInfoArray = ipGlobalProperties.GetActiveUdpListeners();
+
+ foreach (IPEndPoint endpoint in udpConnInfoArray)
+ {
+ if (endpoint.Port == port)
+ {
+ isAvailable = false;
+ break;
+ }
+ }
+
+ return isAvailable;
+ }
+
// Make sure DefaultLanding is within region borders with a buffer zone 5 meters from borders
private void DoDefaultLandingSanityChecks()
{
--
2.30.0.windows.2