aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Framework/EntityTransfer
diff options
context:
space:
mode:
authorMelanie2013-03-31 20:27:46 +0200
committerMelanie2013-03-31 20:27:46 +0200
commitf142e1f3941165f29f390132f53fc5e88b40c883 (patch)
tree1f1ddd276fd940f86aa88b61692ecd68a0d2084a /OpenSim/Region/CoreModules/Framework/EntityTransfer
parentExport permission, part two. Setting export perms for textures and clothing w... (diff)
parentMerge branch 'master' into careminster (diff)
downloadopensim-SC-f142e1f3941165f29f390132f53fc5e88b40c883.zip
opensim-SC-f142e1f3941165f29f390132f53fc5e88b40c883.tar.gz
opensim-SC-f142e1f3941165f29f390132f53fc5e88b40c883.tar.bz2
opensim-SC-f142e1f3941165f29f390132f53fc5e88b40c883.tar.xz
Merge branch 'master' of ssh://3dhosting.de/var/git/careminster
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework/EntityTransfer')
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs233
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs2
2 files changed, 195 insertions, 40 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 25334b9..8082c1b 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -33,6 +33,7 @@ using System.Threading;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Framework.Capabilities; 34using OpenSim.Framework.Capabilities;
35using OpenSim.Framework.Client; 35using OpenSim.Framework.Client;
36using OpenSim.Framework.Monitoring;
36using OpenSim.Region.Framework.Interfaces; 37using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Region.Framework.Scenes; 38using OpenSim.Region.Framework.Scenes;
38using OpenSim.Region.Physics.Manager; 39using OpenSim.Region.Physics.Manager;
@@ -77,6 +78,31 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
77 /// </remarks> 78 /// </remarks>
78 public bool DisableInterRegionTeleportCancellation { get; set; } 79 public bool DisableInterRegionTeleportCancellation { get; set; }
79 80
81 /// <summary>
82 /// Number of times inter-region teleport was attempted.
83 /// </summary>
84 private Stat m_interRegionTeleportAttempts;
85
86 /// <summary>
87 /// Number of times inter-region teleport was aborted (due to simultaneous client logout).
88 /// </summary>
89 private Stat m_interRegionTeleportAborts;
90
91 /// <summary>
92 /// Number of times inter-region teleport was successfully cancelled by the client.
93 /// </summary>
94 private Stat m_interRegionTeleportCancels;
95
96 /// <summary>
97 /// Number of times inter-region teleport failed due to server/client/network problems (e.g. viewer failed to
98 /// connect with destination region).
99 /// </summary>
100 /// <remarks>
101 /// This is not necessarily a problem for this simulator - in open-grid/hg conditions, viewer connectivity to
102 /// destination simulator is unknown.
103 /// </remarks>
104 private Stat m_interRegionTeleportFailures;
105
80 protected bool m_Enabled = false; 106 protected bool m_Enabled = false;
81 107
82 public Scene Scene { get; private set; } 108 public Scene Scene { get; private set; }
@@ -91,6 +117,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
91 new ExpiringCache<UUID, ExpiringCache<ulong, DateTime>>(); 117 new ExpiringCache<UUID, ExpiringCache<ulong, DateTime>>();
92 118
93 private IEventQueue m_eqModule; 119 private IEventQueue m_eqModule;
120 private IRegionCombinerModule m_regionCombinerModule;
94 121
95 #region ISharedRegionModule 122 #region ISharedRegionModule
96 123
@@ -156,6 +183,60 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
156 183
157 Scene = scene; 184 Scene = scene;
158 185
186 m_interRegionTeleportAttempts =
187 new Stat(
188 "InterRegionTeleportAttempts",
189 "Number of inter-region teleports attempted.",
190 "This does not count attempts which failed due to pre-conditions (e.g. target simulator refused access).\n"
191 + "You can get successfully teleports by subtracting aborts, cancels and teleport failures from this figure.",
192 "",
193 "entitytransfer",
194 Scene.Name,
195 StatType.Push,
196 null,
197 StatVerbosity.Debug);
198
199 m_interRegionTeleportAborts =
200 new Stat(
201 "InterRegionTeleportAborts",
202 "Number of inter-region teleports aborted due to client actions.",
203 "The chief action is simultaneous logout whilst teleporting.",
204 "",
205 "entitytransfer",
206 Scene.Name,
207 StatType.Push,
208 null,
209 StatVerbosity.Debug);
210
211 m_interRegionTeleportCancels =
212 new Stat(
213 "InterRegionTeleportCancels",
214 "Number of inter-region teleports cancelled by the client.",
215 null,
216 "",
217 "entitytransfer",
218 Scene.Name,
219 StatType.Push,
220 null,
221 StatVerbosity.Debug);
222
223 m_interRegionTeleportFailures =
224 new Stat(
225 "InterRegionTeleportFailures",
226 "Number of inter-region teleports that failed due to server/client/network issues.",
227 "This number may not be very helpful in open-grid/hg situations as the network connectivity/quality of destinations is uncontrollable.",
228 "",
229 "entitytransfer",
230 Scene.Name,
231 StatType.Push,
232 null,
233 StatVerbosity.Debug);
234
235 StatsManager.RegisterStat(m_interRegionTeleportAttempts);
236 StatsManager.RegisterStat(m_interRegionTeleportAborts);
237 StatsManager.RegisterStat(m_interRegionTeleportCancels);
238 StatsManager.RegisterStat(m_interRegionTeleportFailures);
239
159 scene.RegisterModuleInterface<IEntityTransferModule>(this); 240 scene.RegisterModuleInterface<IEntityTransferModule>(this);
160 scene.EventManager.OnNewClient += OnNewClient; 241 scene.EventManager.OnNewClient += OnNewClient;
161 } 242 }
@@ -173,7 +254,16 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
173 254
174 public virtual void Close() {} 255 public virtual void Close() {}
175 256
176 public virtual void RemoveRegion(Scene scene) {} 257 public virtual void RemoveRegion(Scene scene)
258 {
259 if (m_Enabled)
260 {
261 StatsManager.DeregisterStat(m_interRegionTeleportAttempts);
262 StatsManager.DeregisterStat(m_interRegionTeleportAborts);
263 StatsManager.DeregisterStat(m_interRegionTeleportCancels);
264 StatsManager.DeregisterStat(m_interRegionTeleportFailures);
265 }
266 }
177 267
178 public virtual void RegionLoaded(Scene scene) 268 public virtual void RegionLoaded(Scene scene)
179 { 269 {
@@ -181,6 +271,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
181 return; 271 return;
182 272
183 m_eqModule = Scene.RequestModuleInterface<IEventQueue>(); 273 m_eqModule = Scene.RequestModuleInterface<IEventQueue>();
274 m_regionCombinerModule = Scene.RequestModuleInterface<IRegionCombinerModule>();
184 } 275 }
185 276
186 #endregion 277 #endregion
@@ -291,8 +382,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
291 Vector3 emergencyPos = new Vector3(128, 128, 128); 382 Vector3 emergencyPos = new Vector3(128, 128, 128);
292 383
293 m_log.WarnFormat( 384 m_log.WarnFormat(
294 "[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}",
295 position, sp.Name, sp.UUID, emergencyPos); 386 position, sp.Name, sp.UUID, Scene.Name, emergencyPos);
296 387
297 position = emergencyPos; 388 position = emergencyPos;
298 } 389 }
@@ -548,6 +639,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
548 return; 639 return;
549 } 640 }
550 641
642 // Before this point, teleport 'failure' is due to checkable pre-conditions such as whether the target
643 // simulator can be found and is explicitly prepared to allow access. Therefore, we will not count these
644 // as server attempts.
645 m_interRegionTeleportAttempts.Value++;
646
551 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Destination is running version {0}", version); 647 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Destination is running version {0}", version);
552 648
553 // Fixing a bug where teleporting while sitting results in the avatar ending up removed from 649 // Fixing a bug where teleporting while sitting results in the avatar ending up removed from
@@ -600,6 +696,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
600 bool logout = false; 696 bool logout = false;
601 if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout)) 697 if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout))
602 { 698 {
699 m_interRegionTeleportFailures.Value++;
700
603 sp.ControllingClient.SendTeleportFailed(String.Format("Teleport refused: {0}", reason)); 701 sp.ControllingClient.SendTeleportFailed(String.Format("Teleport refused: {0}", reason));
604 702
605 m_log.DebugFormat( 703 m_log.DebugFormat(
@@ -611,6 +709,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
611 709
612 if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Cancelling) 710 if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Cancelling)
613 { 711 {
712 m_interRegionTeleportCancels.Value++;
713
614 m_log.DebugFormat( 714 m_log.DebugFormat(
615 "[ENTITY TRANSFER MODULE]: Cancelled teleport of {0} to {1} from {2} after CreateAgent on client request", 715 "[ENTITY TRANSFER MODULE]: Cancelled teleport of {0} to {1} from {2} after CreateAgent on client request",
616 sp.Name, finalDestination.RegionName, sp.Scene.Name); 716 sp.Name, finalDestination.RegionName, sp.Scene.Name);
@@ -619,6 +719,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
619 } 719 }
620 else if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Aborting) 720 else if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Aborting)
621 { 721 {
722 m_interRegionTeleportAborts.Value++;
723
622 m_log.DebugFormat( 724 m_log.DebugFormat(
623 "[ENTITY TRANSFER MODULE]: Aborted teleport of {0} to {1} from {2} after CreateAgent due to previous client close.", 725 "[ENTITY TRANSFER MODULE]: Aborted teleport of {0} to {1} from {2} after CreateAgent due to previous client close.",
624 sp.Name, finalDestination.RegionName, sp.Scene.Name); 726 sp.Name, finalDestination.RegionName, sp.Scene.Name);
@@ -635,6 +737,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
635 IClientIPEndpoint ipepClient; 737 IClientIPEndpoint ipepClient;
636 if (NeedsNewAgent(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY)) 738 if (NeedsNewAgent(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY))
637 { 739 {
740 m_log.DebugFormat(
741 "[ENTITY TRANSFER MODULE]: Determined that region {0} at {1},{2} needs new child agent for incoming agent {3} from {4}",
742 finalDestination.RegionName, newRegionX, newRegionY, sp.Name, Scene.Name);
743
638 //sp.ControllingClient.SendTeleportProgress(teleportFlags, "Creating agent..."); 744 //sp.ControllingClient.SendTeleportProgress(teleportFlags, "Creating agent...");
639 #region IP Translation for NAT 745 #region IP Translation for NAT
640 // Uses ipepClient above 746 // Uses ipepClient above
@@ -688,6 +794,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
688 // establish th econnection to the destination which makes it return true. 794 // establish th econnection to the destination which makes it return true.
689 if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Aborting) 795 if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Aborting)
690 { 796 {
797 m_interRegionTeleportAborts.Value++;
798
691 m_log.DebugFormat( 799 m_log.DebugFormat(
692 "[ENTITY TRANSFER MODULE]: Aborted teleport of {0} to {1} from {2} before UpdateAgent", 800 "[ENTITY TRANSFER MODULE]: Aborted teleport of {0} to {1} from {2} before UpdateAgent",
693 sp.Name, finalDestination.RegionName, sp.Scene.Name); 801 sp.Name, finalDestination.RegionName, sp.Scene.Name);
@@ -703,6 +811,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
703 { 811 {
704 if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Aborting) 812 if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Aborting)
705 { 813 {
814 m_interRegionTeleportAborts.Value++;
815
706 m_log.DebugFormat( 816 m_log.DebugFormat(
707 "[ENTITY TRANSFER MODULE]: Aborted teleport of {0} to {1} from {2} after UpdateAgent due to previous client close.", 817 "[ENTITY TRANSFER MODULE]: Aborted teleport of {0} to {1} from {2} after UpdateAgent due to previous client close.",
708 sp.Name, finalDestination.RegionName, sp.Scene.Name); 818 sp.Name, finalDestination.RegionName, sp.Scene.Name);
@@ -720,6 +830,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
720 830
721 if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Cancelling) 831 if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Cancelling)
722 { 832 {
833 m_interRegionTeleportCancels.Value++;
834
723 m_log.DebugFormat( 835 m_log.DebugFormat(
724 "[ENTITY TRANSFER MODULE]: Cancelled teleport of {0} to {1} from {2} after UpdateAgent on client request", 836 "[ENTITY TRANSFER MODULE]: Cancelled teleport of {0} to {1} from {2} after UpdateAgent on client request",
725 sp.Name, finalDestination.RegionName, sp.Scene.Name); 837 sp.Name, finalDestination.RegionName, sp.Scene.Name);
@@ -755,6 +867,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
755 { 867 {
756 if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Aborting) 868 if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Aborting)
757 { 869 {
870 m_interRegionTeleportAborts.Value++;
871
758 m_log.DebugFormat( 872 m_log.DebugFormat(
759 "[ENTITY TRANSFER MODULE]: Aborted teleport of {0} to {1} from {2} after WaitForAgentArrivedAtDestination due to previous client close.", 873 "[ENTITY TRANSFER MODULE]: Aborted teleport of {0} to {1} from {2} after WaitForAgentArrivedAtDestination due to previous client close.",
760 sp.Name, finalDestination.RegionName, sp.Scene.Name); 874 sp.Name, finalDestination.RegionName, sp.Scene.Name);
@@ -767,6 +881,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
767 sp.Name, finalDestination.RegionName, sp.Scene.RegionInfo.RegionName); 881 sp.Name, finalDestination.RegionName, sp.Scene.RegionInfo.RegionName);
768 882
769 Fail(sp, finalDestination, logout, "Destination region did not signal teleport completion."); 883 Fail(sp, finalDestination, logout, "Destination region did not signal teleport completion.");
884
770 return; 885 return;
771 } 886 }
772 887
@@ -808,15 +923,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
808 // now we have a child agent in this region. 923 // now we have a child agent in this region.
809 sp.Reset(); 924 sp.Reset();
810 } 925 }
811
812 // Commented pending deletion since this method no longer appears to do anything at all
813// // REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE!
814// if (sp.Scene.NeedSceneCacheClear(sp.UUID))
815// {
816// m_log.DebugFormat(
817// "[ENTITY TRANSFER MODULE]: User {0} is going to another region, profile cache removed",
818// sp.UUID);
819// }
820 } 926 }
821 927
822 /// <summary> 928 /// <summary>
@@ -852,6 +958,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
852 { 958 {
853 CleanupFailedInterRegionTeleport(sp, finalDestination); 959 CleanupFailedInterRegionTeleport(sp, finalDestination);
854 960
961 m_interRegionTeleportFailures.Value++;
962
855 sp.ControllingClient.SendTeleportFailed( 963 sp.ControllingClient.SendTeleportFailed(
856 string.Format( 964 string.Format(
857 "Problems connecting to destination {0}, reason: {1}", finalDestination.RegionName, reason)); 965 "Problems connecting to destination {0}, reason: {1}", finalDestination.RegionName, reason));
@@ -907,7 +1015,21 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
907 1015
908 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)
909 { 1017 {
910 return Util.IsOutsideView(drawdist, oldRegionX, newRegionX, oldRegionY, newRegionY); 1018 if (m_regionCombinerModule != null && m_regionCombinerModule.IsRootForMegaregion(Scene.RegionInfo.RegionID))
1019 {
1020 Vector2 swCorner, neCorner;
1021 GetMegaregionViewRange(out swCorner, out neCorner);
1022
1023 m_log.DebugFormat(
1024 "[ENTITY TRANSFER MODULE]: Megaregion view of {0} is from {1} to {2} with new agent check for {3},{4}",
1025 Scene.Name, swCorner, neCorner, newRegionX, newRegionY);
1026
1027 return !(newRegionX >= swCorner.X && newRegionX <= neCorner.X && newRegionY >= swCorner.Y && newRegionY <= neCorner.Y);
1028 }
1029 else
1030 {
1031 return Util.IsOutsideView(drawdist, oldRegionX, newRegionX, oldRegionY, newRegionY);
1032 }
911 } 1033 }
912 1034
913 protected virtual bool NeedsClosing(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, GridRegion reg) 1035 protected virtual bool NeedsClosing(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, GridRegion reg)
@@ -1011,6 +1133,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1011 { 1133 {
1012 version = String.Empty; 1134 version = String.Empty;
1013 newpos = new Vector3(pos.X, pos.Y, pos.Z); 1135 newpos = new Vector3(pos.X, pos.Y, pos.Z);
1136
1137// m_log.DebugFormat(
1138// "[ENTITY TRANSFER MODULE]: Crossing agent {0} at pos {1} in {2}", agent.Name, pos, scene.Name);
1139
1014 uint neighbourx = scene.RegionInfo.RegionLocX; 1140 uint neighbourx = scene.RegionInfo.RegionLocX;
1015 uint neighboury = scene.RegionInfo.RegionLocY; 1141 uint neighboury = scene.RegionInfo.RegionLocY;
1016 const float boundaryDistance = 1.7f; 1142 const float boundaryDistance = 1.7f;
@@ -1182,7 +1308,19 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1182 Scene initiatingScene) 1308 Scene initiatingScene)
1183 { 1309 {
1184 Thread.Sleep(10000); 1310 Thread.Sleep(10000);
1185 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 /*
1186 IMessageTransferModule im = initiatingScene.RequestModuleInterface<IMessageTransferModule>(); 1324 IMessageTransferModule im = initiatingScene.RequestModuleInterface<IMessageTransferModule>();
1187 if (im != null) 1325 if (im != null)
1188 { 1326 {
@@ -1217,6 +1355,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1217 }); 1355 });
1218 1356
1219 } 1357 }
1358 */
1220 } 1359 }
1221 1360
1222 private void InformClientToInitiateTeleportToLocationCompleted(IAsyncResult iar) 1361 private void InformClientToInitiateTeleportToLocationCompleted(IAsyncResult iar)
@@ -1725,6 +1864,37 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1725 } 1864 }
1726 1865
1727 /// <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>
1728 /// 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.
1729 /// </summary> 1899 /// </summary>
1730 /// <param name="pScene"></param> 1900 /// <param name="pScene"></param>
@@ -1736,15 +1906,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1736 Scene pScene = avatar.Scene; 1906 Scene pScene = avatar.Scene;
1737 RegionInfo m_regionInfo = pScene.RegionInfo; 1907 RegionInfo m_regionInfo = pScene.RegionInfo;
1738 1908
1739 Border[] northBorders = pScene.NorthBorders.ToArray();
1740 Border[] southBorders = pScene.SouthBorders.ToArray();
1741 Border[] eastBorders = pScene.EastBorders.ToArray();
1742 Border[] westBorders = pScene.WestBorders.ToArray();
1743
1744 // Leaving this as a "megaregions" computation vs "non-megaregions" computation; it isn't 1909 // Leaving this as a "megaregions" computation vs "non-megaregions" computation; it isn't
1745 // clear what should be done with a "far view" given that megaregions already extended the 1910 // clear what should be done with a "far view" given that megaregions already extended the
1746 // view to include everything in the megaregion 1911 // view to include everything in the megaregion
1747 if (northBorders.Length <= 1 && southBorders.Length <= 1 && eastBorders.Length <= 1 && westBorders.Length <= 1) 1912 if (m_regionCombinerModule == null || !m_regionCombinerModule.IsRootForMegaregion(Scene.RegionInfo.RegionID))
1748 { 1913 {
1749 int dd = avatar.DrawDistance < Constants.RegionSize ? (int)Constants.RegionSize : (int)avatar.DrawDistance; 1914 int dd = avatar.DrawDistance < Constants.RegionSize ? (int)Constants.RegionSize : (int)avatar.DrawDistance;
1750 1915
@@ -1762,27 +1927,17 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1762 } 1927 }
1763 else 1928 else
1764 { 1929 {
1765 Vector2 extent = Vector2.Zero; 1930 Vector2 swCorner, neCorner;
1766 for (int i = 0; i < eastBorders.Length; i++) 1931 GetMegaregionViewRange(out swCorner, out neCorner);
1767 {
1768 extent.X = (eastBorders[i].BorderLine.Z > extent.X) ? eastBorders[i].BorderLine.Z : extent.X;
1769 }
1770 for (int i = 0; i < northBorders.Length; i++)
1771 {
1772 extent.Y = (northBorders[i].BorderLine.Z > extent.Y) ? northBorders[i].BorderLine.Z : extent.Y;
1773 }
1774
1775 // Loss of fraction on purpose
1776 extent.X = ((int)extent.X / (int)Constants.RegionSize) + 1;
1777 extent.Y = ((int)extent.Y / (int)Constants.RegionSize) + 1;
1778
1779 int startX = (int)(pRegionLocX - 1) * (int)Constants.RegionSize;
1780 int startY = (int)(pRegionLocY - 1) * (int)Constants.RegionSize;
1781 1932
1782 int endX = ((int)pRegionLocX + (int)extent.X) * (int)Constants.RegionSize; 1933 List<GridRegion> neighbours
1783 int endY = ((int)pRegionLocY + (int)extent.Y) * (int)Constants.RegionSize; 1934 = pScene.GridService.GetRegionRange(
1935 m_regionInfo.ScopeID,
1936 (int)swCorner.X * (int)Constants.RegionSize,
1937 (int)neCorner.X * (int)Constants.RegionSize,
1938 (int)swCorner.Y * (int)Constants.RegionSize,
1939 (int)neCorner.Y * (int)Constants.RegionSize);
1784 1940
1785 List<GridRegion> neighbours = pScene.GridService.GetRegionRange(m_regionInfo.ScopeID, startX, endX, startY, endY);
1786 neighbours.RemoveAll(delegate(GridRegion r) { return r.RegionID == m_regionInfo.RegionID; }); 1941 neighbours.RemoveAll(delegate(GridRegion r) { return r.RegionID == m_regionInfo.RegionID; });
1787 1942
1788 return neighbours; 1943 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);