aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Framework
diff options
context:
space:
mode:
authorMelanie2013-03-28 02:29:07 +0000
committerMelanie2013-03-28 02:29:07 +0000
commitf548a41fb88bd45deda99a19889960f81a1969c4 (patch)
treef53b612d628f83bbe60040735fd869fa7c8261b6 /OpenSim/Region/CoreModules/Framework
parentMerge branch 'master' into careminster (diff)
parentAdd back a log message when we attempt a megaregion auto-reteleport (diff)
downloadopensim-SC-f548a41fb88bd45deda99a19889960f81a1969c4.zip
opensim-SC-f548a41fb88bd45deda99a19889960f81a1969c4.tar.gz
opensim-SC-f548a41fb88bd45deda99a19889960f81a1969c4.tar.bz2
opensim-SC-f548a41fb88bd45deda99a19889960f81a1969c4.tar.xz
Merge branch 'master' into careminster
Conflicts: OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework')
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs130
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs2
2 files changed, 73 insertions, 59 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index a7935b1..e3f4e74 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -117,6 +117,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
117 new ExpiringCache<UUID, ExpiringCache<ulong, DateTime>>(); 117 new ExpiringCache<UUID, ExpiringCache<ulong, DateTime>>();
118 118
119 private IEventQueue m_eqModule; 119 private IEventQueue m_eqModule;
120 private IRegionCombinerModule m_regionCombinerModule;
120 121
121 #region ISharedRegionModule 122 #region ISharedRegionModule
122 123
@@ -255,10 +256,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
255 256
256 public virtual void RemoveRegion(Scene scene) 257 public virtual void RemoveRegion(Scene scene)
257 { 258 {
258 StatsManager.DeregisterStat(m_interRegionTeleportAttempts); 259 if (m_Enabled)
259 StatsManager.DeregisterStat(m_interRegionTeleportAborts); 260 {
260 StatsManager.DeregisterStat(m_interRegionTeleportCancels); 261 StatsManager.DeregisterStat(m_interRegionTeleportAttempts);
261 StatsManager.DeregisterStat(m_interRegionTeleportFailures); 262 StatsManager.DeregisterStat(m_interRegionTeleportAborts);
263 StatsManager.DeregisterStat(m_interRegionTeleportCancels);
264 StatsManager.DeregisterStat(m_interRegionTeleportFailures);
265 }
262 } 266 }
263 267
264 public virtual void RegionLoaded(Scene scene) 268 public virtual void RegionLoaded(Scene scene)
@@ -267,6 +271,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
267 return; 271 return;
268 272
269 m_eqModule = Scene.RequestModuleInterface<IEventQueue>(); 273 m_eqModule = Scene.RequestModuleInterface<IEventQueue>();
274 m_regionCombinerModule = Scene.RequestModuleInterface<IRegionCombinerModule>();
270 } 275 }
271 276
272 #endregion 277 #endregion
@@ -377,8 +382,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
377 Vector3 emergencyPos = new Vector3(128, 128, 128); 382 Vector3 emergencyPos = new Vector3(128, 128, 128);
378 383
379 m_log.WarnFormat( 384 m_log.WarnFormat(
380 "[ENTITY TRANSFER MODULE]: RequestTeleportToLocation() was given an illegal position of {0} for avatar {1}, {2}. Substituting {3}", 385 "[ENTITY TRANSFER MODULE]: RequestTeleportToLocation() was given an illegal position of {0} for avatar {1}, {2} in {3}. Substituting {4}",
381 position, sp.Name, sp.UUID, emergencyPos); 386 position, sp.Name, sp.UUID, Scene.Name, emergencyPos);
382 387
383 position = emergencyPos; 388 position = emergencyPos;
384 } 389 }
@@ -1010,41 +1015,16 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1010 1015
1011 protected virtual bool NeedsNewAgent(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY) 1016 protected virtual bool NeedsNewAgent(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY)
1012 { 1017 {
1013 Border[] northBorders = Scene.NorthBorders.ToArray(); 1018 if (m_regionCombinerModule != null && m_regionCombinerModule.IsRootForMegaregion(Scene.RegionInfo.RegionID))
1014 Border[] southBorders = Scene.SouthBorders.ToArray();
1015 Border[] eastBorders = Scene.EastBorders.ToArray();
1016 Border[] westBorders = Scene.WestBorders.ToArray();
1017
1018 // Leaving this as a "megaregions" computation vs "non-megaregions" computation; it isn't
1019 // clear what should be done with a "far view" given that megaregions already extended the
1020 // view to include everything in the megaregion
1021 if (northBorders.Length > 1 || southBorders.Length > 1 || eastBorders.Length > 1 || westBorders.Length > 1)
1022 { 1019 {
1023 Vector2 extent = Vector2.Zero; 1020 Vector2 swCorner, neCorner;
1024 for (int i = 0; i < eastBorders.Length; i++) 1021 GetMegaregionViewRange(out swCorner, out neCorner);
1025 {
1026 extent.X = (eastBorders[i].BorderLine.Z > extent.X) ? eastBorders[i].BorderLine.Z : extent.X;
1027 }
1028 for (int i = 0; i < northBorders.Length; i++)
1029 {
1030 extent.Y = (northBorders[i].BorderLine.Z > extent.Y) ? northBorders[i].BorderLine.Z : extent.Y;
1031 }
1032
1033 // Loss of fraction on purpose
1034 extent.X = ((int)extent.X / (int)Constants.RegionSize) + 1;
1035 extent.Y = ((int)extent.Y / (int)Constants.RegionSize) + 1;
1036
1037 uint startX = oldRegionX - 1;
1038 uint startY = oldRegionY - 1;
1039
1040 uint endX = oldRegionX + (uint)extent.X;
1041 uint endY = oldRegionY + (uint)extent.Y;
1042 1022
1043 m_log.DebugFormat( 1023 m_log.DebugFormat(
1044 "[ENTITY TRANSFER MODULE]: Megaregion view of {0} is from {1},{2} to {3},{4} with new agent check for {5},{6}", 1024 "[ENTITY TRANSFER MODULE]: Megaregion view of {0} is from {1} to {2} with new agent check for {3},{4}",
1045 Scene.Name, startX, startY, endX, endY, newRegionX, newRegionY); 1025 Scene.Name, swCorner, neCorner, newRegionX, newRegionY);
1046 1026
1047 return !(newRegionX >= startX && newRegionX <= endX && newRegionY >= startY && newRegionY <= endY); 1027 return !(newRegionX >= swCorner.X && newRegionX <= neCorner.X && newRegionY >= swCorner.Y && newRegionY <= neCorner.Y);
1048 } 1028 }
1049 else 1029 else
1050 { 1030 {
@@ -1328,7 +1308,19 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1328 Scene initiatingScene) 1308 Scene initiatingScene)
1329 { 1309 {
1330 Thread.Sleep(10000); 1310 Thread.Sleep(10000);
1331 1311
1312 m_log.DebugFormat(
1313 "[ENTITY TRANSFER MODULE]: Auto-reteleporting {0} to correct megaregion location {1},{2},{3} from {4}",
1314 agent.Name, regionX, regionY, position, initiatingScene.Name);
1315
1316 agent.Scene.RequestTeleportLocation(
1317 agent.ControllingClient,
1318 Utils.UIntsToLong(regionX * (uint)Constants.RegionSize, regionY * (uint)Constants.RegionSize),
1319 position,
1320 agent.Lookat,
1321 (uint)Constants.TeleportFlags.ViaLocation);
1322
1323 /*
1332 IMessageTransferModule im = initiatingScene.RequestModuleInterface<IMessageTransferModule>(); 1324 IMessageTransferModule im = initiatingScene.RequestModuleInterface<IMessageTransferModule>();
1333 if (im != null) 1325 if (im != null)
1334 { 1326 {
@@ -1363,6 +1355,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1363 }); 1355 });
1364 1356
1365 } 1357 }
1358 */
1366 } 1359 }
1367 1360
1368 private void InformClientToInitiateTeleportToLocationCompleted(IAsyncResult iar) 1361 private void InformClientToInitiateTeleportToLocationCompleted(IAsyncResult iar)
@@ -1871,6 +1864,37 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1871 } 1864 }
1872 1865
1873 /// <summary> 1866 /// <summary>
1867 /// Gets the range considered in view of this megaregion (assuming this is a megaregion).
1868 /// </summary>
1869 /// <remarks>Expressed in 256m units</remarks>
1870 /// <param name='swCorner'></param>
1871 /// <param name='neCorner'></param>
1872 private void GetMegaregionViewRange(out Vector2 swCorner, out Vector2 neCorner)
1873 {
1874 Border[] northBorders = Scene.NorthBorders.ToArray();
1875 Border[] eastBorders = Scene.EastBorders.ToArray();
1876
1877 Vector2 extent = Vector2.Zero;
1878 for (int i = 0; i < eastBorders.Length; i++)
1879 {
1880 extent.X = (eastBorders[i].BorderLine.Z > extent.X) ? eastBorders[i].BorderLine.Z : extent.X;
1881 }
1882 for (int i = 0; i < northBorders.Length; i++)
1883 {
1884 extent.Y = (northBorders[i].BorderLine.Z > extent.Y) ? northBorders[i].BorderLine.Z : extent.Y;
1885 }
1886
1887 // Loss of fraction on purpose
1888 extent.X = ((int)extent.X / (int)Constants.RegionSize);
1889 extent.Y = ((int)extent.Y / (int)Constants.RegionSize);
1890
1891 swCorner.X = Scene.RegionInfo.RegionLocX - 1;
1892 swCorner.Y = Scene.RegionInfo.RegionLocY - 1;
1893 neCorner.X = Scene.RegionInfo.RegionLocX + extent.X;
1894 neCorner.Y = Scene.RegionInfo.RegionLocY + extent.Y;
1895 }
1896
1897 /// <summary>
1874 /// Return the list of regions that are considered to be neighbours to the given scene. 1898 /// Return the list of regions that are considered to be neighbours to the given scene.
1875 /// </summary> 1899 /// </summary>
1876 /// <param name="pScene"></param> 1900 /// <param name="pScene"></param>
@@ -1890,7 +1914,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1890 // Leaving this as a "megaregions" computation vs "non-megaregions" computation; it isn't 1914 // Leaving this as a "megaregions" computation vs "non-megaregions" computation; it isn't
1891 // clear what should be done with a "far view" given that megaregions already extended the 1915 // clear what should be done with a "far view" given that megaregions already extended the
1892 // view to include everything in the megaregion 1916 // view to include everything in the megaregion
1893 if (northBorders.Length <= 1 && southBorders.Length <= 1 && eastBorders.Length <= 1 && westBorders.Length <= 1) 1917 if (m_regionCombinerModule == null || !m_regionCombinerModule.IsRootForMegaregion(Scene.RegionInfo.RegionID))
1894 { 1918 {
1895 int dd = avatar.DrawDistance < Constants.RegionSize ? (int)Constants.RegionSize : (int)avatar.DrawDistance; 1919 int dd = avatar.DrawDistance < Constants.RegionSize ? (int)Constants.RegionSize : (int)avatar.DrawDistance;
1896 1920
@@ -1908,27 +1932,17 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1908 } 1932 }
1909 else 1933 else
1910 { 1934 {
1911 Vector2 extent = Vector2.Zero; 1935 Vector2 swCorner, neCorner;
1912 for (int i = 0; i < eastBorders.Length; i++) 1936 GetMegaregionViewRange(out swCorner, out neCorner);
1913 {
1914 extent.X = (eastBorders[i].BorderLine.Z > extent.X) ? eastBorders[i].BorderLine.Z : extent.X;
1915 }
1916 for (int i = 0; i < northBorders.Length; i++)
1917 {
1918 extent.Y = (northBorders[i].BorderLine.Z > extent.Y) ? northBorders[i].BorderLine.Z : extent.Y;
1919 }
1920
1921 // Loss of fraction on purpose
1922 extent.X = ((int)extent.X / (int)Constants.RegionSize) + 1;
1923 extent.Y = ((int)extent.Y / (int)Constants.RegionSize) + 1;
1924
1925 int startX = (int)(pRegionLocX - 1) * (int)Constants.RegionSize;
1926 int startY = (int)(pRegionLocY - 1) * (int)Constants.RegionSize;
1927 1937
1928 int endX = ((int)pRegionLocX + (int)extent.X) * (int)Constants.RegionSize; 1938 List<GridRegion> neighbours
1929 int endY = ((int)pRegionLocY + (int)extent.Y) * (int)Constants.RegionSize; 1939 = pScene.GridService.GetRegionRange(
1940 m_regionInfo.ScopeID,
1941 (int)swCorner.X * (int)Constants.RegionSize,
1942 (int)neCorner.X * (int)Constants.RegionSize,
1943 (int)swCorner.Y * (int)Constants.RegionSize,
1944 (int)neCorner.Y * (int)Constants.RegionSize);
1930 1945
1931 List<GridRegion> neighbours = pScene.GridService.GetRegionRange(m_regionInfo.ScopeID, startX, endX, startY, endY);
1932 neighbours.RemoveAll(delegate(GridRegion r) { return r.RegionID == m_regionInfo.RegionID; }); 1946 neighbours.RemoveAll(delegate(GridRegion r) { return r.RegionID == m_regionInfo.RegionID; });
1933 1947
1934 return neighbours; 1948 return neighbours;
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
index 9b78b3b..d372c0e 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
@@ -199,7 +199,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
199 199
200 public override void RemoveRegion(Scene scene) 200 public override void RemoveRegion(Scene scene)
201 { 201 {
202 base.AddRegion(scene); 202 base.RemoveRegion(scene);
203 203
204 if (m_Enabled) 204 if (m_Enabled)
205 scene.UnregisterModuleInterface<IUserAgentVerificationModule>(this); 205 scene.UnregisterModuleInterface<IUserAgentVerificationModule>(this);