aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs57
-rw-r--r--OpenSim/Data/MySQL/MySQLUserData.cs1
2 files changed, 56 insertions, 2 deletions
diff --git a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs
index 523f9fc..44c12a2 100644
--- a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs
+++ b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs
@@ -25,6 +25,7 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System.Collections.Generic;
28using System.Reflection; 29using System.Reflection;
29using System.Threading; 30using System.Threading;
30using log4net; 31using log4net;
@@ -74,6 +75,12 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
74 RegionInfo[] regionsToLoad = regionLoader.LoadRegions(); 75 RegionInfo[] regionsToLoad = regionLoader.LoadRegions();
75 76
76 openSim.ModuleLoader.LoadDefaultSharedModules(); 77 openSim.ModuleLoader.LoadDefaultSharedModules();
78
79 if (!CheckRegionsForSanity(regionsToLoad))
80 {
81 m_log.Error("[LOADREGIONS]: Halting startup due to conflicts in region configurations");
82 System.Environment.Exit(1);
83 }
77 84
78 for (int i = 0; i < regionsToLoad.Length; i++) 85 for (int i = 0; i < regionsToLoad.Length; i++)
79 { 86 {
@@ -88,10 +95,56 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
88 95
89 public void Dispose() 96 public void Dispose()
90 { 97 {
91 } 98 }
92 99
93 #endregion 100 #endregion
94 101
102 /// <summary>
103 /// Check that region configuration information makes sense.
104 /// </summary>
105 /// <param name="regions"></param>
106 /// <returns>True if we're sane, false if we're insane</returns>
107 private bool CheckRegionsForSanity(RegionInfo[] regions)
108 {
109 if (regions.Length <= 0)
110 return true;
111
112 List<RegionInfo> checkedRegions = new List<RegionInfo>();
113 checkedRegions.Add(regions[0]);
114
115 for (int i = 1; i < regions.Length; i++)
116 {
117 RegionInfo region = regions[i];
118
119 foreach (RegionInfo checkedRegion in checkedRegions)
120 {
121 if (region.RegionID == checkedRegion.RegionID)
122 {
123 m_log.ErrorFormat(
124 "[LOADREGIONS]: Regions {0} and {1} have the same UUID {2}",
125 region.RegionName, checkedRegion.RegionName, region.RegionID);
126 return false;
127 }
128 else if (region.RegionLocX == checkedRegion.RegionLocX && region.RegionLocY == checkedRegion.RegionLocY)
129 {
130 m_log.ErrorFormat(
131 "[LOADREGIONS]: Regions {0} and {1} have the same location {2} {3}",
132 region.RegionName, checkedRegion.RegionName, region.RegionLocX, region.RegionLocY);
133 return false;
134 }
135 else if (region.InternalEndPoint.Port == checkedRegion.InternalEndPoint.Port)
136 {
137 m_log.ErrorFormat(
138 "[LOADREGIONS]: Regions {0} and {1} have the same internal IP port {2}",
139 region.RegionName, checkedRegion.RegionName, region.InternalEndPoint.Port);
140 return false;
141 }
142 }
143 }
144
145 return true;
146 }
147
95 public void LoadRegionFromConfig(OpenSimBase openSim, ulong regionhandle) 148 public void LoadRegionFromConfig(OpenSimBase openSim, ulong regionhandle)
96 { 149 {
97 m_log.Info("[LOADREGIONS]: Load Regions addin being initialised"); 150 m_log.Info("[LOADREGIONS]: Load Regions addin being initialised");
diff --git a/OpenSim/Data/MySQL/MySQLUserData.cs b/OpenSim/Data/MySQL/MySQLUserData.cs
index 627bc0c..1ae5645 100644
--- a/OpenSim/Data/MySQL/MySQLUserData.cs
+++ b/OpenSim/Data/MySQL/MySQLUserData.cs
@@ -409,6 +409,7 @@ namespace OpenSim.Data.MySQL
409 409
410 Lfli.Add(fli); 410 Lfli.Add(fli);
411 } 411 }
412
412 reader.Dispose(); 413 reader.Dispose();
413 result.Dispose(); 414 result.Dispose();
414 } 415 }