diff options
author | UbitUmarov | 2017-05-31 23:31:02 +0100 |
---|---|---|
committer | UbitUmarov | 2017-05-31 23:31:02 +0100 |
commit | c68e7b66218a6f85fdca71be2740bf9a15e92f37 (patch) | |
tree | 47c76a43f7bcc0543ece9d8efe880e09bac27345 /OpenSim | |
parent | mantis 8182: update/fix GenerateRandomAnimation(). not updating libomv avatar... (diff) | |
download | opensim-SC-c68e7b66218a6f85fdca71be2740bf9a15e92f37.zip opensim-SC-c68e7b66218a6f85fdca71be2740bf9a15e92f37.tar.gz opensim-SC-c68e7b66218a6f85fdca71be2740bf9a15e92f37.tar.bz2 opensim-SC-c68e7b66218a6f85fdca71be2740bf9a15e92f37.tar.xz |
change child agents close control; disablesimulator is not a caps event message
Diffstat (limited to 'OpenSim')
6 files changed, 128 insertions, 164 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs index 1feece1..7c9a1c4 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs | |||
@@ -500,13 +500,13 @@ namespace OpenSim.Region.ClientStack.Linden | |||
500 | responsedata["http_protocol_version"] = "HTTP/1.0"; | 500 | responsedata["http_protocol_version"] = "HTTP/1.0"; |
501 | return responsedata; | 501 | return responsedata; |
502 | } | 502 | } |
503 | 503 | /* this is not a event message | |
504 | public void DisableSimulator(ulong handle, UUID avatarID) | 504 | public void DisableSimulator(ulong handle, UUID avatarID) |
505 | { | 505 | { |
506 | OSD item = EventQueueHelper.DisableSimulator(handle); | 506 | OSD item = EventQueueHelper.DisableSimulator(handle); |
507 | Enqueue(item, avatarID); | 507 | Enqueue(item, avatarID); |
508 | } | 508 | } |
509 | 509 | */ | |
510 | public virtual void EnableSimulator(ulong handle, IPEndPoint endPoint, UUID avatarID, int regionSizeX, int regionSizeY) | 510 | public virtual void EnableSimulator(ulong handle, IPEndPoint endPoint, UUID avatarID, int regionSizeX, int regionSizeY) |
511 | { | 511 | { |
512 | if (DebugLevel > 0) | 512 | if (DebugLevel > 0) |
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs index e1e88ae..461f776 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs | |||
@@ -90,7 +90,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
90 | 90 | ||
91 | return BuildEvent("EnableSimulator", llsdBody); | 91 | return BuildEvent("EnableSimulator", llsdBody); |
92 | } | 92 | } |
93 | 93 | /* | |
94 | public static OSD DisableSimulator(ulong handle) | 94 | public static OSD DisableSimulator(ulong handle) |
95 | { | 95 | { |
96 | //OSDMap llsdSimInfo = new OSDMap(1); | 96 | //OSDMap llsdSimInfo = new OSDMap(1); |
@@ -105,7 +105,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
105 | 105 | ||
106 | return BuildEvent("DisableSimulator", llsdBody); | 106 | return BuildEvent("DisableSimulator", llsdBody); |
107 | } | 107 | } |
108 | 108 | */ | |
109 | public static OSD CrossRegion(ulong handle, Vector3 pos, Vector3 lookAt, | 109 | public static OSD CrossRegion(ulong handle, Vector3 pos, Vector3 lookAt, |
110 | IPEndPoint newRegionExternalEndPoint, | 110 | IPEndPoint newRegionExternalEndPoint, |
111 | string capsURL, UUID agentID, UUID sessionID, | 111 | string capsURL, UUID agentID, UUID sessionID, |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index a1ada4c..bcf4322 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -843,6 +843,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
843 | sp.Name, Scene.Name, finalDestination.RegionName); | 843 | sp.Name, Scene.Name, finalDestination.RegionName); |
844 | 844 | ||
845 | string capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); | 845 | string capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); |
846 | List<ulong> childRegionsToClose = sp.GetChildAgentsToClose(destinationHandle, finalDestination.RegionSizeX, finalDestination.RegionSizeY); | ||
847 | foreach(ulong handler in childRegionsToClose) | ||
848 | { | ||
849 | agentCircuit.ChildrenCapSeeds.Remove(handler); | ||
850 | } | ||
846 | 851 | ||
847 | // Let's create an agent there if one doesn't exist yet. | 852 | // Let's create an agent there if one doesn't exist yet. |
848 | // NOTE: logout will always be false for a non-HG teleport. | 853 | // NOTE: logout will always be false for a non-HG teleport. |
@@ -1026,7 +1031,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1026 | return; | 1031 | return; |
1027 | } | 1032 | } |
1028 | 1033 | ||
1029 | |||
1030 | /* | 1034 | /* |
1031 | // TODO: This may be 0.6. Check if still needed | 1035 | // TODO: This may be 0.6. Check if still needed |
1032 | // For backwards compatibility | 1036 | // For backwards compatibility |
@@ -1040,7 +1044,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1040 | 1044 | ||
1041 | m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.CleaningUp); | 1045 | m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.CleaningUp); |
1042 | 1046 | ||
1043 | sp.CloseChildAgents(logout, destinationHandle, finalDestination.RegionSizeX, finalDestination.RegionSizeY); | 1047 | if(logout) |
1048 | sp.closeAllChildAgents(); | ||
1049 | else | ||
1050 | sp.CloseChildAgents(childRegionsToClose); | ||
1044 | 1051 | ||
1045 | // call HG hook | 1052 | // call HG hook |
1046 | AgentHasMovedAway(sp, logout); | 1053 | AgentHasMovedAway(sp, logout); |
@@ -1066,9 +1073,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1066 | // This sleep can be increased if necessary. However, whilst it's active, | 1073 | // This sleep can be increased if necessary. However, whilst it's active, |
1067 | // an agent cannot teleport back to this region if it has teleported away. | 1074 | // an agent cannot teleport back to this region if it has teleported away. |
1068 | Thread.Sleep(2000); | 1075 | Thread.Sleep(2000); |
1069 | // if (m_eqModule != null && !sp.DoNotCloseAfterTeleport) | ||
1070 | // m_eqModule.DisableSimulator(sourceRegionHandle,sp.UUID); | ||
1071 | Thread.Sleep(500); | ||
1072 | sp.Scene.CloseAgent(sp.UUID, false); | 1076 | sp.Scene.CloseAgent(sp.UUID, false); |
1073 | } | 1077 | } |
1074 | sp.IsInTransit = false; | 1078 | sp.IsInTransit = false; |
@@ -1078,7 +1082,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1078 | IPEndPoint endPoint, uint teleportFlags, bool OutSideViewRange, EntityTransferContext ctx, out string reason) | 1082 | IPEndPoint endPoint, uint teleportFlags, bool OutSideViewRange, EntityTransferContext ctx, out string reason) |
1079 | { | 1083 | { |
1080 | ulong destinationHandle = finalDestination.RegionHandle; | 1084 | ulong destinationHandle = finalDestination.RegionHandle; |
1081 | AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); | 1085 | |
1086 | List<ulong> childRegionsToClose = sp.GetChildAgentsToClose(destinationHandle, finalDestination.RegionSizeX, finalDestination.RegionSizeY); | ||
1087 | foreach(ulong handler in childRegionsToClose) | ||
1088 | { | ||
1089 | agentCircuit.ChildrenCapSeeds.Remove(handler); | ||
1090 | } | ||
1082 | 1091 | ||
1083 | string capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath);; | 1092 | string capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath);; |
1084 | 1093 | ||
@@ -1178,20 +1187,17 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1178 | "[ENTITY TRANSFER MODULE]: UpdateAgent failed on teleport of {0} to {1}. Keeping avatar in {2}", | 1187 | "[ENTITY TRANSFER MODULE]: UpdateAgent failed on teleport of {0} to {1}. Keeping avatar in {2}", |
1179 | sp.Name, finalDestination.RegionName, sp.Scene.Name); | 1188 | sp.Name, finalDestination.RegionName, sp.Scene.Name); |
1180 | 1189 | ||
1181 | Fail(sp, finalDestination, logout, currentAgentCircuit.SessionID.ToString(), "Connection between viewer and destination region could not be established."); | 1190 | Fail(sp, finalDestination, logout, agentCircuit.SessionID.ToString(), "Connection between viewer and destination region could not be established."); |
1182 | sp.IsInTransit = false; | 1191 | sp.IsInTransit = false; |
1183 | return; | 1192 | return; |
1184 | } | 1193 | } |
1185 | 1194 | ||
1186 | m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.CleaningUp); | 1195 | m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.CleaningUp); |
1187 | 1196 | ||
1188 | // Need to signal neighbours whether child agents may need closing irrespective of whether this | 1197 | if(logout) |
1189 | // one needed closing. We also need to close child agents as quickly as possible to avoid complicated | 1198 | sp.closeAllChildAgents(); |
1190 | // race conditions with rapid agent releporting (e.g. from A1 to a non-neighbour B, back | 1199 | else |
1191 | // to a neighbour A2 then off to a non-neighbour C). Closing child agents any later requires complex | 1200 | sp.CloseChildAgents(childRegionsToClose); |
1192 | // distributed checks to avoid problems in rapid reteleporting scenarios and where child agents are | ||
1193 | // abandoned without proper close by viewer but then re-used by an incoming connection. | ||
1194 | sp.CloseChildAgents(logout, destinationHandle, finalDestination.RegionSizeX, finalDestination.RegionSizeY); | ||
1195 | 1201 | ||
1196 | sp.HasMovedAway(!(OutSideViewRange || logout)); | 1202 | sp.HasMovedAway(!(OutSideViewRange || logout)); |
1197 | 1203 | ||
@@ -1217,10 +1223,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1217 | // DECREASING THE WAIT TIME HERE WILL EITHER RESULT IN A VIEWER CRASH OR | 1223 | // DECREASING THE WAIT TIME HERE WILL EITHER RESULT IN A VIEWER CRASH OR |
1218 | // IN THE AVIE BEING PLACED IN INFINITY FOR A COUPLE OF SECONDS. | 1224 | // IN THE AVIE BEING PLACED IN INFINITY FOR A COUPLE OF SECONDS. |
1219 | 1225 | ||
1220 | Thread.Sleep(25000); | 1226 | Thread.Sleep(15000); |
1221 | // if (m_eqModule != null && !sp.DoNotCloseAfterTeleport) | ||
1222 | // m_eqModule.DisableSimulator(sourceRegionHandle,sp.UUID); | ||
1223 | // Thread.Sleep(1000); | ||
1224 | 1227 | ||
1225 | // OK, it got this agent. Let's close everything | 1228 | // OK, it got this agent. Let's close everything |
1226 | // If we shouldn't close the agent due to some other region renewing the connection | 1229 | // If we shouldn't close the agent due to some other region renewing the connection |
@@ -1230,13 +1233,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1230 | 1233 | ||
1231 | sp.Scene.CloseAgent(sp.UUID, false); | 1234 | sp.Scene.CloseAgent(sp.UUID, false); |
1232 | } | 1235 | } |
1233 | /* | ||
1234 | else | ||
1235 | { | ||
1236 | // now we have a child agent in this region. | ||
1237 | sp.Reset(); | ||
1238 | } | ||
1239 | */ | ||
1240 | sp.IsInTransit = false; | 1236 | sp.IsInTransit = false; |
1241 | } | 1237 | } |
1242 | 1238 | ||
@@ -1641,54 +1637,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1641 | icon.EndInvoke(iar); | 1637 | icon.EndInvoke(iar); |
1642 | } | 1638 | } |
1643 | 1639 | ||
1644 | |||
1645 | |||
1646 | /// <summary> | ||
1647 | /// This Closes child agents on neighbouring regions | ||
1648 | /// Calls an asynchronous method to do so.. so it doesn't lag the sim. | ||
1649 | /// </summary> | ||
1650 | public ScenePresence CrossAgentToNewRegionAsync( | ||
1651 | ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, | ||
1652 | bool isFlying, EntityTransferContext ctx) | ||
1653 | { | ||
1654 | try | ||
1655 | { | ||
1656 | m_log.DebugFormat("{0}: CrossAgentToNewRegionAsync: new region={1} at <{2},{3}>. newpos={4}", | ||
1657 | LogHeader, neighbourRegion.RegionName, neighbourRegion.RegionLocX, neighbourRegion.RegionLocY, pos); | ||
1658 | |||
1659 | if (neighbourRegion == null) | ||
1660 | { | ||
1661 | m_log.DebugFormat("{0}: CrossAgentToNewRegionAsync: invalid destiny", LogHeader); | ||
1662 | return agent; | ||
1663 | } | ||
1664 | |||
1665 | IPEndPoint endpoint = neighbourRegion.ExternalEndPoint; | ||
1666 | if(endpoint == null) | ||
1667 | { | ||
1668 | m_log.DebugFormat("{0}: CrossAgentToNewRegionAsync: failed to resolve neighbour address {0} ",neighbourRegion.ExternalHostName); | ||
1669 | return agent; | ||
1670 | } | ||
1671 | |||
1672 | m_entityTransferStateMachine.SetInTransit(agent.UUID); | ||
1673 | agent.RemoveFromPhysicalScene(); | ||
1674 | |||
1675 | if (!CrossAgentIntoNewRegionMain(agent, pos, neighbourRegion, isFlying, ctx)) | ||
1676 | { | ||
1677 | m_log.DebugFormat("{0}: CrossAgentToNewRegionAsync: cross main failed. Resetting transfer state", LogHeader); | ||
1678 | m_entityTransferStateMachine.ResetFromTransit(agent.UUID); | ||
1679 | return agent; | ||
1680 | } | ||
1681 | |||
1682 | CrossAgentToNewRegionPost(agent, pos, neighbourRegion, endpoint, isFlying, ctx); | ||
1683 | } | ||
1684 | catch (Exception e) | ||
1685 | { | ||
1686 | m_log.Error(string.Format("{0}: CrossAgentToNewRegionAsync: failed with exception ", LogHeader), e); | ||
1687 | } | ||
1688 | |||
1689 | return agent; | ||
1690 | } | ||
1691 | |||
1692 | public bool CrossAgentCreateFarChild(ScenePresence agent, GridRegion neighbourRegion, Vector3 pos, EntityTransferContext ctx) | 1640 | public bool CrossAgentCreateFarChild(ScenePresence agent, GridRegion neighbourRegion, Vector3 pos, EntityTransferContext ctx) |
1693 | { | 1641 | { |
1694 | ulong regionhandler = neighbourRegion.RegionHandle; | 1642 | ulong regionhandler = neighbourRegion.RegionHandle; |
@@ -1728,50 +1676,96 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1728 | m_log.DebugFormat("CrossAgentCreateFarChild failed to resolve neighbour address {0}", neighbourRegion.ExternalHostName); | 1676 | m_log.DebugFormat("CrossAgentCreateFarChild failed to resolve neighbour address {0}", neighbourRegion.ExternalHostName); |
1729 | return false; | 1677 | return false; |
1730 | } | 1678 | } |
1731 | if (Scene.SimulationService.CreateAgent(source, neighbourRegion, agentCircuit, (int)TeleportFlags.Default, ctx, out reason)) | 1679 | if (!Scene.SimulationService.CreateAgent(source, neighbourRegion, agentCircuit, (int)TeleportFlags.Default, ctx, out reason)) |
1680 | { | ||
1681 | agent.RemoveNeighbourRegion(regionhandler); | ||
1682 | return false; | ||
1683 | } | ||
1684 | |||
1685 | string capsPath = neighbourRegion.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); | ||
1686 | int newSizeX = neighbourRegion.RegionSizeX; | ||
1687 | int newSizeY = neighbourRegion.RegionSizeY; | ||
1688 | |||
1689 | if (m_eqModule != null) | ||
1732 | { | 1690 | { |
1733 | string capsPath = neighbourRegion.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); | 1691 | m_log.DebugFormat("{0} {1} is sending {2} EnableSimulator for neighbour region {3}(loc=<{4},{5}>,siz=<{6},{7}>) " + |
1734 | int newSizeX = neighbourRegion.RegionSizeX; | 1692 | "and EstablishAgentCommunication with seed cap {8}", LogHeader, |
1735 | int newSizeY = neighbourRegion.RegionSizeY; | 1693 | source.RegionName, agent.Name, |
1694 | neighbourRegion.RegionName, neighbourRegion.RegionLocX, neighbourRegion.RegionLocY, newSizeX, newSizeY , capsPath); | ||
1736 | 1695 | ||
1737 | if (m_eqModule != null) | 1696 | m_eqModule.EnableSimulator(regionhandler, |
1697 | endPoint, agent.UUID, newSizeX, newSizeY); | ||
1698 | m_eqModule.EstablishAgentCommunication(agent.UUID, endPoint, capsPath, | ||
1699 | regionhandler, newSizeX, newSizeY); | ||
1700 | } | ||
1701 | else | ||
1702 | { | ||
1703 | agent.ControllingClient.InformClientOfNeighbour(regionhandler, endPoint); | ||
1704 | } | ||
1705 | return true; | ||
1706 | } | ||
1707 | |||
1708 | /// <summary> | ||
1709 | /// This Closes child agents on neighbouring regions | ||
1710 | /// Calls an asynchronous method to do so.. so it doesn't lag the sim. | ||
1711 | /// </summary> | ||
1712 | public ScenePresence CrossAgentToNewRegionAsync( | ||
1713 | ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, | ||
1714 | bool isFlying, EntityTransferContext ctx) | ||
1715 | { | ||
1716 | try | ||
1717 | { | ||
1718 | m_log.DebugFormat("{0}: CrossAgentToNewRegionAsync: new region={1} at <{2},{3}>. newpos={4}", | ||
1719 | LogHeader, neighbourRegion.RegionName, neighbourRegion.RegionLocX, neighbourRegion.RegionLocY, pos); | ||
1720 | |||
1721 | if (neighbourRegion == null) | ||
1738 | { | 1722 | { |
1739 | m_log.DebugFormat("{0} {1} is sending {2} EnableSimulator for neighbour region {3}(loc=<{4},{5}>,siz=<{6},{7}>) " + | 1723 | m_log.DebugFormat("{0}: CrossAgentToNewRegionAsync: invalid destiny", LogHeader); |
1740 | "and EstablishAgentCommunication with seed cap {8}", LogHeader, | 1724 | return agent; |
1741 | source.RegionName, agent.Name, | ||
1742 | neighbourRegion.RegionName, neighbourRegion.RegionLocX, neighbourRegion.RegionLocY, newSizeX, newSizeY , capsPath); | ||
1743 | |||
1744 | m_eqModule.EnableSimulator(regionhandler, | ||
1745 | endPoint, agent.UUID, newSizeX, newSizeY); | ||
1746 | m_eqModule.EstablishAgentCommunication(agent.UUID, endPoint, capsPath, | ||
1747 | regionhandler, newSizeX, newSizeY); | ||
1748 | } | 1725 | } |
1749 | else | 1726 | |
1727 | IPEndPoint endpoint = neighbourRegion.ExternalEndPoint; | ||
1728 | if(endpoint == null) | ||
1750 | { | 1729 | { |
1751 | agent.ControllingClient.InformClientOfNeighbour(regionhandler, endPoint); | 1730 | m_log.DebugFormat("{0}: CrossAgentToNewRegionAsync: failed to resolve neighbour address {0} ",neighbourRegion.ExternalHostName); |
1731 | return agent; | ||
1732 | } | ||
1733 | |||
1734 | m_entityTransferStateMachine.SetInTransit(agent.UUID); | ||
1735 | agent.RemoveFromPhysicalScene(); | ||
1736 | |||
1737 | if (!CrossAgentIntoNewRegionMain(agent, pos, neighbourRegion, endpoint, isFlying, ctx)) | ||
1738 | { | ||
1739 | m_log.DebugFormat("{0}: CrossAgentToNewRegionAsync: cross main failed. Resetting transfer state", LogHeader); | ||
1740 | m_entityTransferStateMachine.ResetFromTransit(agent.UUID); | ||
1752 | } | 1741 | } |
1753 | return true; | ||
1754 | } | 1742 | } |
1755 | agent.RemoveNeighbourRegion(regionhandler); | 1743 | catch (Exception e) |
1756 | return false; | 1744 | { |
1745 | m_log.Error(string.Format("{0}: CrossAgentToNewRegionAsync: failed with exception ", LogHeader), e); | ||
1746 | } | ||
1747 | return agent; | ||
1757 | } | 1748 | } |
1758 | 1749 | ||
1759 | public bool CrossAgentIntoNewRegionMain(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, bool isFlying, EntityTransferContext ctx) | 1750 | public bool CrossAgentIntoNewRegionMain(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, |
1751 | IPEndPoint endpoint, bool isFlying, EntityTransferContext ctx) | ||
1760 | { | 1752 | { |
1761 | int ts = Util.EnvironmentTickCount(); | 1753 | int ts = Util.EnvironmentTickCount(); |
1762 | bool sucess = true; | 1754 | bool sucess = true; |
1763 | string reason = String.Empty; | 1755 | string reason = String.Empty; |
1756 | List<ulong> childRegionsToClose = null; | ||
1764 | try | 1757 | try |
1765 | { | 1758 | { |
1766 | |||
1767 | AgentData cAgent = new AgentData(); | 1759 | AgentData cAgent = new AgentData(); |
1768 | agent.CopyTo(cAgent,true); | 1760 | agent.CopyTo(cAgent,true); |
1769 | 1761 | ||
1770 | // agent.Appearance.WearableCacheItems = null; | ||
1771 | |||
1772 | cAgent.Position = pos; | 1762 | cAgent.Position = pos; |
1773 | cAgent.ChildrenCapSeeds = agent.KnownRegions; | 1763 | cAgent.ChildrenCapSeeds = agent.KnownRegions; |
1774 | 1764 | ||
1765 | childRegionsToClose = agent.GetChildAgentsToClose(neighbourRegion.RegionHandle, neighbourRegion.RegionSizeX, neighbourRegion.RegionSizeY); | ||
1766 | foreach(ulong regh in childRegionsToClose) | ||
1767 | cAgent.ChildrenCapSeeds.Remove(regh); | ||
1768 | |||
1775 | if (isFlying) | 1769 | if (isFlying) |
1776 | cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; | 1770 | cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; |
1777 | 1771 | ||
@@ -1806,7 +1800,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1806 | } | 1800 | } |
1807 | 1801 | ||
1808 | m_log.DebugFormat("[CrossAgentIntoNewRegionMain] ok, time {0}ms",Util.EnvironmentTickCountSubtract(ts)); | 1802 | m_log.DebugFormat("[CrossAgentIntoNewRegionMain] ok, time {0}ms",Util.EnvironmentTickCountSubtract(ts)); |
1809 | |||
1810 | } | 1803 | } |
1811 | catch (Exception e) | 1804 | catch (Exception e) |
1812 | { | 1805 | { |
@@ -1818,19 +1811,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1818 | return false; | 1811 | return false; |
1819 | } | 1812 | } |
1820 | 1813 | ||
1821 | return true; | ||
1822 | } | ||
1823 | |||
1824 | public void CrossAgentToNewRegionPost(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, | ||
1825 | IPEndPoint endpoint, bool isFlying, EntityTransferContext ctx) | ||
1826 | { | ||
1827 | |||
1828 | string agentcaps; | 1814 | string agentcaps; |
1829 | if (!agent.KnownRegions.TryGetValue(neighbourRegion.RegionHandle, out agentcaps)) | 1815 | if (!agent.KnownRegions.TryGetValue(neighbourRegion.RegionHandle, out agentcaps)) |
1830 | { | 1816 | { |
1831 | m_log.ErrorFormat("[ENTITY TRANSFER MODULE]: No ENTITY TRANSFER MODULE information for region handle {0}, exiting CrossToNewRegion.", | 1817 | m_log.ErrorFormat("[ENTITY TRANSFER MODULE]: No ENTITY TRANSFER MODULE information for region handle {0}, exiting CrossToNewRegion.", |
1832 | neighbourRegion.RegionHandle); | 1818 | neighbourRegion.RegionHandle); |
1833 | return; | 1819 | return false; |
1834 | } | 1820 | } |
1835 | 1821 | ||
1836 | // No turning back | 1822 | // No turning back |
@@ -1865,7 +1851,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1865 | // Unlike a teleport, here we do not wait for the destination region to confirm the receipt. | 1851 | // Unlike a teleport, here we do not wait for the destination region to confirm the receipt. |
1866 | m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.CleaningUp); | 1852 | m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.CleaningUp); |
1867 | 1853 | ||
1868 | agent.CloseChildAgents(false, neighbourRegion.RegionHandle, neighbourRegion.RegionSizeX, neighbourRegion.RegionSizeY); | 1854 | if(childRegionsToClose != null) |
1855 | agent.CloseChildAgents(childRegionsToClose); | ||
1869 | 1856 | ||
1870 | // this may need the attachments | 1857 | // this may need the attachments |
1871 | 1858 | ||
@@ -1877,20 +1864,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1877 | // but not sure yet what the side effects would be. | 1864 | // but not sure yet what the side effects would be. |
1878 | m_entityTransferStateMachine.ResetFromTransit(agent.UUID); | 1865 | m_entityTransferStateMachine.ResetFromTransit(agent.UUID); |
1879 | 1866 | ||
1880 | // the user may change their profile information in other region, | 1867 | return true; |
1881 | // so the userinfo in UserProfileCache is not reliable any more, delete it | ||
1882 | // REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE! | ||
1883 | // if (agent.Scene.NeedSceneCacheClear(agent.UUID)) | ||
1884 | // { | ||
1885 | // m_log.DebugFormat( | ||
1886 | // "[ENTITY TRANSFER MODULE]: User {0} is going to another region", agent.UUID); | ||
1887 | // } | ||
1888 | |||
1889 | //m_log.Debug("AFTER CROSS"); | ||
1890 | //Scene.DumpChildrenSeeds(UUID); | ||
1891 | //DumpKnownRegions(); | ||
1892 | |||
1893 | return; | ||
1894 | } | 1868 | } |
1895 | 1869 | ||
1896 | private void CrossAgentToNewRegionCompleted(IAsyncResult iar) | 1870 | private void CrossAgentToNewRegionCompleted(IAsyncResult iar) |
diff --git a/OpenSim/Region/Framework/Interfaces/IEventQueue.cs b/OpenSim/Region/Framework/Interfaces/IEventQueue.cs index 7af56cb..7edd75a 100644 --- a/OpenSim/Region/Framework/Interfaces/IEventQueue.cs +++ b/OpenSim/Region/Framework/Interfaces/IEventQueue.cs | |||
@@ -39,7 +39,7 @@ namespace OpenSim.Region.Framework.Interfaces | |||
39 | bool Enqueue(OSD o, UUID avatarID); | 39 | bool Enqueue(OSD o, UUID avatarID); |
40 | 40 | ||
41 | // These are required to decouple Scenes from EventQueueHelper | 41 | // These are required to decouple Scenes from EventQueueHelper |
42 | void DisableSimulator(ulong handle, UUID avatarID); | 42 | // void DisableSimulator(ulong handle, UUID avatarID); |
43 | void EnableSimulator(ulong handle, IPEndPoint endPoint, UUID avatarID, int regionSizeX, int regionSizeY); | 43 | void EnableSimulator(ulong handle, IPEndPoint endPoint, UUID avatarID, int regionSizeX, int regionSizeY); |
44 | void EstablishAgentCommunication(UUID avatarID, IPEndPoint endPoint, | 44 | void EstablishAgentCommunication(UUID avatarID, IPEndPoint endPoint, |
45 | string capsPath, ulong regionHandle, int regionSizeX, int regionSizeY); | 45 | string capsPath, ulong regionHandle, int regionSizeX, int regionSizeY); |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 55ccb0a..f1e27a5 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -1884,7 +1884,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1884 | { | 1884 | { |
1885 | get | 1885 | get |
1886 | { | 1886 | { |
1887 | return new List<ulong>(KnownRegions.Keys); | 1887 | lock (m_knownChildRegions) |
1888 | return new List<ulong>(m_knownChildRegions.Keys); | ||
1888 | } | 1889 | } |
1889 | } | 1890 | } |
1890 | 1891 | ||
@@ -4407,26 +4408,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
4407 | 4408 | ||
4408 | } | 4409 | } |
4409 | 4410 | ||
4410 | /* useless. Either use MakeChild or delete the presence | ||
4411 | public void Reset() | ||
4412 | { | ||
4413 | // m_log.DebugFormat("[SCENE PRESENCE]: Resetting {0} in {1}", Name, Scene.RegionInfo.RegionName); | ||
4414 | |||
4415 | // Put the child agent back at the center | ||
4416 | AbsolutePosition | ||
4417 | = new Vector3(((float)m_scene.RegionInfo.RegionSizeX * 0.5f), ((float)m_scene.RegionInfo.RegionSizeY * 0.5f), 70); | ||
4418 | |||
4419 | Animator.ResetAnimations(); | ||
4420 | } | ||
4421 | */ | ||
4422 | /// <summary> | 4411 | /// <summary> |
4423 | /// Computes which child agents to close when the scene presence moves to another region. | 4412 | /// Computes which child agents to close when the scene presence moves to another region. |
4424 | /// Removes those regions from m_knownRegions. | 4413 | /// Removes those regions from m_knownRegions. |
4425 | /// </summary> | 4414 | /// </summary> |
4426 | /// <param name="newRegionX">The new region's x on the map</param> | 4415 | /// <param name="newRegionHandle">The new region's handle</param> |
4427 | /// <param name="newRegionY">The new region's y on the map</param> | 4416 | /// <param name="newRegionSizeX">The new region's size x</param> |
4417 | /// <param name="newRegionSizeY">The new region's size y</param> | ||
4428 | /// <returns></returns> | 4418 | /// <returns></returns> |
4429 | public void CloseChildAgents(bool logout, ulong newRegionHandle, int newRegionSizeX, int newRegionSizeY) | 4419 | public List<ulong> GetChildAgentsToClose(ulong newRegionHandle, int newRegionSizeX, int newRegionSizeY) |
4430 | { | 4420 | { |
4431 | uint newRegionX, newRegionY; | 4421 | uint newRegionX, newRegionY; |
4432 | List<ulong> byebyeRegions = new List<ulong>(); | 4422 | List<ulong> byebyeRegions = new List<ulong>(); |
@@ -4442,37 +4432,37 @@ namespace OpenSim.Region.Framework.Scenes | |||
4442 | 4432 | ||
4443 | foreach (ulong handle in knownRegions) | 4433 | foreach (ulong handle in knownRegions) |
4444 | { | 4434 | { |
4445 | // Don't close the agent on this region yet | 4435 | if(newRegionY == 0) // HG |
4446 | if (handle != Scene.RegionInfo.RegionHandle) | 4436 | byebyeRegions.Add(handle); |
4437 | else | ||
4447 | { | 4438 | { |
4448 | if (logout) | 4439 | Util.RegionHandleToRegionLoc(handle, out x, out y); |
4449 | byebyeRegions.Add(handle); | 4440 | if (m_knownChildRegionsSizeInfo.TryGetValue(handle, out regInfo)) |
4450 | else | ||
4451 | { | 4441 | { |
4452 | Util.RegionHandleToRegionLoc(handle, out x, out y); | 4442 | // if (Util.IsOutsideView(RegionViewDistance, x, newRegionX, y, newRegionY, |
4453 | if (m_knownChildRegionsSizeInfo.TryGetValue(handle, out regInfo)) | 4443 | // for now need to close all but first order bc RegionViewDistance it the target value not ours |
4444 | if (Util.IsOutsideView(255, x, newRegionX, y, newRegionY, | ||
4445 | regInfo.sizeX, regInfo.sizeY, newRegionSizeX, newRegionSizeY)) | ||
4454 | { | 4446 | { |
4455 | if (Util.IsOutsideView(RegionViewDistance, x, newRegionX, y, newRegionY, | 4447 | byebyeRegions.Add(handle); |
4456 | regInfo.sizeX, regInfo.sizeY, newRegionSizeX, newRegionSizeY)) | ||
4457 | { | ||
4458 | byebyeRegions.Add(handle); | ||
4459 | } | ||
4460 | } | 4448 | } |
4461 | else | 4449 | } |
4450 | else | ||
4451 | { | ||
4452 | if (Util.IsOutsideView(RegionViewDistance, x, newRegionX, y, newRegionY, | ||
4453 | (int)Constants.RegionSize, (int)Constants.RegionSize, newRegionSizeX, newRegionSizeY)) | ||
4462 | { | 4454 | { |
4463 | if (Util.IsOutsideView(RegionViewDistance, x, newRegionX, y, newRegionY, | 4455 | byebyeRegions.Add(handle); |
4464 | (int)Constants.RegionSize, (int)Constants.RegionSize, newRegionSizeX, newRegionSizeY)) | ||
4465 | { | ||
4466 | byebyeRegions.Add(handle); | ||
4467 | // this should not be here | ||
4468 | // if(eventQueue != null) | ||
4469 | // eventQueue.DisableSimulator(handle,UUID); | ||
4470 | } | ||
4471 | } | 4456 | } |
4472 | } | 4457 | } |
4473 | } | 4458 | } |
4474 | } | 4459 | } |
4460 | return byebyeRegions; | ||
4461 | } | ||
4475 | 4462 | ||
4463 | public void CloseChildAgents(List<ulong> byebyeRegions) | ||
4464 | { | ||
4465 | byebyeRegions.Remove(Scene.RegionInfo.RegionHandle); | ||
4476 | if (byebyeRegions.Count > 0) | 4466 | if (byebyeRegions.Count > 0) |
4477 | { | 4467 | { |
4478 | m_log.Debug("[SCENE PRESENCE]: Closing " + byebyeRegions.Count + " child agents"); | 4468 | m_log.Debug("[SCENE PRESENCE]: Closing " + byebyeRegions.Count + " child agents"); |
diff --git a/OpenSim/Tests/Common/Mock/TestEventQueueGetModule.cs b/OpenSim/Tests/Common/Mock/TestEventQueueGetModule.cs index 3e00d82..f2ce064 100644 --- a/OpenSim/Tests/Common/Mock/TestEventQueueGetModule.cs +++ b/OpenSim/Tests/Common/Mock/TestEventQueueGetModule.cs | |||
@@ -108,12 +108,12 @@ namespace OpenSim.Tests.Common | |||
108 | AddEvent(avatarID, "Enqueue", o); | 108 | AddEvent(avatarID, "Enqueue", o); |
109 | return true; | 109 | return true; |
110 | } | 110 | } |
111 | 111 | /* | |
112 | public void DisableSimulator(ulong handle, UUID avatarID) | 112 | public void DisableSimulator(ulong handle, UUID avatarID) |
113 | { | 113 | { |
114 | AddEvent(avatarID, "DisableSimulator", handle); | 114 | AddEvent(avatarID, "DisableSimulator", handle); |
115 | } | 115 | } |
116 | 116 | */ | |
117 | public void EnableSimulator (ulong handle, IPEndPoint endPoint, UUID avatarID, int regionSizeX, int regionSizeY) | 117 | public void EnableSimulator (ulong handle, IPEndPoint endPoint, UUID avatarID, int regionSizeX, int regionSizeY) |
118 | { | 118 | { |
119 | AddEvent(avatarID, "EnableSimulator", handle); | 119 | AddEvent(avatarID, "EnableSimulator", handle); |