aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Framework
diff options
context:
space:
mode:
authorUbitUmarov2017-05-31 23:31:02 +0100
committerUbitUmarov2017-05-31 23:31:02 +0100
commitc68e7b66218a6f85fdca71be2740bf9a15e92f37 (patch)
tree47c76a43f7bcc0543ece9d8efe880e09bac27345 /OpenSim/Region/CoreModules/Framework
parentmantis 8182: update/fix GenerateRandomAnimation(). not updating libomv avatar... (diff)
downloadopensim-SC_OLD-c68e7b66218a6f85fdca71be2740bf9a15e92f37.zip
opensim-SC_OLD-c68e7b66218a6f85fdca71be2740bf9a15e92f37.tar.gz
opensim-SC_OLD-c68e7b66218a6f85fdca71be2740bf9a15e92f37.tar.bz2
opensim-SC_OLD-c68e7b66218a6f85fdca71be2740bf9a15e92f37.tar.xz
change child agents close control; disablesimulator is not a caps event message
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework')
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs214
1 files changed, 94 insertions, 120 deletions
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)