diff options
Diffstat (limited to '')
5 files changed, 79 insertions, 89 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 9306ace..7263b51 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -352,7 +352,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
352 | 352 | ||
353 | // the avatar.Close below will clear the child region list. We need this below for (possibly) | 353 | // the avatar.Close below will clear the child region list. We need this below for (possibly) |
354 | // closing the child agents, so save it here (we need a copy as it is Clear()-ed). | 354 | // closing the child agents, so save it here (we need a copy as it is Clear()-ed). |
355 | //List<ulong> childRegions = new List<ulong>(avatar.GetKnownRegionList()); | 355 | //List<ulong> childRegions = avatar.KnownRegionHandles; |
356 | // Compared to ScenePresence.CrossToNewRegion(), there's no obvious code to handle a teleport | 356 | // Compared to ScenePresence.CrossToNewRegion(), there's no obvious code to handle a teleport |
357 | // failure at this point (unlike a border crossing failure). So perhaps this can never fail | 357 | // failure at this point (unlike a border crossing failure). So perhaps this can never fail |
358 | // once we reach here... | 358 | // once we reach here... |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index cd4b14d..a432b6f 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -1135,9 +1135,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1135 | 1135 | ||
1136 | // Kick all ROOT agents with the message, 'The simulator is going down' | 1136 | // Kick all ROOT agents with the message, 'The simulator is going down' |
1137 | ForEachScenePresence(delegate(ScenePresence avatar) | 1137 | ForEachScenePresence(delegate(ScenePresence avatar) |
1138 | { | 1138 | { |
1139 | if (avatar.KnownChildRegionHandles.Contains(RegionInfo.RegionHandle)) | 1139 | avatar.RemoveNeighbourRegion(RegionInfo.RegionHandle); |
1140 | avatar.KnownChildRegionHandles.Remove(RegionInfo.RegionHandle); | ||
1141 | 1140 | ||
1142 | if (!avatar.IsChildAgent) | 1141 | if (!avatar.IsChildAgent) |
1143 | avatar.ControllingClient.Kick("The simulator is going down."); | 1142 | avatar.ControllingClient.Kick("The simulator is going down."); |
@@ -3225,14 +3224,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3225 | avatar.Scene.NeedSceneCacheClear(avatar.UUID); | 3224 | avatar.Scene.NeedSceneCacheClear(avatar.UUID); |
3226 | 3225 | ||
3227 | if (closeChildAgents && !avatar.IsChildAgent) | 3226 | if (closeChildAgents && !avatar.IsChildAgent) |
3228 | { | 3227 | { |
3229 | //List<ulong> childknownRegions = new List<ulong>(); | 3228 | List<ulong> regions = avatar.KnownRegionHandles; |
3230 | //List<ulong> ckn = avatar.KnownChildRegionHandles; | ||
3231 | //for (int i = 0; i < ckn.Count; i++) | ||
3232 | //{ | ||
3233 | // childknownRegions.Add(ckn[i]); | ||
3234 | //} | ||
3235 | List<ulong> regions = new List<ulong>(avatar.KnownChildRegionHandles); | ||
3236 | regions.Remove(RegionInfo.RegionHandle); | 3229 | regions.Remove(RegionInfo.RegionHandle); |
3237 | m_sceneGridService.SendCloseChildAgentConnections(agentID, regions); | 3230 | m_sceneGridService.SendCloseChildAgentConnections(agentID, regions); |
3238 | } | 3231 | } |
@@ -3313,7 +3306,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3313 | { | 3306 | { |
3314 | for (int i = 0; i < regionslst.Count; i++) | 3307 | for (int i = 0; i < regionslst.Count; i++) |
3315 | { | 3308 | { |
3316 | av.KnownChildRegionHandles.Remove(regionslst[i]); | 3309 | av.RemoveNeighbourRegion(regionslst[i]); |
3317 | } | 3310 | } |
3318 | } | 3311 | } |
3319 | } | 3312 | } |
@@ -3827,7 +3820,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3827 | 3820 | ||
3828 | if (RegionSecret == loggingOffUser.ControllingClient.SecureSessionId || (parsedsecret && RegionSecret == localRegionSecret)) | 3821 | if (RegionSecret == loggingOffUser.ControllingClient.SecureSessionId || (parsedsecret && RegionSecret == localRegionSecret)) |
3829 | { | 3822 | { |
3830 | m_sceneGridService.SendCloseChildAgentConnections(loggingOffUser.UUID, new List<ulong>(loggingOffUser.KnownRegions.Keys)); | 3823 | m_sceneGridService.SendCloseChildAgentConnections(loggingOffUser.UUID, loggingOffUser.KnownRegionHandles); |
3831 | loggingOffUser.ControllingClient.Kick(message); | 3824 | loggingOffUser.ControllingClient.Kick(message); |
3832 | // Give them a second to receive the message! | 3825 | // Give them a second to receive the message! |
3833 | Thread.Sleep(1000); | 3826 | Thread.Sleep(1000); |
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index 19cb0c1..fe9fe31 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs | |||
@@ -225,7 +225,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
225 | { | 225 | { |
226 | uint x = 0, y = 0; | 226 | uint x = 0, y = 0; |
227 | List<string> simulatorList = new List<string>(); | 227 | List<string> simulatorList = new List<string>(); |
228 | foreach (ulong regionHandle in presence.KnownChildRegionHandles) | 228 | foreach (ulong regionHandle in presence.KnownRegionHandles) |
229 | { | 229 | { |
230 | if (regionHandle != m_regionInfo.RegionHandle) | 230 | if (regionHandle != m_regionInfo.RegionHandle) |
231 | { | 231 | { |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 925a4f3..9e04aa1 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -243,11 +243,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
243 | } | 243 | } |
244 | } | 244 | } |
245 | 245 | ||
246 | |||
247 | // neighbouring regions we have enabled a child agent in | ||
248 | // holds the seed cap for the child agent in that region | ||
249 | private Dictionary<ulong, string> m_knownChildRegions = new Dictionary<ulong, string>(); | ||
250 | |||
251 | /// <summary> | 246 | /// <summary> |
252 | /// Copy of the script states while the agent is in transit. This state may | 247 | /// Copy of the script states while the agent is in transit. This state may |
253 | /// need to be placed back in case of transfer fail. | 248 | /// need to be placed back in case of transfer fail. |
@@ -699,29 +694,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
699 | set { m_health = value; } | 694 | set { m_health = value; } |
700 | } | 695 | } |
701 | 696 | ||
702 | /// <summary> | ||
703 | /// These are the region handles known by the avatar. | ||
704 | /// </summary> | ||
705 | public List<ulong> KnownChildRegionHandles | ||
706 | { | ||
707 | get | ||
708 | { | ||
709 | if (m_knownChildRegions.Count == 0) | ||
710 | return new List<ulong>(); | ||
711 | else | ||
712 | return new List<ulong>(m_knownChildRegions.Keys); | ||
713 | } | ||
714 | } | ||
715 | |||
716 | public Dictionary<ulong, string> KnownRegions | ||
717 | { | ||
718 | get { return m_knownChildRegions; } | ||
719 | set | ||
720 | { | ||
721 | m_knownChildRegions = value; | ||
722 | } | ||
723 | } | ||
724 | |||
725 | private ISceneViewer m_sceneViewer; | 697 | private ISceneViewer m_sceneViewer; |
726 | 698 | ||
727 | public ISceneViewer SceneViewer | 699 | public ISceneViewer SceneViewer |
@@ -1253,7 +1225,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1253 | public void StopFlying() | 1225 | public void StopFlying() |
1254 | { | 1226 | { |
1255 | ControllingClient.StopFlying(this); | 1227 | ControllingClient.StopFlying(this); |
1256 | } | 1228 | } |
1229 | |||
1230 | // neighbouring regions we have enabled a child agent in | ||
1231 | // holds the seed cap for the child agent in that region | ||
1232 | private Dictionary<ulong, string> m_knownChildRegions = new Dictionary<ulong, string>(); | ||
1257 | 1233 | ||
1258 | public void AddNeighbourRegion(ulong regionHandle, string cap) | 1234 | public void AddNeighbourRegion(ulong regionHandle, string cap) |
1259 | { | 1235 | { |
@@ -1269,14 +1245,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1269 | } | 1245 | } |
1270 | 1246 | ||
1271 | public void RemoveNeighbourRegion(ulong regionHandle) | 1247 | public void RemoveNeighbourRegion(ulong regionHandle) |
1272 | { | 1248 | { |
1273 | lock (m_knownChildRegions) | 1249 | lock (m_knownChildRegions) |
1274 | { | 1250 | { |
1275 | if (m_knownChildRegions.ContainsKey(regionHandle)) | 1251 | // Checking ContainsKey is redundant as Remove works either way and returns a bool |
1276 | { | 1252 | // This is here to allow the Debug output to be conditional on removal |
1277 | m_knownChildRegions.Remove(regionHandle); | 1253 | //if (m_knownChildRegions.ContainsKey(regionHandle)) |
1278 | //m_log.Debug(" !!! removing known region {0} in {1}. Count = {2}", regionHandle, Scene.RegionInfo.RegionName, m_knownChildRegions.Count); | 1254 | // m_log.DebugFormat(" !!! removing known region {0} in {1}. Count = {2}", regionHandle, Scene.RegionInfo.RegionName, m_knownChildRegions.Count); |
1279 | } | 1255 | m_knownChildRegions.Remove(regionHandle); |
1280 | } | 1256 | } |
1281 | } | 1257 | } |
1282 | 1258 | ||
@@ -1287,11 +1263,39 @@ namespace OpenSim.Region.Framework.Scenes | |||
1287 | RemoveNeighbourRegion(handle); | 1263 | RemoveNeighbourRegion(handle); |
1288 | Scene.CapsModule.DropChildSeed(UUID, handle); | 1264 | Scene.CapsModule.DropChildSeed(UUID, handle); |
1289 | } | 1265 | } |
1290 | } | 1266 | } |
1291 | 1267 | ||
1292 | public List<ulong> GetKnownRegionList() | 1268 | public Dictionary<ulong, string> KnownRegions |
1293 | { | 1269 | { |
1294 | return new List<ulong>(m_knownChildRegions.Keys); | 1270 | get |
1271 | { | ||
1272 | lock (m_knownChildRegions) | ||
1273 | return new Dictionary<ulong, string>(m_knownChildRegions); | ||
1274 | } | ||
1275 | set | ||
1276 | { | ||
1277 | // Replacing the reference is atomic but we still need to lock on | ||
1278 | // the original dictionary object which may be in use elsewhere | ||
1279 | lock (m_knownChildRegions) | ||
1280 | m_knownChildRegions = value; | ||
1281 | } | ||
1282 | } | ||
1283 | |||
1284 | public List<ulong> KnownRegionHandles | ||
1285 | { | ||
1286 | get | ||
1287 | { | ||
1288 | return new List<ulong>(KnownRegions.Keys); | ||
1289 | } | ||
1290 | } | ||
1291 | |||
1292 | public int KnownRegionCount | ||
1293 | { | ||
1294 | get | ||
1295 | { | ||
1296 | lock (m_knownChildRegions) | ||
1297 | return m_knownChildRegions.Count; | ||
1298 | } | ||
1295 | } | 1299 | } |
1296 | 1300 | ||
1297 | #endregion | 1301 | #endregion |
@@ -3082,7 +3086,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3082 | 3086 | ||
3083 | // Throttles | 3087 | // Throttles |
3084 | float multiplier = 1; | 3088 | float multiplier = 1; |
3085 | int childRegions = m_knownChildRegions.Count; | 3089 | int childRegions = KnownRegionCount; |
3086 | if (childRegions != 0) | 3090 | if (childRegions != 0) |
3087 | multiplier = 1f / childRegions; | 3091 | multiplier = 1f / childRegions; |
3088 | 3092 | ||
@@ -3334,30 +3338,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
3334 | /// <returns></returns> | 3338 | /// <returns></returns> |
3335 | public void CloseChildAgents(uint newRegionX, uint newRegionY) | 3339 | public void CloseChildAgents(uint newRegionX, uint newRegionY) |
3336 | { | 3340 | { |
3337 | List<ulong> byebyeRegions = new List<ulong>(); | 3341 | List<ulong> byebyeRegions = new List<ulong>(); |
3342 | List<ulong> knownRegions = KnownRegionHandles; | ||
3338 | m_log.DebugFormat( | 3343 | m_log.DebugFormat( |
3339 | "[SCENE PRESENCE]: Closing child agents. Checking {0} regions in {1}", | 3344 | "[SCENE PRESENCE]: Closing child agents. Checking {0} regions in {1}", |
3340 | m_knownChildRegions.Keys.Count, Scene.RegionInfo.RegionName); | 3345 | knownRegions.Count, Scene.RegionInfo.RegionName); |
3341 | //DumpKnownRegions(); | 3346 | //DumpKnownRegions(); |
3342 | 3347 | ||
3343 | lock (m_knownChildRegions) | 3348 | foreach (ulong handle in knownRegions) |
3344 | { | 3349 | { |
3345 | foreach (ulong handle in m_knownChildRegions.Keys) | 3350 | // Don't close the agent on this region yet |
3351 | if (handle != Scene.RegionInfo.RegionHandle) | ||
3346 | { | 3352 | { |
3347 | // Don't close the agent on this region yet | 3353 | uint x, y; |
3348 | if (handle != Scene.RegionInfo.RegionHandle) | 3354 | Utils.LongToUInts(handle, out x, out y); |
3355 | x = x / Constants.RegionSize; | ||
3356 | y = y / Constants.RegionSize; | ||
3357 | |||
3358 | //m_log.Debug("---> x: " + x + "; newx:" + newRegionX + "; Abs:" + (int)Math.Abs((int)(x - newRegionX))); | ||
3359 | //m_log.Debug("---> y: " + y + "; newy:" + newRegionY + "; Abs:" + (int)Math.Abs((int)(y - newRegionY))); | ||
3360 | if (Util.IsOutsideView(DrawDistance, x, newRegionX, y, newRegionY)) | ||
3349 | { | 3361 | { |
3350 | uint x, y; | 3362 | byebyeRegions.Add(handle); |
3351 | Utils.LongToUInts(handle, out x, out y); | ||
3352 | x = x / Constants.RegionSize; | ||
3353 | y = y / Constants.RegionSize; | ||
3354 | |||
3355 | //m_log.Debug("---> x: " + x + "; newx:" + newRegionX + "; Abs:" + (int)Math.Abs((int)(x - newRegionX))); | ||
3356 | //m_log.Debug("---> y: " + y + "; newy:" + newRegionY + "; Abs:" + (int)Math.Abs((int)(y - newRegionY))); | ||
3357 | if (Util.IsOutsideView(DrawDistance, x, newRegionX, y, newRegionY)) | ||
3358 | { | ||
3359 | byebyeRegions.Add(handle); | ||
3360 | } | ||
3361 | } | 3363 | } |
3362 | } | 3364 | } |
3363 | } | 3365 | } |
@@ -3475,7 +3477,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3475 | 3477 | ||
3476 | // Throttles | 3478 | // Throttles |
3477 | float multiplier = 1; | 3479 | float multiplier = 1; |
3478 | int childRegions = m_knownChildRegions.Count; | 3480 | int childRegions = KnownRegionCount; |
3479 | if (childRegions != 0) | 3481 | if (childRegions != 0) |
3480 | multiplier = 1f / childRegions; | 3482 | multiplier = 1f / childRegions; |
3481 | 3483 | ||
@@ -3939,12 +3941,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
3939 | public void Close() | 3941 | public void Close() |
3940 | { | 3942 | { |
3941 | if (!IsChildAgent) | 3943 | if (!IsChildAgent) |
3942 | m_scene.AttachmentsModule.DeleteAttachmentsFromScene(this, false); | 3944 | m_scene.AttachmentsModule.DeleteAttachmentsFromScene(this, false); |
3943 | 3945 | ||
3944 | lock (m_knownChildRegions) | 3946 | // Clear known regions |
3945 | { | 3947 | KnownRegions = new Dictionary<ulong, string>(); |
3946 | m_knownChildRegions.Clear(); | ||
3947 | } | ||
3948 | 3948 | ||
3949 | lock (m_reprioritization_timer) | 3949 | lock (m_reprioritization_timer) |
3950 | { | 3950 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs index ce9d418..119eb1f 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs | |||
@@ -215,11 +215,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
215 | string cap = presence.ControllingClient.RequestClientInfo().CapsPath; | 215 | string cap = presence.ControllingClient.RequestClientInfo().CapsPath; |
216 | 216 | ||
217 | presence.AddNeighbourRegion(region2, cap); | 217 | presence.AddNeighbourRegion(region2, cap); |
218 | presence.AddNeighbourRegion(region3, cap); | 218 | presence.AddNeighbourRegion(region3, cap); |
219 | 219 | ||
220 | List<ulong> neighbours = presence.GetKnownRegionList(); | 220 | Assert.That(presence.KnownRegionCount, Is.EqualTo(2)); |
221 | |||
222 | Assert.That(neighbours.Count, Is.EqualTo(2)); | ||
223 | } | 221 | } |
224 | 222 | ||
225 | [Test] | 223 | [Test] |
@@ -230,8 +228,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
230 | ScenePresence presence = scene.GetScenePresence(agent1); | 228 | ScenePresence presence = scene.GetScenePresence(agent1); |
231 | presence.RemoveNeighbourRegion(region3); | 229 | presence.RemoveNeighbourRegion(region3); |
232 | 230 | ||
233 | List<ulong> neighbours = presence.GetKnownRegionList(); | 231 | Assert.That(presence.KnownRegionCount,Is.EqualTo(1)); |
234 | Assert.That(neighbours.Count,Is.EqualTo(1)); | ||
235 | /* | 232 | /* |
236 | presence.MakeChildAgent; | 233 | presence.MakeChildAgent; |
237 | presence.MakeRootAgent; | 234 | presence.MakeRootAgent; |