aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/ScenePresence.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs134
1 files changed, 67 insertions, 67 deletions
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 {