aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs4
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueHelper.cs4
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs224
-rw-r--r--OpenSim/Region/Framework/Interfaces/IEventQueue.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs148
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs64
6 files changed, 277 insertions, 169 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs
index aced734..51f9049 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..99bebdd 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -843,6 +843,14 @@ 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 if(agentCircuit.ChildrenCapSeeds != null)
848 {
849 foreach(ulong handler in childRegionsToClose)
850 {
851 agentCircuit.ChildrenCapSeeds.Remove(handler);
852 }
853 }
846 854
847 // Let's create an agent there if one doesn't exist yet. 855 // Let's create an agent there if one doesn't exist yet.
848 // NOTE: logout will always be false for a non-HG teleport. 856 // NOTE: logout will always be false for a non-HG teleport.
@@ -1026,7 +1034,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1026 return; 1034 return;
1027 } 1035 }
1028 1036
1029
1030/* 1037/*
1031 // TODO: This may be 0.6. Check if still needed 1038 // TODO: This may be 0.6. Check if still needed
1032 // For backwards compatibility 1039 // For backwards compatibility
@@ -1040,7 +1047,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1040 1047
1041 m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.CleaningUp); 1048 m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.CleaningUp);
1042 1049
1043 sp.CloseChildAgents(logout, destinationHandle, finalDestination.RegionSizeX, finalDestination.RegionSizeY); 1050 if(logout)
1051 sp.closeAllChildAgents();
1052 else
1053 sp.CloseChildAgents(childRegionsToClose);
1044 1054
1045 // call HG hook 1055 // call HG hook
1046 AgentHasMovedAway(sp, logout); 1056 AgentHasMovedAway(sp, logout);
@@ -1066,9 +1076,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1066 // This sleep can be increased if necessary. However, whilst it's active, 1076 // 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. 1077 // an agent cannot teleport back to this region if it has teleported away.
1068 Thread.Sleep(2000); 1078 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); 1079 sp.Scene.CloseAgent(sp.UUID, false);
1073 } 1080 }
1074 sp.IsInTransit = false; 1081 sp.IsInTransit = false;
@@ -1078,7 +1085,16 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1078 IPEndPoint endPoint, uint teleportFlags, bool OutSideViewRange, EntityTransferContext ctx, out string reason) 1085 IPEndPoint endPoint, uint teleportFlags, bool OutSideViewRange, EntityTransferContext ctx, out string reason)
1079 { 1086 {
1080 ulong destinationHandle = finalDestination.RegionHandle; 1087 ulong destinationHandle = finalDestination.RegionHandle;
1081 AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); 1088
1089 List<ulong> childRegionsToClose = sp.GetChildAgentsToClose(destinationHandle, finalDestination.RegionSizeX, finalDestination.RegionSizeY);
1090
1091 if(agentCircuit.ChildrenCapSeeds != null)
1092 {
1093 foreach(ulong handler in childRegionsToClose)
1094 {
1095 agentCircuit.ChildrenCapSeeds.Remove(handler);
1096 }
1097 }
1082 1098
1083 string capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath);; 1099 string capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath);;
1084 1100
@@ -1178,20 +1194,17 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1178 "[ENTITY TRANSFER MODULE]: UpdateAgent failed on teleport of {0} to {1}. Keeping avatar in {2}", 1194 "[ENTITY TRANSFER MODULE]: UpdateAgent failed on teleport of {0} to {1}. Keeping avatar in {2}",
1179 sp.Name, finalDestination.RegionName, sp.Scene.Name); 1195 sp.Name, finalDestination.RegionName, sp.Scene.Name);
1180 1196
1181 Fail(sp, finalDestination, logout, currentAgentCircuit.SessionID.ToString(), "Connection between viewer and destination region could not be established."); 1197 Fail(sp, finalDestination, logout, agentCircuit.SessionID.ToString(), "Connection between viewer and destination region could not be established.");
1182 sp.IsInTransit = false; 1198 sp.IsInTransit = false;
1183 return; 1199 return;
1184 } 1200 }
1185 1201
1186 m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.CleaningUp); 1202 m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.CleaningUp);
1187 1203
1188 // Need to signal neighbours whether child agents may need closing irrespective of whether this 1204 if(logout)
1189 // one needed closing. We also need to close child agents as quickly as possible to avoid complicated 1205 sp.closeAllChildAgents();
1190 // race conditions with rapid agent releporting (e.g. from A1 to a non-neighbour B, back 1206 else
1191 // to a neighbour A2 then off to a non-neighbour C). Closing child agents any later requires complex 1207 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 1208
1196 sp.HasMovedAway(!(OutSideViewRange || logout)); 1209 sp.HasMovedAway(!(OutSideViewRange || logout));
1197 1210
@@ -1217,10 +1230,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1217 // DECREASING THE WAIT TIME HERE WILL EITHER RESULT IN A VIEWER CRASH OR 1230 // 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. 1231 // IN THE AVIE BEING PLACED IN INFINITY FOR A COUPLE OF SECONDS.
1219 1232
1220 Thread.Sleep(25000); 1233 Thread.Sleep(15000);
1221// if (m_eqModule != null && !sp.DoNotCloseAfterTeleport)
1222// m_eqModule.DisableSimulator(sourceRegionHandle,sp.UUID);
1223// Thread.Sleep(1000);
1224 1234
1225 // OK, it got this agent. Let's close everything 1235 // 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 1236 // If we shouldn't close the agent due to some other region renewing the connection
@@ -1230,13 +1240,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1230 1240
1231 sp.Scene.CloseAgent(sp.UUID, false); 1241 sp.Scene.CloseAgent(sp.UUID, false);
1232 } 1242 }
1233/*
1234 else
1235 {
1236 // now we have a child agent in this region.
1237 sp.Reset();
1238 }
1239 */
1240 sp.IsInTransit = false; 1243 sp.IsInTransit = false;
1241 } 1244 }
1242 1245
@@ -1641,54 +1644,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1641 icon.EndInvoke(iar); 1644 icon.EndInvoke(iar);
1642 } 1645 }
1643 1646
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) 1647 public bool CrossAgentCreateFarChild(ScenePresence agent, GridRegion neighbourRegion, Vector3 pos, EntityTransferContext ctx)
1693 { 1648 {
1694 ulong regionhandler = neighbourRegion.RegionHandle; 1649 ulong regionhandler = neighbourRegion.RegionHandle;
@@ -1728,50 +1683,99 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1728 m_log.DebugFormat("CrossAgentCreateFarChild failed to resolve neighbour address {0}", neighbourRegion.ExternalHostName); 1683 m_log.DebugFormat("CrossAgentCreateFarChild failed to resolve neighbour address {0}", neighbourRegion.ExternalHostName);
1729 return false; 1684 return false;
1730 } 1685 }
1731 if (Scene.SimulationService.CreateAgent(source, neighbourRegion, agentCircuit, (int)TeleportFlags.Default, ctx, out reason)) 1686 if (!Scene.SimulationService.CreateAgent(source, neighbourRegion, agentCircuit, (int)TeleportFlags.Default, ctx, out reason))
1687 {
1688 agent.RemoveNeighbourRegion(regionhandler);
1689 return false;
1690 }
1691
1692 string capsPath = neighbourRegion.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath);
1693 int newSizeX = neighbourRegion.RegionSizeX;
1694 int newSizeY = neighbourRegion.RegionSizeY;
1695
1696 if (m_eqModule != null)
1732 { 1697 {
1733 string capsPath = neighbourRegion.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath); 1698 m_log.DebugFormat("{0} {1} is sending {2} EnableSimulator for neighbour region {3}(loc=<{4},{5}>,siz=<{6},{7}>) " +
1734 int newSizeX = neighbourRegion.RegionSizeX; 1699 "and EstablishAgentCommunication with seed cap {8}", LogHeader,
1735 int newSizeY = neighbourRegion.RegionSizeY; 1700 source.RegionName, agent.Name,
1701 neighbourRegion.RegionName, neighbourRegion.RegionLocX, neighbourRegion.RegionLocY, newSizeX, newSizeY , capsPath);
1736 1702
1737 if (m_eqModule != null) 1703 m_eqModule.EnableSimulator(regionhandler,
1704 endPoint, agent.UUID, newSizeX, newSizeY);
1705 m_eqModule.EstablishAgentCommunication(agent.UUID, endPoint, capsPath,
1706 regionhandler, newSizeX, newSizeY);
1707 }
1708 else
1709 {
1710 agent.ControllingClient.InformClientOfNeighbour(regionhandler, endPoint);
1711 }
1712 return true;
1713 }
1714
1715 /// <summary>
1716 /// This Closes child agents on neighbouring regions
1717 /// Calls an asynchronous method to do so.. so it doesn't lag the sim.
1718 /// </summary>
1719 public ScenePresence CrossAgentToNewRegionAsync(
1720 ScenePresence agent, Vector3 pos, GridRegion neighbourRegion,
1721 bool isFlying, EntityTransferContext ctx)
1722 {
1723 try
1724 {
1725 m_log.DebugFormat("{0}: CrossAgentToNewRegionAsync: new region={1} at <{2},{3}>. newpos={4}",
1726 LogHeader, neighbourRegion.RegionName, neighbourRegion.RegionLocX, neighbourRegion.RegionLocY, pos);
1727
1728 if (neighbourRegion == null)
1738 { 1729 {
1739 m_log.DebugFormat("{0} {1} is sending {2} EnableSimulator for neighbour region {3}(loc=<{4},{5}>,siz=<{6},{7}>) " + 1730 m_log.DebugFormat("{0}: CrossAgentToNewRegionAsync: invalid destiny", LogHeader);
1740 "and EstablishAgentCommunication with seed cap {8}", LogHeader, 1731 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 } 1732 }
1749 else 1733
1734 IPEndPoint endpoint = neighbourRegion.ExternalEndPoint;
1735 if(endpoint == null)
1750 { 1736 {
1751 agent.ControllingClient.InformClientOfNeighbour(regionhandler, endPoint); 1737 m_log.DebugFormat("{0}: CrossAgentToNewRegionAsync: failed to resolve neighbour address {0} ",neighbourRegion.ExternalHostName);
1738 return agent;
1739 }
1740
1741 m_entityTransferStateMachine.SetInTransit(agent.UUID);
1742 agent.RemoveFromPhysicalScene();
1743
1744 if (!CrossAgentIntoNewRegionMain(agent, pos, neighbourRegion, endpoint, isFlying, ctx))
1745 {
1746 m_log.DebugFormat("{0}: CrossAgentToNewRegionAsync: cross main failed. Resetting transfer state", LogHeader);
1747 m_entityTransferStateMachine.ResetFromTransit(agent.UUID);
1752 } 1748 }
1753 return true;
1754 } 1749 }
1755 agent.RemoveNeighbourRegion(regionhandler); 1750 catch (Exception e)
1756 return false; 1751 {
1752 m_log.Error(string.Format("{0}: CrossAgentToNewRegionAsync: failed with exception ", LogHeader), e);
1753 }
1754 return agent;
1757 } 1755 }
1758 1756
1759 public bool CrossAgentIntoNewRegionMain(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, bool isFlying, EntityTransferContext ctx) 1757 public bool CrossAgentIntoNewRegionMain(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion,
1758 IPEndPoint endpoint, bool isFlying, EntityTransferContext ctx)
1760 { 1759 {
1761 int ts = Util.EnvironmentTickCount(); 1760 int ts = Util.EnvironmentTickCount();
1762 bool sucess = true; 1761 bool sucess = true;
1763 string reason = String.Empty; 1762 string reason = String.Empty;
1763 List<ulong> childRegionsToClose = null;
1764 try 1764 try
1765 { 1765 {
1766
1767 AgentData cAgent = new AgentData(); 1766 AgentData cAgent = new AgentData();
1768 agent.CopyTo(cAgent,true); 1767 agent.CopyTo(cAgent,true);
1769 1768
1770// agent.Appearance.WearableCacheItems = null;
1771
1772 cAgent.Position = pos; 1769 cAgent.Position = pos;
1773 cAgent.ChildrenCapSeeds = agent.KnownRegions; 1770 cAgent.ChildrenCapSeeds = agent.KnownRegions;
1774 1771
1772 childRegionsToClose = agent.GetChildAgentsToClose(neighbourRegion.RegionHandle, neighbourRegion.RegionSizeX, neighbourRegion.RegionSizeY);
1773 if(cAgent.ChildrenCapSeeds != null)
1774 {
1775 foreach(ulong regh in childRegionsToClose)
1776 cAgent.ChildrenCapSeeds.Remove(regh);
1777 }
1778
1775 if (isFlying) 1779 if (isFlying)
1776 cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; 1780 cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY;
1777 1781
@@ -1806,7 +1810,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1806 } 1810 }
1807 1811
1808 m_log.DebugFormat("[CrossAgentIntoNewRegionMain] ok, time {0}ms",Util.EnvironmentTickCountSubtract(ts)); 1812 m_log.DebugFormat("[CrossAgentIntoNewRegionMain] ok, time {0}ms",Util.EnvironmentTickCountSubtract(ts));
1809
1810 } 1813 }
1811 catch (Exception e) 1814 catch (Exception e)
1812 { 1815 {
@@ -1818,19 +1821,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1818 return false; 1821 return false;
1819 } 1822 }
1820 1823
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; 1824 string agentcaps;
1829 if (!agent.KnownRegions.TryGetValue(neighbourRegion.RegionHandle, out agentcaps)) 1825 if (!agent.KnownRegions.TryGetValue(neighbourRegion.RegionHandle, out agentcaps))
1830 { 1826 {
1831 m_log.ErrorFormat("[ENTITY TRANSFER MODULE]: No ENTITY TRANSFER MODULE information for region handle {0}, exiting CrossToNewRegion.", 1827 m_log.ErrorFormat("[ENTITY TRANSFER MODULE]: No ENTITY TRANSFER MODULE information for region handle {0}, exiting CrossToNewRegion.",
1832 neighbourRegion.RegionHandle); 1828 neighbourRegion.RegionHandle);
1833 return; 1829 return false;
1834 } 1830 }
1835 1831
1836 // No turning back 1832 // No turning back
@@ -1865,7 +1861,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1865 // Unlike a teleport, here we do not wait for the destination region to confirm the receipt. 1861 // Unlike a teleport, here we do not wait for the destination region to confirm the receipt.
1866 m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.CleaningUp); 1862 m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.CleaningUp);
1867 1863
1868 agent.CloseChildAgents(false, neighbourRegion.RegionHandle, neighbourRegion.RegionSizeX, neighbourRegion.RegionSizeY); 1864 if(childRegionsToClose != null)
1865 agent.CloseChildAgents(childRegionsToClose);
1869 1866
1870 // this may need the attachments 1867 // this may need the attachments
1871 1868
@@ -1877,20 +1874,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1877 // but not sure yet what the side effects would be. 1874 // but not sure yet what the side effects would be.
1878 m_entityTransferStateMachine.ResetFromTransit(agent.UUID); 1875 m_entityTransferStateMachine.ResetFromTransit(agent.UUID);
1879 1876
1880 // the user may change their profile information in other region, 1877 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 } 1878 }
1895 1879
1896 private void CrossAgentToNewRegionCompleted(IAsyncResult iar) 1880 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/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
index 6b31555..5c33f12 100644
--- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
+++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
@@ -618,13 +618,147 @@ namespace OpenSim.Region.Framework.Scenes.Animation
618 int rnditerations = 3; 618 int rnditerations = 3;
619 BinBVHAnimation anim = new BinBVHAnimation(); 619 BinBVHAnimation anim = new BinBVHAnimation();
620 List<string> parts = new List<string>(); 620 List<string> parts = new List<string>();
621 parts.Add("mPelvis"); parts.Add("mHead"); parts.Add("mTorso"); 621
622 parts.Add("mHipLeft"); parts.Add("mHipRight"); parts.Add("mHipLeft"); parts.Add("mKneeLeft"); 622 /// Torso and Head
623 parts.Add("mKneeRight"); parts.Add("mCollarLeft"); parts.Add("mCollarRight"); parts.Add("mNeck"); 623 parts.Add("mPelvis");
624 parts.Add("mElbowLeft"); parts.Add("mElbowRight"); parts.Add("mWristLeft"); parts.Add("mWristRight"); 624 parts.Add("mTorso");
625 parts.Add("mShoulderLeft"); parts.Add("mShoulderRight"); parts.Add("mAnkleLeft"); parts.Add("mAnkleRight"); 625 parts.Add("mChest");
626 parts.Add("mEyeRight"); parts.Add("mChest"); parts.Add("mToeLeft"); parts.Add("mToeRight"); 626 parts.Add("mNeck");
627 parts.Add("mFootLeft"); parts.Add("mFootRight"); parts.Add("mEyeLeft"); 627 parts.Add("mHead");
628 parts.Add("mSkull");
629 parts.Add("mEyeRight");
630 parts.Add("mEyeLeft");
631 /// Arms
632 parts.Add("mCollarLeft");
633 parts.Add("mShoulderLeft");
634 parts.Add("mElbowLeft");
635 parts.Add("mWristLeft");
636 parts.Add("mCollarRight");
637 parts.Add("mShoulderRight");
638 parts.Add("mElbowRight");
639 parts.Add("mWristRight");
640 /// Legs
641 parts.Add("mHipLeft");
642 parts.Add("mKneeLeft");
643 parts.Add("mAnkleLeft");
644 parts.Add("mFootLeft");
645 parts.Add("mToeLeft");
646 parts.Add("mHipRight");
647 parts.Add("mKneeRight");
648 parts.Add("mAnkleRight");
649 parts.Add("mFootRight");
650 parts.Add("mToeRight");
651 ///Hands
652 parts.Add("mHandThumb1Left");
653 parts.Add("mHandThumb1Right");
654 parts.Add("mHandThumb2Left");
655 parts.Add("mHandThumb2Right");
656 parts.Add("mHandThumb3Left");
657 parts.Add("mHandThumb3Right");
658 parts.Add("mHandIndex1Left");
659 parts.Add("mHandIndex1Right");
660 parts.Add("mHandIndex2Left");
661 parts.Add("mHandIndex2Right");
662 parts.Add("mHandIndex3Left");
663 parts.Add("mHandIndex3Right");
664 parts.Add("mHandMiddle1Left");
665 parts.Add("mHandMiddle1Right");
666 parts.Add("mHandMiddle2Left");
667 parts.Add("mHandMiddle2Right");
668 parts.Add("mHandMiddle3Left");
669 parts.Add("mHandMiddle3Right");
670 parts.Add("mHandRing1Left");
671 parts.Add("mHandRing1Right");
672 parts.Add("mHandRing2Left");
673 parts.Add("mHandRing2Right");
674 parts.Add("mHandRing3Left");
675 parts.Add("mHandRing3Right");
676 parts.Add("mHandPinky1Left");
677 parts.Add("mHandPinky1Right");
678 parts.Add("mHandPinky2Left");
679 parts.Add("mHandPinky2Right");
680 parts.Add("mHandPinky3Left");
681 parts.Add("mHandPinky3Right");
682 ///Face
683 parts.Add("mFaceForeheadLeft");
684 parts.Add("mFaceForeheadCenter");
685 parts.Add("mFaceForeheadRight");
686 parts.Add("mFaceEyebrowOuterLeft");
687 parts.Add("mFaceEyebrowCenterLeft");
688 parts.Add("mFaceEyebrowInnerLeft");
689 parts.Add("mFaceEyebrowOuterRight");
690 parts.Add("mFaceEyebrowCenterRight");
691 parts.Add("mFaceEyebrowInnerRight");
692 parts.Add("mFaceEyeLidUpperLeft");
693 parts.Add("mFaceEyeLidLowerLeft");
694 parts.Add("mFaceEyeLidUpperRight");
695 parts.Add("mFaceEyeLidLowerRight");
696 parts.Add("mFaceEyeAltLeft");
697 parts.Add("mFaceEyeAltRight");
698 parts.Add("mFaceEyecornerInnerLeft");
699 parts.Add("mFaceEyecornerInnerRight");
700 parts.Add("mFaceEar1Left");
701 parts.Add("mFaceEar2Left");
702 parts.Add("mFaceEar1Right");
703 parts.Add("mFaceEar2Right");
704 parts.Add("mFaceNoseLeft");
705 parts.Add("mFaceNoseCenter");
706 parts.Add("mFaceNoseRight");
707 parts.Add("mFaceNoseBase");
708 parts.Add("mFaceNoseBridge");
709 parts.Add("mFaceCheekUpperInnerLeft");
710 parts.Add("mFaceCheekUpperOuterLeft");
711 parts.Add("mFaceCheekUpperInnerRight");
712 parts.Add("mFaceCheekUpperOuterRight");
713 parts.Add("mFaceJaw");
714 parts.Add("mFaceLipUpperLeft");
715 parts.Add("mFaceLipUpperCenter");
716 parts.Add("mFaceLipUpperRight");
717 parts.Add("mFaceLipCornerLeft");
718 parts.Add("mFaceLipCornerRight");
719 parts.Add("mFaceTongueBase");
720 parts.Add("mFaceTongueTip");
721 parts.Add("mFaceLipLowerLeft");
722 parts.Add("mFaceLipLowerCenter");
723 parts.Add("mFaceLipLowerRight");
724 parts.Add("mFaceTeethLower");
725 parts.Add("mFaceTeethUpper");
726 parts.Add("mFaceChin");
727 ///Spine
728 parts.Add("mSpine1");
729 parts.Add("mSpine2");
730 parts.Add("mSpine3");
731 parts.Add("mSpine4");
732 ///Wings
733 parts.Add("mWingsRoot");
734 parts.Add("mWing1Left");
735 parts.Add("mWing2Left");
736 parts.Add("mWing3Left");
737 parts.Add("mWing4Left");
738 parts.Add("mWing1Right");
739 parts.Add("mWing2Right");
740 parts.Add("mWing3Right");
741 parts.Add("mWing4Right");
742 parts.Add("mWing4FanRight");
743 parts.Add("mWing4FanLeft");
744 ///Hind Limbs
745 parts.Add("mHindLimbsRoot");
746 parts.Add("mHindLimb1Left");
747 parts.Add("mHindLimb2Left");
748 parts.Add("mHindLimb3Left");
749 parts.Add("mHindLimb4Left");
750 parts.Add("mHindLimb1Right");
751 parts.Add("mHindLimb2Right");
752 parts.Add("mHindLimb3Right");
753 parts.Add("mHindLimb4Right");
754 ///Tail
755 parts.Add("mTail1");
756 parts.Add("mTail2");
757 parts.Add("mTail3");
758 parts.Add("mTail4");
759 parts.Add("mTail5");
760 parts.Add("mTail6");
761
628 anim.HandPose = 1; 762 anim.HandPose = 1;
629 anim.InPoint = 0; 763 anim.InPoint = 0;
630 anim.OutPoint = (rnditerations * .10f); 764 anim.OutPoint = (rnditerations * .10f);
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");