diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 26 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs | 26 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/ScenePresence.cs | 23 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Types/UpdateQueue.cs | 11 |
4 files changed, 77 insertions, 9 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 36e98cf..4f44d36 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -1479,7 +1479,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
1479 | m_sceneGridService.LogOffUser(agentID, RegionInfo.RegionID, RegionInfo.RegionHandle, | 1479 | m_sceneGridService.LogOffUser(agentID, RegionInfo.RegionID, RegionInfo.RegionHandle, |
1480 | avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y, | 1480 | avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y, |
1481 | avatar.AbsolutePosition.Z); | 1481 | avatar.AbsolutePosition.Z); |
1482 | m_sceneGridService.SendCloseChildAgentConnections(avatar); | 1482 | List<ulong> childknownRegions = new List<ulong>(); |
1483 | List<ulong> ckn = avatar.GetKnownRegionList(); | ||
1484 | for (int i = 0; i < ckn.Count; i++) | ||
1485 | { | ||
1486 | childknownRegions.Add(ckn[i]); | ||
1487 | } | ||
1488 | m_sceneGridService.SendCloseChildAgentConnections(agentID, childknownRegions); | ||
1483 | } | 1489 | } |
1484 | 1490 | ||
1485 | m_eventManager.TriggerClientClosed(agentID); | 1491 | m_eventManager.TriggerClientClosed(agentID); |
@@ -1554,6 +1560,22 @@ namespace OpenSim.Region.Environment.Scenes | |||
1554 | //m_log.InfoFormat("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false)); | 1560 | //m_log.InfoFormat("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false)); |
1555 | //m_log.InfoFormat("[SCENE] Memory post GC {0}", System.GC.GetTotalMemory(true)); | 1561 | //m_log.InfoFormat("[SCENE] Memory post GC {0}", System.GC.GetTotalMemory(true)); |
1556 | } | 1562 | } |
1563 | public void HandleRemoveKnownRegionsFromAvatar(LLUUID avatarID, List<ulong> regionslst) | ||
1564 | { | ||
1565 | ScenePresence av = GetScenePresence(avatarID); | ||
1566 | if (av != null) | ||
1567 | { | ||
1568 | lock (av) | ||
1569 | { | ||
1570 | |||
1571 | for (int i = 0; i < regionslst.Count; i++) | ||
1572 | { | ||
1573 | av.KnownChildRegions.Remove(regionslst[i]); | ||
1574 | } | ||
1575 | } | ||
1576 | } | ||
1577 | |||
1578 | } | ||
1557 | 1579 | ||
1558 | public override void CloseAllAgents(uint circuitcode) | 1580 | public override void CloseAllAgents(uint circuitcode) |
1559 | { | 1581 | { |
@@ -1607,6 +1629,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1607 | m_sceneGridService.OnRegionUp += OtherRegionUp; | 1629 | m_sceneGridService.OnRegionUp += OtherRegionUp; |
1608 | m_sceneGridService.OnChildAgentUpdate += IncomingChildAgentDataUpdate; | 1630 | m_sceneGridService.OnChildAgentUpdate += IncomingChildAgentDataUpdate; |
1609 | m_sceneGridService.OnExpectPrim += IncomingInterRegionPrimGroup; | 1631 | m_sceneGridService.OnExpectPrim += IncomingInterRegionPrimGroup; |
1632 | m_sceneGridService.OnRemoveKnownRegionFromAvatar += HandleRemoveKnownRegionsFromAvatar; | ||
1610 | 1633 | ||
1611 | 1634 | ||
1612 | 1635 | ||
@@ -1620,6 +1643,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1620 | /// </summary> | 1643 | /// </summary> |
1621 | public void UnRegisterReginWithComms() | 1644 | public void UnRegisterReginWithComms() |
1622 | { | 1645 | { |
1646 | m_sceneGridService.OnRemoveKnownRegionFromAvatar -= HandleRemoveKnownRegionsFromAvatar; | ||
1623 | m_sceneGridService.OnExpectPrim -= IncomingInterRegionPrimGroup; | 1647 | m_sceneGridService.OnExpectPrim -= IncomingInterRegionPrimGroup; |
1624 | m_sceneGridService.OnChildAgentUpdate -= IncomingChildAgentDataUpdate; | 1648 | m_sceneGridService.OnChildAgentUpdate -= IncomingChildAgentDataUpdate; |
1625 | m_sceneGridService.OnRegionUp -= OtherRegionUp; | 1649 | m_sceneGridService.OnRegionUp -= OtherRegionUp; |
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 |
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 1767623..4f68817 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs | |||
@@ -617,6 +617,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
617 | } | 617 | } |
618 | } | 618 | } |
619 | 619 | ||
620 | public List<ulong> GetKnownRegionList() | ||
621 | { | ||
622 | return m_knownChildRegions; | ||
623 | } | ||
624 | |||
620 | #endregion | 625 | #endregion |
621 | 626 | ||
622 | #region Event Handlers | 627 | #region Event Handlers |
@@ -1767,7 +1772,25 @@ namespace OpenSim.Region.Environment.Scenes | |||
1767 | 1772 | ||
1768 | internal void Close() | 1773 | internal void Close() |
1769 | { | 1774 | { |
1775 | lock (m_knownPrimUUID) | ||
1776 | { | ||
1777 | m_knownPrimUUID.Clear(); | ||
1778 | } | ||
1779 | lock (m_knownChildRegions) | ||
1780 | { | ||
1781 | m_knownChildRegions.Clear(); | ||
1782 | } | ||
1783 | lock (m_updateTimes) | ||
1784 | { | ||
1785 | m_updateTimes.Clear(); | ||
1786 | } | ||
1787 | lock (m_partsUpdateQueue) | ||
1788 | { | ||
1789 | m_partsUpdateQueue.Clear(); | ||
1790 | } | ||
1791 | |||
1770 | RemoveFromPhysicalScene(); | 1792 | RemoveFromPhysicalScene(); |
1793 | GC.Collect(); | ||
1771 | } | 1794 | } |
1772 | } | 1795 | } |
1773 | } | 1796 | } |
diff --git a/OpenSim/Region/Environment/Types/UpdateQueue.cs b/OpenSim/Region/Environment/Types/UpdateQueue.cs index 0648476..90b7e73 100644 --- a/OpenSim/Region/Environment/Types/UpdateQueue.cs +++ b/OpenSim/Region/Environment/Types/UpdateQueue.cs | |||
@@ -48,6 +48,17 @@ namespace OpenSim.Region.Environment.Types | |||
48 | m_queue = new Queue<SceneObjectPart>(); | 48 | m_queue = new Queue<SceneObjectPart>(); |
49 | m_ids = new List<LLUUID>(); | 49 | m_ids = new List<LLUUID>(); |
50 | } | 50 | } |
51 | public void Clear() | ||
52 | { | ||
53 | lock (m_ids) | ||
54 | { | ||
55 | m_ids.Clear(); | ||
56 | } | ||
57 | lock (m_queue) | ||
58 | { | ||
59 | m_queue.Clear(); | ||
60 | } | ||
61 | } | ||
51 | 62 | ||
52 | public void Enqueue(SceneObjectPart part) | 63 | public void Enqueue(SceneObjectPart part) |
53 | { | 64 | { |