aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
authorRobert Adams2013-11-01 16:06:19 -0700
committerRobert Adams2013-11-01 16:06:19 -0700
commit976530569aa350ab699c1929f501628dd24c7b65 (patch)
tree563b28711267aa53d229b3574c56eaae53d195be /OpenSim/Framework
parentvarregion: push TerrainData implementation up and down the database storage s... (diff)
downloadopensim-SC_OLD-976530569aa350ab699c1929f501628dd24c7b65.zip
opensim-SC_OLD-976530569aa350ab699c1929f501628dd24c7b65.tar.gz
opensim-SC_OLD-976530569aa350ab699c1929f501628dd24c7b65.tar.bz2
opensim-SC_OLD-976530569aa350ab699c1929f501628dd24c7b65.tar.xz
varregion: enforce multiple of 256 for region size when parameters fetched from user.
Output info and warning messages for non-legacy region sizes.
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/RegionInfo.cs33
1 files changed, 33 insertions, 0 deletions
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs
index 882fe33..fa26100 100644
--- a/OpenSim/Framework/RegionInfo.cs
+++ b/OpenSim/Framework/RegionInfo.cs
@@ -99,6 +99,7 @@ namespace OpenSim.Framework
99 public class RegionInfo 99 public class RegionInfo
100 { 100 {
101 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 101 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
102 private static readonly string LogHeader = "[REGION INFO]";
102 103
103 public bool commFailTF = false; 104 public bool commFailTF = false;
104 public ConfigurationMember configMember; 105 public ConfigurationMember configMember;
@@ -632,6 +633,8 @@ namespace OpenSim.Framework
632 config.Set("SizeZ", configSizeX); 633 config.Set("SizeZ", configSizeX);
633 RegionSizeZ = Convert.ToUInt32(configSizeZ); 634 RegionSizeZ = Convert.ToUInt32(configSizeZ);
634 635
636 DoRegionSizeSanityChecks();
637
635 // InternalAddress 638 // InternalAddress
636 // 639 //
637 IPAddress address; 640 IPAddress address;
@@ -750,6 +753,36 @@ namespace OpenSim.Framework
750 } 753 }
751 } 754 }
752 755
756 // Make sure user specified region sizes are sane.
757 // Must be multiples of legacy region size (256).
758 private void DoRegionSizeSanityChecks()
759 {
760 if (RegionSizeX != Constants.RegionSize || RegionSizeY != Constants.RegionSize)
761 {
762 // Doing non-legacy region sizes.
763 // Enforce region size to be multiples of the legacy region size (256)
764 uint partial = RegionSizeX % Constants.RegionSize;
765 if (partial != 0)
766 {
767 RegionSizeX -= partial;
768 if (RegionSizeX == 0)
769 RegionSizeX = Constants.RegionSize;
770 m_log.WarnFormat("{0} Region size must be multiple of {1}. Enforcing {2}.RegionSizeX={3} instead of specified {4}",
771 LogHeader, Constants.RegionSize, m_regionName, RegionSizeX, RegionSizeX + partial);
772 }
773 partial = RegionSizeY % Constants.RegionSize;
774 if (partial != 0)
775 {
776 RegionSizeY -= partial;
777 if (RegionSizeY == 0)
778 RegionSizeY = Constants.RegionSize;
779 m_log.WarnFormat("{0} Region size must be multiple of {1}. Enforcing {2}.RegionSizeY={3} instead of specified {4}",
780 LogHeader, Constants.RegionSize, m_regionName, RegionSizeY, RegionSizeY + partial);
781 }
782 m_log.InfoFormat("{0} Region {1} size set to x={2}, y={3}", LogHeader, m_regionName, RegionSizeX, RegionSizeY);
783 }
784 }
785
753 private void WriteNiniConfig(IConfigSource source) 786 private void WriteNiniConfig(IConfigSource source)
754 { 787 {
755 IConfig config = source.Configs[RegionName]; 788 IConfig config = source.Configs[RegionName];