diff options
author | Justin Clarke Casey | 2009-05-14 18:24:52 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2009-05-14 18:24:52 +0000 |
commit | b2433d2b99cc7f610ad03fc2ad8ce76494940d35 (patch) | |
tree | 482b492b85c950612a8068c810aa6a32c603de71 /OpenSim | |
parent | * refactor: move bottom part of 'xml2' serializaton to separate class (diff) | |
download | opensim-SC_OLD-b2433d2b99cc7f610ad03fc2ad8ce76494940d35.zip opensim-SC_OLD-b2433d2b99cc7f610ad03fc2ad8ce76494940d35.tar.gz opensim-SC_OLD-b2433d2b99cc7f610ad03fc2ad8ce76494940d35.tar.bz2 opensim-SC_OLD-b2433d2b99cc7f610ad03fc2ad8ce76494940d35.tar.xz |
* Improve loadregions so that all region configs are checked for clashes (e.g. same uuid) rather than just one
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs index 9416fe5..c37c2e8 100644 --- a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs +++ b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs | |||
@@ -68,7 +68,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions | |||
68 | 68 | ||
69 | public void Initialise() | 69 | public void Initialise() |
70 | { | 70 | { |
71 | m_log.Info("[LOADREGIONS]: " + Name + " cannot be default-initialized!"); | 71 | m_log.Error("[LOADREGIONS]: " + Name + " cannot be default-initialized!"); |
72 | throw new PluginNotInitialisedException(Name); | 72 | throw new PluginNotInitialisedException(Name); |
73 | } | 73 | } |
74 | 74 | ||
@@ -80,17 +80,17 @@ namespace OpenSim.ApplicationPlugins.LoadRegions | |||
80 | 80 | ||
81 | public void PostInitialise() | 81 | public void PostInitialise() |
82 | { | 82 | { |
83 | m_log.Info("[LOADREGIONS]: Load Regions addin being initialised"); | 83 | //m_log.Info("[LOADREGIONS]: Load Regions addin being initialised"); |
84 | 84 | ||
85 | IRegionLoader regionLoader; | 85 | IRegionLoader regionLoader; |
86 | if (m_openSim.ConfigSource.Source.Configs["Startup"].GetString("region_info_source", "filesystem") == "filesystem") | 86 | if (m_openSim.ConfigSource.Source.Configs["Startup"].GetString("region_info_source", "filesystem") == "filesystem") |
87 | { | 87 | { |
88 | m_log.Info("[LOADREGIONS]: Loading Region Info from filesystem"); | 88 | m_log.Info("[LOADREGIONS]: Loading region configurations from filesystem"); |
89 | regionLoader = new RegionLoaderFileSystem(); | 89 | regionLoader = new RegionLoaderFileSystem(); |
90 | } | 90 | } |
91 | else | 91 | else |
92 | { | 92 | { |
93 | m_log.Info("[LOADREGIONSPLUGIN]: Loading Region Info from web"); | 93 | m_log.Info("[LOADREGIONSPLUGIN]: Loading region configurations from web"); |
94 | regionLoader = new RegionLoaderWebServer(); | 94 | regionLoader = new RegionLoaderWebServer(); |
95 | } | 95 | } |
96 | 96 | ||
@@ -142,38 +142,33 @@ namespace OpenSim.ApplicationPlugins.LoadRegions | |||
142 | /// <returns>True if we're sane, false if we're insane</returns> | 142 | /// <returns>True if we're sane, false if we're insane</returns> |
143 | private bool CheckRegionsForSanity(RegionInfo[] regions) | 143 | private bool CheckRegionsForSanity(RegionInfo[] regions) |
144 | { | 144 | { |
145 | if (regions.Length <= 0) | 145 | if (regions.Length <= 1) |
146 | return true; | 146 | return true; |
147 | 147 | ||
148 | List<RegionInfo> checkedRegions = new List<RegionInfo>(); | 148 | for (int i = 0; i < regions.Length - 1; i++) |
149 | checkedRegions.Add(regions[0]); | ||
150 | |||
151 | for (int i = 1; i < regions.Length; i++) | ||
152 | { | 149 | { |
153 | RegionInfo region = regions[i]; | 150 | for (int j = i + 1; j < regions.Length; j++) |
154 | |||
155 | foreach (RegionInfo checkedRegion in checkedRegions) | ||
156 | { | 151 | { |
157 | if (region.RegionID == checkedRegion.RegionID) | 152 | if (regions[i].RegionID == regions[j].RegionID) |
158 | { | 153 | { |
159 | m_log.ErrorFormat( | 154 | m_log.ErrorFormat( |
160 | "[LOADREGIONS]: Regions {0} and {1} have the same UUID {2}", | 155 | "[LOADREGIONS]: Regions {0} and {1} have the same UUID {2}", |
161 | region.RegionName, checkedRegion.RegionName, region.RegionID); | 156 | regions[i].RegionName, regions[j].RegionName, regions[i].RegionID); |
162 | return false; | 157 | return false; |
163 | } | 158 | } |
164 | else if (region.RegionLocX == checkedRegion.RegionLocX && | 159 | else if ( |
165 | region.RegionLocY == checkedRegion.RegionLocY) | 160 | regions[i].RegionLocX == regions[j].RegionLocX && regions[i].RegionLocY == regions[j].RegionLocY) |
166 | { | 161 | { |
167 | m_log.ErrorFormat( | 162 | m_log.ErrorFormat( |
168 | "[LOADREGIONS]: Regions {0} and {1} have the same location {2} {3}", | 163 | "[LOADREGIONS]: Regions {0} and {1} have the same grid location ({2}, {3})", |
169 | region.RegionName, checkedRegion.RegionName, region.RegionLocX, region.RegionLocY); | 164 | regions[i].RegionName, regions[j].RegionName, regions[i].RegionLocX, regions[i].RegionLocY); |
170 | return false; | 165 | return false; |
171 | } | 166 | } |
172 | else if (region.InternalEndPoint.Port == checkedRegion.InternalEndPoint.Port) | 167 | else if (regions[i].InternalEndPoint.Port == regions[j].InternalEndPoint.Port) |
173 | { | 168 | { |
174 | m_log.ErrorFormat( | 169 | m_log.ErrorFormat( |
175 | "[LOADREGIONS]: Regions {0} and {1} have the same internal IP port {2}", | 170 | "[LOADREGIONS]: Regions {0} and {1} have the same internal IP port {2}", |
176 | region.RegionName, checkedRegion.RegionName, region.InternalEndPoint.Port); | 171 | regions[i].RegionName, regions[j].RegionName, regions[i].InternalEndPoint.Port); |
177 | return false; | 172 | return false; |
178 | } | 173 | } |
179 | } | 174 | } |