aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
diff options
context:
space:
mode:
authorTeravus Ovares2008-02-20 01:17:21 +0000
committerTeravus Ovares2008-02-20 01:17:21 +0000
commitb77c48e75e5027eb8ae421e9d3105eae71cd4f52 (patch)
tree1cb66947b0628a1909a5350811609435ed83e4a4 /OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
parent* Made a quickupdate method to run through only entities that have scheduled ... (diff)
downloadopensim-SC_OLD-b77c48e75e5027eb8ae421e9d3105eae71cd4f52.zip
opensim-SC_OLD-b77c48e75e5027eb8ae421e9d3105eae71cd4f52.tar.gz
opensim-SC_OLD-b77c48e75e5027eb8ae421e9d3105eae71cd4f52.tar.bz2
opensim-SC_OLD-b77c48e75e5027eb8ae421e9d3105eae71cd4f52.tar.xz
* Cleanup of some memory consuming items on ScenePresence.Close().
* Untangled a tangly shutdown loop for the ScenePresence. * Suggested to the Garbage Collector that this may be a good time to >.>, <.< *gasp* collect the memory.
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs')
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs26
1 files changed, 18 insertions, 8 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
index 4cf93ed..e51438d 100644
--- a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
@@ -38,6 +38,8 @@ namespace OpenSim.Region.Environment.Scenes
38{ 38{
39 public delegate void KillObjectDelegate(uint localID); 39 public delegate void KillObjectDelegate(uint localID);
40 40
41 public delegate void RemoveKnownRegionsFromAvatarList(LLUUID avatarID, List<ulong> regionlst);
42
41 public class SceneCommunicationService //one instance per region 43 public class SceneCommunicationService //one instance per region
42 { 44 {
43 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); 45 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
@@ -54,6 +56,7 @@ namespace OpenSim.Region.Environment.Scenes
54 public event PrimCrossing OnPrimCrossingIntoRegion; 56 public event PrimCrossing OnPrimCrossingIntoRegion;
55 public event RegionUp OnRegionUp; 57 public event RegionUp OnRegionUp;
56 public event ChildAgentUpdate OnChildAgentUpdate; 58 public event ChildAgentUpdate OnChildAgentUpdate;
59 public event RemoveKnownRegionsFromAvatarList OnRemoveKnownRegionFromAvatar;
57 60
58 61
59 62
@@ -393,23 +396,23 @@ namespace OpenSim.Region.Environment.Scenes
393 d); 396 d);
394 } 397 }
395 398
396 public delegate void SendCloseChildAgentDelegate( ScenePresence presence); 399 public delegate void SendCloseChildAgentDelegate( LLUUID agentID, List<ulong> regionlst);
397 400
398 /// <summary> 401 /// <summary>
399 /// This Closes child agents on neighboring regions 402 /// This Closes child agents on neighboring regions
400 /// Calls an asynchronous method to do so.. so it doesn't lag the sim. 403 /// Calls an asynchronous method to do so.. so it doesn't lag the sim.
401 /// </summary> 404 /// </summary>
402 private void SendCloseChildAgentAsync(ScenePresence presence) 405 private void SendCloseChildAgentAsync(LLUUID agentID, List<ulong> regionlst)
403 { 406 {
404 407
405 foreach (ulong regionHandle in presence.KnownChildRegions) 408 foreach (ulong regionHandle in regionlst)
406 { 409 {
407 bool regionAccepted = m_commsProvider.InterRegion.TellRegionToCloseChildConnection(regionHandle, presence.ControllingClient.AgentId); 410 bool regionAccepted = m_commsProvider.InterRegion.TellRegionToCloseChildConnection(regionHandle, agentID);
408 411
409 if (regionAccepted) 412 if (regionAccepted)
410 { 413 {
411 m_log.Info("[INTERGRID]: Completed sending agent Close agent Request to neighbor"); 414 m_log.Info("[INTERGRID]: Completed sending agent Close agent Request to neighbor");
412 presence.RemoveNeighbourRegion(regionHandle); 415
413 } 416 }
414 else 417 else
415 { 418 {
@@ -418,6 +421,13 @@ namespace OpenSim.Region.Environment.Scenes
418 } 421 }
419 422
420 } 423 }
424 // We remove the list of known regions from the agent's known region list through an event
425 // to scene, because, if an agent logged of, it's likely that there will be no scene presence
426 // by the time we get to this part of the method.
427 if (OnRemoveKnownRegionFromAvatar != null)
428 {
429 OnRemoveKnownRegionFromAvatar(agentID,regionlst);
430 }
421 } 431 }
422 432
423 private void SendCloseChildAgentCompleted(IAsyncResult iar) 433 private void SendCloseChildAgentCompleted(IAsyncResult iar)
@@ -426,11 +436,11 @@ namespace OpenSim.Region.Environment.Scenes
426 icon.EndInvoke(iar); 436 icon.EndInvoke(iar);
427 } 437 }
428 438
429 public void SendCloseChildAgentConnections(ScenePresence presence) 439 public void SendCloseChildAgentConnections(LLUUID agentID, List<ulong> regionslst)
430 { 440 {
431 // This assumes that we know what our neighbors are. 441 // This assumes that we know what our neighbors are.
432 SendCloseChildAgentDelegate d = SendCloseChildAgentAsync; 442 SendCloseChildAgentDelegate d = SendCloseChildAgentAsync;
433 d.BeginInvoke(presence, 443 d.BeginInvoke(agentID, regionslst,
434 SendCloseChildAgentCompleted, 444 SendCloseChildAgentCompleted,
435 d); 445 d);
436 } 446 }
@@ -522,7 +532,7 @@ namespace OpenSim.Region.Environment.Scenes
522 uint oldRegionY = (((uint)(m_regionInfo.RegionHandle)) >> 8); 532 uint oldRegionY = (((uint)(m_regionInfo.RegionHandle)) >> 8);
523 if (Util.fast_distance2d((int)(newRegionX - oldRegionX), (int)(newRegionY - oldRegionY)) > 3) 533 if (Util.fast_distance2d((int)(newRegionX - oldRegionX), (int)(newRegionY - oldRegionY)) > 3)
524 { 534 {
525 SendCloseChildAgentConnections(avatar); 535 SendCloseChildAgentConnections(avatar.UUID,avatar.GetKnownRegionList());
526 } 536 }
527 } 537 }
528 else 538 else