diff options
author | Melanie Thielker | 2014-08-20 04:39:48 +0200 |
---|---|---|
committer | Melanie Thielker | 2014-08-20 04:39:48 +0200 |
commit | 24b4f6ad7b9e9b54b3efb80aec462fa03e226c32 (patch) | |
tree | 3128c12ea30a35b30caaf598a8a023c5987d279d /OpenSim/Region/CoreModules | |
parent | Expect a missing directory, the asset cache is shared. Prevent spew if (diff) | |
parent | also send attachment pre-kills on crossings (diff) | |
download | opensim-SC_OLD-24b4f6ad7b9e9b54b3efb80aec462fa03e226c32.zip opensim-SC_OLD-24b4f6ad7b9e9b54b3efb80aec462fa03e226c32.tar.gz opensim-SC_OLD-24b4f6ad7b9e9b54b3efb80aec462fa03e226c32.tar.bz2 opensim-SC_OLD-24b4f6ad7b9e9b54b3efb80aec462fa03e226c32.tar.xz |
Merge branch 'ubitworkmaster'
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs | 24 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | 252 |
2 files changed, 156 insertions, 120 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs b/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs index de8925d..498cc2f 100644 --- a/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs +++ b/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs | |||
@@ -120,10 +120,16 @@ namespace OpenSim.Region.CoreModules.Framework | |||
120 | 120 | ||
121 | public void CreateCaps(UUID agentId, uint circuitCode) | 121 | public void CreateCaps(UUID agentId, uint circuitCode) |
122 | { | 122 | { |
123 | // int ts = Util.EnvironmentTickCount(); | ||
124 | /* this as no business here... | ||
125 | * must be done elsewhere ( and is ) | ||
123 | int flags = m_scene.GetUserFlags(agentId); | 126 | int flags = m_scene.GetUserFlags(agentId); |
127 | |||
128 | m_log.ErrorFormat("[CreateCaps]: banCheck {0} ", Util.EnvironmentTickCountSubtract(ts)); | ||
129 | |||
124 | if (m_scene.RegionInfo.EstateSettings.IsBanned(agentId, flags)) | 130 | if (m_scene.RegionInfo.EstateSettings.IsBanned(agentId, flags)) |
125 | return; | 131 | return; |
126 | 132 | */ | |
127 | Caps caps; | 133 | Caps caps; |
128 | String capsObjectPath = GetCapsPath(agentId); | 134 | String capsObjectPath = GetCapsPath(agentId); |
129 | 135 | ||
@@ -132,19 +138,27 @@ namespace OpenSim.Region.CoreModules.Framework | |||
132 | if (m_capsObjects.ContainsKey(circuitCode)) | 138 | if (m_capsObjects.ContainsKey(circuitCode)) |
133 | { | 139 | { |
134 | Caps oldCaps = m_capsObjects[circuitCode]; | 140 | Caps oldCaps = m_capsObjects[circuitCode]; |
135 | 141 | ||
136 | //m_log.WarnFormat( | 142 | // if (capsObjectPath == oldCaps.CapsObjectPath) |
137 | // "[CAPS]: Recreating caps for agent {0} in region {1}. Old caps path {2}, new caps path {3}. ", | 143 | // { |
138 | // agentId, m_scene.RegionInfo.RegionName, oldCaps.CapsObjectPath, capsObjectPath); | 144 | // m_log.WarnFormat( |
145 | // "[CAPS]: Reusing caps for agent {0} in region {1}. Old caps path {2}, new caps path {3}. ", | ||
146 | // agentId, m_scene.RegionInfo.RegionName, oldCaps.CapsObjectPath, capsObjectPath); | ||
147 | // return; | ||
148 | // } | ||
139 | } | 149 | } |
140 | 150 | ||
141 | caps = new Caps(MainServer.Instance, m_scene.RegionInfo.ExternalHostName, | 151 | caps = new Caps(MainServer.Instance, m_scene.RegionInfo.ExternalHostName, |
142 | (MainServer.Instance == null) ? 0: MainServer.Instance.Port, | 152 | (MainServer.Instance == null) ? 0: MainServer.Instance.Port, |
143 | capsObjectPath, agentId, m_scene.RegionInfo.RegionName); | 153 | capsObjectPath, agentId, m_scene.RegionInfo.RegionName); |
144 | 154 | ||
155 | // m_log.ErrorFormat("[CreateCaps]: new caps {0} ", Util.EnvironmentTickCountSubtract(ts)); | ||
156 | |||
145 | m_capsObjects[circuitCode] = caps; | 157 | m_capsObjects[circuitCode] = caps; |
146 | } | 158 | } |
147 | m_scene.EventManager.TriggerOnRegisterCaps(agentId, caps); | 159 | m_scene.EventManager.TriggerOnRegisterCaps(agentId, caps); |
160 | // m_log.ErrorFormat("[CreateCaps]: end {0} ", Util.EnvironmentTickCountSubtract(ts)); | ||
161 | |||
148 | } | 162 | } |
149 | 163 | ||
150 | public void RemoveCaps(UUID agentId, uint circuitCode) | 164 | public void RemoveCaps(UUID agentId, uint circuitCode) |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 71148ea..d5eca03 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -430,7 +430,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
430 | } | 430 | } |
431 | 431 | ||
432 | // TODO: Get proper AVG Height | 432 | // TODO: Get proper AVG Height |
433 | float localAVHeight = 1.56f; | 433 | float localHalfAVHeight = 0.8f; |
434 | if (sp.Appearance != null) | ||
435 | localHalfAVHeight = sp.Appearance.AvatarHeight / 2; | ||
436 | |||
434 | float posZLimit = 22; | 437 | float posZLimit = 22; |
435 | 438 | ||
436 | // TODO: Check other Scene HeightField | 439 | // TODO: Check other Scene HeightField |
@@ -439,10 +442,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
439 | posZLimit = (float)sp.Scene.Heightmap[(int)position.X, (int)position.Y]; | 442 | posZLimit = (float)sp.Scene.Heightmap[(int)position.X, (int)position.Y]; |
440 | } | 443 | } |
441 | 444 | ||
442 | float newPosZ = posZLimit + localAVHeight; | 445 | posZLimit += localHalfAVHeight + 0.1f; |
443 | if (posZLimit >= (position.Z - (localAVHeight / 2)) && !(Single.IsInfinity(newPosZ) || Single.IsNaN(newPosZ))) | 446 | |
447 | if ((position.Z < posZLimit) && !(Single.IsInfinity(posZLimit) || Single.IsNaN(posZLimit))) | ||
444 | { | 448 | { |
445 | position.Z = newPosZ; | 449 | position.Z = posZLimit; |
446 | } | 450 | } |
447 | 451 | ||
448 | if (sp.Flying) | 452 | if (sp.Flying) |
@@ -720,7 +724,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
720 | AgentCircuitData agentCircuit = sp.ControllingClient.RequestClientInfo(); | 724 | AgentCircuitData agentCircuit = sp.ControllingClient.RequestClientInfo(); |
721 | agentCircuit.startpos = position; | 725 | agentCircuit.startpos = position; |
722 | agentCircuit.child = true; | 726 | agentCircuit.child = true; |
723 | agentCircuit.Appearance = sp.Appearance; | 727 | |
728 | // agentCircuit.Appearance = sp.Appearance; | ||
729 | // agentCircuit.Appearance = new AvatarAppearance(sp.Appearance, true, false); | ||
730 | agentCircuit.Appearance = new AvatarAppearance(); | ||
731 | agentCircuit.Appearance.AvatarHeight = sp.Appearance.AvatarHeight; | ||
732 | |||
724 | if (currentAgentCircuit != null) | 733 | if (currentAgentCircuit != null) |
725 | { | 734 | { |
726 | agentCircuit.ServiceURLs = currentAgentCircuit.ServiceURLs; | 735 | agentCircuit.ServiceURLs = currentAgentCircuit.ServiceURLs; |
@@ -971,7 +980,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
971 | } | 980 | } |
972 | 981 | ||
973 | // May need to logout or other cleanup | 982 | // May need to logout or other cleanup |
974 | AgentHasMovedAway(sp, logout); | 983 | // AgentHasMovedAway(sp, logout); |
984 | AgentHasMovedAway(sp, true); // until logout use is checked | ||
975 | 985 | ||
976 | // Well, this is it. The agent is over there. | 986 | // Well, this is it. The agent is over there. |
977 | KillEntity(sp.Scene, sp.LocalId); | 987 | KillEntity(sp.Scene, sp.LocalId); |
@@ -1138,7 +1148,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1138 | sp.CloseChildAgents(newRegionX, newRegionY); | 1148 | sp.CloseChildAgents(newRegionX, newRegionY); |
1139 | 1149 | ||
1140 | // May need to logout or other cleanup | 1150 | // May need to logout or other cleanup |
1141 | AgentHasMovedAway(sp, logout); | 1151 | // AgentHasMovedAway(sp, logout); |
1152 | AgentHasMovedAway(sp, true); | ||
1142 | 1153 | ||
1143 | // Well, this is it. The agent is over there. | 1154 | // Well, this is it. The agent is over there. |
1144 | KillEntity(sp.Scene, sp.LocalId); | 1155 | KillEntity(sp.Scene, sp.LocalId); |
@@ -1253,7 +1264,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1253 | protected virtual void AgentHasMovedAway(ScenePresence sp, bool logout) | 1264 | protected virtual void AgentHasMovedAway(ScenePresence sp, bool logout) |
1254 | { | 1265 | { |
1255 | if (sp.Scene.AttachmentsModule != null) | 1266 | if (sp.Scene.AttachmentsModule != null) |
1256 | sp.Scene.AttachmentsModule.DeleteAttachmentsFromScene(sp, true); | 1267 | sp.Scene.AttachmentsModule.DeleteAttachmentsFromScene(sp, logout); |
1257 | } | 1268 | } |
1258 | 1269 | ||
1259 | protected void KillEntity(Scene scene, uint localID) | 1270 | protected void KillEntity(Scene scene, uint localID) |
@@ -1381,10 +1392,16 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1381 | 1392 | ||
1382 | 1393 | ||
1383 | #region Agent Crossings | 1394 | #region Agent Crossings |
1384 | |||
1385 | public GridRegion GetDestination(Scene scene, UUID agentID, Vector3 pos, out uint xDest, out uint yDest, out string version, out Vector3 newpos) | 1395 | public GridRegion GetDestination(Scene scene, UUID agentID, Vector3 pos, out uint xDest, out uint yDest, out string version, out Vector3 newpos) |
1386 | { | 1396 | { |
1397 | string r = String.Empty; | ||
1398 | return GetDestination(scene, agentID, pos, out xDest, out yDest, out version, out newpos, out r); | ||
1399 | } | ||
1400 | |||
1401 | public GridRegion GetDestination(Scene scene, UUID agentID, Vector3 pos, out uint xDest, out uint yDest, out string version, out Vector3 newpos, out string reason) | ||
1402 | { | ||
1387 | version = String.Empty; | 1403 | version = String.Empty; |
1404 | reason = String.Empty; | ||
1388 | newpos = pos; | 1405 | newpos = pos; |
1389 | 1406 | ||
1390 | // m_log.DebugFormat( | 1407 | // m_log.DebugFormat( |
@@ -1498,8 +1515,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1498 | } | 1515 | } |
1499 | 1516 | ||
1500 | GridRegion neighbourRegion = scene.GridService.GetRegionByPosition(scene.RegionInfo.ScopeID, (int)x, (int)y); | 1517 | GridRegion neighbourRegion = scene.GridService.GetRegionByPosition(scene.RegionInfo.ScopeID, (int)x, (int)y); |
1501 | 1518 | ||
1502 | string reason; | ||
1503 | if (!scene.SimulationService.QueryAccess(neighbourRegion, agentID, newpos, out version, out reason)) | 1519 | if (!scene.SimulationService.QueryAccess(neighbourRegion, agentID, newpos, out version, out reason)) |
1504 | { | 1520 | { |
1505 | if (r == null) | 1521 | if (r == null) |
@@ -1525,11 +1541,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1525 | uint y; | 1541 | uint y; |
1526 | Vector3 newpos; | 1542 | Vector3 newpos; |
1527 | string version; | 1543 | string version; |
1544 | string reason; | ||
1528 | 1545 | ||
1529 | GridRegion neighbourRegion = GetDestination(agent.Scene, agent.UUID, agent.AbsolutePosition, out x, out y, out version, out newpos); | 1546 | GridRegion neighbourRegion = GetDestination(agent.Scene, agent.UUID, agent.AbsolutePosition, out x, out y, out version, out newpos, out reason); |
1530 | if (neighbourRegion == null) | 1547 | if (neighbourRegion == null) |
1531 | { | 1548 | { |
1532 | agent.ControllingClient.SendAlertMessage("Cannot region cross into void"); | 1549 | if (reason == String.Empty) |
1550 | agent.ControllingClient.SendAlertMessage("Cannot cross to region"); | ||
1551 | else | ||
1552 | agent.ControllingClient.SendAlertMessage("Cannot cross to region: " + reason); | ||
1533 | return false; | 1553 | return false; |
1534 | } | 1554 | } |
1535 | 1555 | ||
@@ -1656,10 +1676,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1656 | 1676 | ||
1657 | public bool CrossAgentIntoNewRegionMain(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, bool isFlying) | 1677 | public bool CrossAgentIntoNewRegionMain(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, bool isFlying) |
1658 | { | 1678 | { |
1679 | int ts = Util.EnvironmentTickCount(); | ||
1659 | try | 1680 | try |
1660 | { | 1681 | { |
1682 | |||
1661 | AgentData cAgent = new AgentData(); | 1683 | AgentData cAgent = new AgentData(); |
1662 | agent.CopyTo(cAgent); | 1684 | agent.CopyTo(cAgent); |
1685 | |||
1686 | // agent.Appearance.WearableCacheItems = null; | ||
1687 | |||
1663 | cAgent.Position = pos + agent.Velocity; | 1688 | cAgent.Position = pos + agent.Velocity; |
1664 | if (isFlying) | 1689 | if (isFlying) |
1665 | cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; | 1690 | cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; |
@@ -1686,6 +1711,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1686 | return false; | 1711 | return false; |
1687 | } | 1712 | } |
1688 | 1713 | ||
1714 | m_log.DebugFormat("[CrossAgentIntoNewRegionMain] ok, time {0}ms",Util.EnvironmentTickCountSubtract(ts)); | ||
1715 | |||
1689 | } | 1716 | } |
1690 | catch (Exception e) | 1717 | catch (Exception e) |
1691 | { | 1718 | { |
@@ -1703,6 +1730,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1703 | public void CrossAgentToNewRegionPost(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, | 1730 | public void CrossAgentToNewRegionPost(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, |
1704 | bool isFlying, string version) | 1731 | bool isFlying, string version) |
1705 | { | 1732 | { |
1733 | |||
1706 | agent.ControllingClient.RequestClientInfo(); | 1734 | agent.ControllingClient.RequestClientInfo(); |
1707 | 1735 | ||
1708 | string agentcaps; | 1736 | string agentcaps; |
@@ -1714,6 +1742,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1714 | } | 1742 | } |
1715 | 1743 | ||
1716 | // No turning back | 1744 | // No turning back |
1745 | |||
1746 | |||
1747 | |||
1717 | agent.IsChildAgent = true; | 1748 | agent.IsChildAgent = true; |
1718 | 1749 | ||
1719 | string capsPath = neighbourRegion.ServerURI + CapsUtil.GetCapsSeedPath(agentcaps); | 1750 | string capsPath = neighbourRegion.ServerURI + CapsUtil.GetCapsSeedPath(agentcaps); |
@@ -1737,12 +1768,25 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1737 | capsPath); | 1768 | capsPath); |
1738 | } | 1769 | } |
1739 | 1770 | ||
1771 | // Backwards compatibility. Best effort | ||
1772 | if (version == "Unknown" || version == string.Empty) | ||
1773 | { | ||
1774 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: neighbor with old version, passing attachments one by one..."); | ||
1775 | Thread.Sleep(3000); // wait a little now that we're not waiting for the callback | ||
1776 | CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true); | ||
1777 | } | ||
1778 | |||
1740 | // SUCCESS! | 1779 | // SUCCESS! |
1741 | m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.ReceivedAtDestination); | 1780 | m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.ReceivedAtDestination); |
1742 | 1781 | ||
1743 | // Unlike a teleport, here we do not wait for the destination region to confirm the receipt. | 1782 | // Unlike a teleport, here we do not wait for the destination region to confirm the receipt. |
1744 | m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.CleaningUp); | 1783 | m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.CleaningUp); |
1745 | 1784 | ||
1785 | // this may need the attachments | ||
1786 | agent.parcelRegionCross(); | ||
1787 | |||
1788 | AgentHasMovedAway(agent, true); | ||
1789 | |||
1746 | agent.MakeChildAgent(); | 1790 | agent.MakeChildAgent(); |
1747 | 1791 | ||
1748 | // FIXME: Possibly this should occur lower down after other commands to close other agents, | 1792 | // FIXME: Possibly this should occur lower down after other commands to close other agents, |
@@ -1756,16 +1800,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1756 | // agent.SendOtherAgentsAvatarDataToMe(); | 1800 | // agent.SendOtherAgentsAvatarDataToMe(); |
1757 | // agent.SendOtherAgentsAppearanceToMe(); | 1801 | // agent.SendOtherAgentsAppearanceToMe(); |
1758 | 1802 | ||
1759 | agent.parcelRegionCross(false); | ||
1760 | |||
1761 | // Backwards compatibility. Best effort | ||
1762 | if (version == "Unknown" || version == string.Empty) | ||
1763 | { | ||
1764 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: neighbor with old version, passing attachments one by one..."); | ||
1765 | Thread.Sleep(3000); // wait a little now that we're not waiting for the callback | ||
1766 | CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true); | ||
1767 | } | ||
1768 | |||
1769 | // Next, let's close the child agent connections that are too far away. | 1803 | // Next, let's close the child agent connections that are too far away. |
1770 | uint neighbourx; | 1804 | uint neighbourx; |
1771 | uint neighboury; | 1805 | uint neighboury; |
@@ -1777,7 +1811,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1777 | 1811 | ||
1778 | agent.CloseChildAgents(neighbourx, neighboury); | 1812 | agent.CloseChildAgents(neighbourx, neighboury); |
1779 | 1813 | ||
1780 | AgentHasMovedAway(agent, false); | 1814 | |
1781 | 1815 | ||
1782 | // the user may change their profile information in other region, | 1816 | // the user may change their profile information in other region, |
1783 | // so the userinfo in UserProfileCache is not reliable any more, delete it | 1817 | // so the userinfo in UserProfileCache is not reliable any more, delete it |
@@ -1817,7 +1851,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1817 | #region Enable Child Agent | 1851 | #region Enable Child Agent |
1818 | 1852 | ||
1819 | /// <summary> | 1853 | /// <summary> |
1820 | /// This informs a single neighbouring region about agent "avatar". | 1854 | /// This informs a single neighbouring region about agent "avatar", and avatar about it |
1821 | /// Calls an asynchronous method to do so.. so it doesn't lag the sim. | 1855 | /// Calls an asynchronous method to do so.. so it doesn't lag the sim. |
1822 | /// </summary> | 1856 | /// </summary> |
1823 | /// <param name="sp"></param> | 1857 | /// <param name="sp"></param> |
@@ -1833,8 +1867,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1833 | agent.startpos = new Vector3(128, 128, 70); | 1867 | agent.startpos = new Vector3(128, 128, 70); |
1834 | agent.child = true; | 1868 | agent.child = true; |
1835 | 1869 | ||
1836 | //agent.Appearance = sp.Appearance; | 1870 | agent.Appearance = new AvatarAppearance(); |
1837 | agent.Appearance = new AvatarAppearance(sp.Appearance, true, false); // guess this should be a lot less | 1871 | agent.Appearance.AvatarHeight = sp.Appearance.AvatarHeight; |
1838 | 1872 | ||
1839 | agent.CapsPath = CapsUtil.GetRandomCapsObjectPath(); | 1873 | agent.CapsPath = CapsUtil.GetRandomCapsObjectPath(); |
1840 | 1874 | ||
@@ -1866,6 +1900,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1866 | agent.Id0 = currentAgentCircuit.Id0; | 1900 | agent.Id0 = currentAgentCircuit.Id0; |
1867 | } | 1901 | } |
1868 | 1902 | ||
1903 | Thread.Sleep(200); // the original delay that was at InformClientOfNeighbourAsync start | ||
1904 | |||
1869 | IPEndPoint external = region.ExternalEndPoint; | 1905 | IPEndPoint external = region.ExternalEndPoint; |
1870 | if (external != null) | 1906 | if (external != null) |
1871 | { | 1907 | { |
@@ -1884,6 +1920,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1884 | 1920 | ||
1885 | /// <summary> | 1921 | /// <summary> |
1886 | /// This informs all neighbouring regions about agent "avatar". | 1922 | /// This informs all neighbouring regions about agent "avatar". |
1923 | /// and as important informs the avatar about then | ||
1887 | /// </summary> | 1924 | /// </summary> |
1888 | /// <param name="sp"></param> | 1925 | /// <param name="sp"></param> |
1889 | public void EnableChildAgents(ScenePresence sp) | 1926 | public void EnableChildAgents(ScenePresence sp) |
@@ -1900,81 +1937,77 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1900 | m_log.Debug("[ENTITY TRANSFER MODULE]: m_regionInfo was null in EnableChildAgents, is this a NPC?"); | 1937 | m_log.Debug("[ENTITY TRANSFER MODULE]: m_regionInfo was null in EnableChildAgents, is this a NPC?"); |
1901 | } | 1938 | } |
1902 | 1939 | ||
1903 | /// We need to find the difference between the new regions where there are no child agents | 1940 | LinkedList<ulong> previousRegionNeighbourHandles; |
1904 | /// and the regions where there are already child agents. We only send notification to the former. | 1941 | |
1905 | List<ulong> neighbourHandles = NeighbourHandles(neighbours); // on this region | 1942 | Dictionary<ulong, string> seeds; |
1906 | neighbourHandles.Add(sp.Scene.RegionInfo.RegionHandle); // add this region too | ||
1907 | List<ulong> previousRegionNeighbourHandles; | ||
1908 | 1943 | ||
1909 | if (sp.Scene.CapsModule != null) | 1944 | if (sp.Scene.CapsModule != null) |
1910 | { | 1945 | { |
1911 | previousRegionNeighbourHandles = | 1946 | seeds = new Dictionary<ulong, string>(sp.Scene.CapsModule.GetChildrenSeeds(sp.UUID)); |
1912 | new List<ulong>(sp.Scene.CapsModule.GetChildrenSeeds(sp.UUID).Keys); | 1947 | previousRegionNeighbourHandles = new LinkedList<ulong>(seeds.Keys); |
1913 | } | 1948 | } |
1914 | else | 1949 | else |
1915 | { | 1950 | { |
1916 | previousRegionNeighbourHandles = new List<ulong>(); | ||
1917 | } | ||
1918 | |||
1919 | List<ulong> newRegions = NewNeighbours(neighbourHandles, previousRegionNeighbourHandles); | ||
1920 | List<ulong> oldRegions = OldNeighbours(neighbourHandles, previousRegionNeighbourHandles); | ||
1921 | |||
1922 | // Dump("Current Neighbors", neighbourHandles); | ||
1923 | // Dump("Previous Neighbours", previousRegionNeighbourHandles); | ||
1924 | // Dump("New Neighbours", newRegions); | ||
1925 | // Dump("Old Neighbours", oldRegions); | ||
1926 | |||
1927 | /// Update the scene presence's known regions here on this region | ||
1928 | sp.DropOldNeighbours(oldRegions); | ||
1929 | |||
1930 | /// Collect as many seeds as possible | ||
1931 | Dictionary<ulong, string> seeds; | ||
1932 | if (sp.Scene.CapsModule != null) | ||
1933 | seeds = new Dictionary<ulong, string>(sp.Scene.CapsModule.GetChildrenSeeds(sp.UUID)); | ||
1934 | else | ||
1935 | seeds = new Dictionary<ulong, string>(); | 1951 | seeds = new Dictionary<ulong, string>(); |
1952 | previousRegionNeighbourHandles = new LinkedList<ulong>(); | ||
1953 | } | ||
1936 | 1954 | ||
1937 | //m_log.Debug(" !!! No. of seeds: " + seeds.Count); | ||
1938 | if (!seeds.ContainsKey(sp.Scene.RegionInfo.RegionHandle)) | 1955 | if (!seeds.ContainsKey(sp.Scene.RegionInfo.RegionHandle)) |
1939 | seeds.Add(sp.Scene.RegionInfo.RegionHandle, sp.ControllingClient.RequestClientInfo().CapsPath); | 1956 | seeds.Add(sp.Scene.RegionInfo.RegionHandle, sp.ControllingClient.RequestClientInfo().CapsPath); |
1940 | 1957 | ||
1941 | /// Create the necessary child agents | 1958 | AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); |
1959 | |||
1960 | List<ulong> newneighbours = new List<ulong>(); | ||
1942 | List<AgentCircuitData> cagents = new List<AgentCircuitData>(); | 1961 | List<AgentCircuitData> cagents = new List<AgentCircuitData>(); |
1962 | |||
1963 | ulong currentRegionHandler = sp.Scene.RegionInfo.RegionHandle; | ||
1964 | |||
1943 | foreach (GridRegion neighbour in neighbours) | 1965 | foreach (GridRegion neighbour in neighbours) |
1944 | { | 1966 | { |
1945 | if (neighbour.RegionHandle != sp.Scene.RegionInfo.RegionHandle) | 1967 | ulong handler = neighbour.RegionHandle; |
1946 | { | ||
1947 | AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); | ||
1948 | AgentCircuitData agent = sp.ControllingClient.RequestClientInfo(); | ||
1949 | agent.BaseFolder = UUID.Zero; | ||
1950 | agent.InventoryFolder = UUID.Zero; | ||
1951 | agent.startpos = sp.AbsolutePosition + CalculateOffset(sp, neighbour); | ||
1952 | agent.child = true; | ||
1953 | // agent.Appearance = sp.Appearance; | ||
1954 | agent.Appearance = new AvatarAppearance(sp.Appearance, true, false); // guess this should be a lot less | ||
1955 | if (currentAgentCircuit != null) | ||
1956 | { | ||
1957 | agent.ServiceURLs = currentAgentCircuit.ServiceURLs; | ||
1958 | agent.IPAddress = currentAgentCircuit.IPAddress; | ||
1959 | agent.Viewer = currentAgentCircuit.Viewer; | ||
1960 | agent.Channel = currentAgentCircuit.Channel; | ||
1961 | agent.Mac = currentAgentCircuit.Mac; | ||
1962 | agent.Id0 = currentAgentCircuit.Id0; | ||
1963 | } | ||
1964 | 1968 | ||
1965 | if (newRegions.Contains(neighbour.RegionHandle)) | 1969 | if (handler == currentRegionHandler) |
1966 | { | 1970 | continue; |
1967 | agent.CapsPath = CapsUtil.GetRandomCapsObjectPath(); | 1971 | |
1968 | sp.AddNeighbourRegion(neighbour.RegionHandle, agent.CapsPath); | 1972 | AgentCircuitData agent = sp.ControllingClient.RequestClientInfo(); |
1969 | seeds.Add(neighbour.RegionHandle, agent.CapsPath); | 1973 | agent.BaseFolder = UUID.Zero; |
1970 | } | 1974 | agent.InventoryFolder = UUID.Zero; |
1971 | else | 1975 | agent.startpos = sp.AbsolutePosition + CalculateOffset(sp, neighbour); |
1972 | { | 1976 | agent.child = true; |
1973 | agent.CapsPath = sp.Scene.CapsModule.GetChildSeed(sp.UUID, neighbour.RegionHandle); | 1977 | agent.Appearance = new AvatarAppearance(); |
1974 | } | 1978 | agent.Appearance.AvatarHeight = sp.Appearance.AvatarHeight; |
1979 | |||
1980 | if (currentAgentCircuit != null) | ||
1981 | { | ||
1982 | agent.ServiceURLs = currentAgentCircuit.ServiceURLs; | ||
1983 | agent.IPAddress = currentAgentCircuit.IPAddress; | ||
1984 | agent.Viewer = currentAgentCircuit.Viewer; | ||
1985 | agent.Channel = currentAgentCircuit.Channel; | ||
1986 | agent.Mac = currentAgentCircuit.Mac; | ||
1987 | agent.Id0 = currentAgentCircuit.Id0; | ||
1988 | } | ||
1975 | 1989 | ||
1976 | cagents.Add(agent); | 1990 | if (previousRegionNeighbourHandles.Contains(handler)) |
1991 | { | ||
1992 | previousRegionNeighbourHandles.Remove(handler); | ||
1993 | agent.CapsPath = sp.Scene.CapsModule.GetChildSeed(sp.UUID, handler); | ||
1977 | } | 1994 | } |
1995 | else | ||
1996 | { | ||
1997 | newneighbours.Add(handler); | ||
1998 | agent.CapsPath = CapsUtil.GetRandomCapsObjectPath(); | ||
1999 | sp.AddNeighbourRegion(handler, agent.CapsPath); | ||
2000 | seeds.Add(handler, agent.CapsPath); | ||
2001 | } | ||
2002 | |||
2003 | cagents.Add(agent); | ||
2004 | } | ||
2005 | |||
2006 | //sp.DropOldNeighbours(previousRegionNeighbourHandles); | ||
2007 | foreach (ulong handle in previousRegionNeighbourHandles) | ||
2008 | { | ||
2009 | sp.RemoveNeighbourRegion(handle); | ||
2010 | Scene.CapsModule.DropChildSeed(sp.UUID, handle); | ||
1978 | } | 2011 | } |
1979 | 2012 | ||
1980 | /// Update all child agent with everyone's seeds | 2013 | /// Update all child agent with everyone's seeds |
@@ -1987,34 +2020,23 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1987 | { | 2020 | { |
1988 | sp.Scene.CapsModule.SetChildrenSeed(sp.UUID, seeds); | 2021 | sp.Scene.CapsModule.SetChildrenSeed(sp.UUID, seeds); |
1989 | } | 2022 | } |
2023 | |||
1990 | sp.KnownRegions = seeds; | 2024 | sp.KnownRegions = seeds; |
1991 | //avatar.Scene.DumpChildrenSeeds(avatar.UUID); | 2025 | //avatar.Scene.DumpChildrenSeeds(avatar.UUID); |
1992 | //avatar.DumpKnownRegions(); | 2026 | //avatar.DumpKnownRegions(); |
1993 | 2027 | ||
1994 | bool newAgent = false; | 2028 | Util.FireAndForget(delegate |
1995 | int count = 0; | ||
1996 | foreach (GridRegion neighbour in neighbours) | ||
1997 | { | 2029 | { |
1998 | //m_log.WarnFormat("--> Going to send child agent to {0}", neighbour.RegionName); | 2030 | Thread.Sleep(200); // the original delay that was at InformClientOfNeighbourAsync start |
1999 | // Don't do it if there's already an agent in that region | 2031 | int count = 0; |
2000 | if (newRegions.Contains(neighbour.RegionHandle)) | 2032 | bool newagent; |
2001 | newAgent = true; | ||
2002 | else | ||
2003 | newAgent = false; | ||
2004 | // continue; | ||
2005 | 2033 | ||
2006 | if (neighbour.RegionHandle != sp.Scene.RegionInfo.RegionHandle) | 2034 | foreach (GridRegion neighbour in neighbours) |
2007 | { | 2035 | { |
2008 | try | 2036 | try |
2009 | { | 2037 | { |
2010 | // Let's put this back at sync, so that it doesn't clog | 2038 | newagent = newneighbours.Contains(neighbour.RegionHandle); |
2011 | // the network, especially for regions in the same physical server. | 2039 | InformClientOfNeighbourAsync(sp, cagents[count], neighbour, neighbour.ExternalEndPoint, newagent); |
2012 | // We're really not in a hurry here. | ||
2013 | InformClientOfNeighbourAsync(sp, cagents[count], neighbour, neighbour.ExternalEndPoint, newAgent); | ||
2014 | //InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; | ||
2015 | //d.BeginInvoke(sp, cagents[count], neighbour, neighbour.ExternalEndPoint, newAgent, | ||
2016 | // InformClientOfNeighbourCompleted, | ||
2017 | // d); | ||
2018 | } | 2040 | } |
2019 | 2041 | ||
2020 | catch (ArgumentOutOfRangeException) | 2042 | catch (ArgumentOutOfRangeException) |
@@ -2022,9 +2044,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2022 | m_log.ErrorFormat( | 2044 | m_log.ErrorFormat( |
2023 | "[ENTITY TRANSFER MODULE]: Neighbour Regions response included the current region in the neighbour list. The following region will not display to the client: {0} for region {1} ({2}, {3}).", | 2045 | "[ENTITY TRANSFER MODULE]: Neighbour Regions response included the current region in the neighbour list. The following region will not display to the client: {0} for region {1} ({2}, {3}).", |
2024 | neighbour.ExternalHostName, | 2046 | neighbour.ExternalHostName, |
2025 | neighbour.RegionHandle, | 2047 | neighbour.RegionHandle, |
2026 | neighbour.RegionLocX, | 2048 | neighbour.RegionLocX, |
2027 | neighbour.RegionLocY); | 2049 | neighbour.RegionLocY); |
2028 | } | 2050 | } |
2029 | catch (Exception e) | 2051 | catch (Exception e) |
2030 | { | 2052 | { |
@@ -2041,11 +2063,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2041 | 2063 | ||
2042 | // XXX: Well, decided to swallow the exception instead for now. Let us see how that goes. | 2064 | // XXX: Well, decided to swallow the exception instead for now. Let us see how that goes. |
2043 | // throw e; | 2065 | // throw e; |
2044 | |||
2045 | } | 2066 | } |
2067 | count++; | ||
2046 | } | 2068 | } |
2047 | count++; | 2069 | }); |
2048 | } | ||
2049 | } | 2070 | } |
2050 | 2071 | ||
2051 | Vector3 CalculateOffset(ScenePresence sp, GridRegion neighbour) | 2072 | Vector3 CalculateOffset(ScenePresence sp, GridRegion neighbour) |
@@ -2079,11 +2100,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2079 | private void InformClientOfNeighbourAsync(ScenePresence sp, AgentCircuitData a, GridRegion reg, | 2100 | private void InformClientOfNeighbourAsync(ScenePresence sp, AgentCircuitData a, GridRegion reg, |
2080 | IPEndPoint endPoint, bool newAgent) | 2101 | IPEndPoint endPoint, bool newAgent) |
2081 | { | 2102 | { |
2082 | // Let's wait just a little to give time to originating regions to catch up with closing child agents | 2103 | Scene scene = sp.Scene; |
2083 | // after a cross here | 2104 | if (!newAgent) |
2084 | Thread.Sleep(500); | 2105 | return; |
2085 | |||
2086 | Scene scene = sp.Scene; | ||
2087 | 2106 | ||
2088 | m_log.DebugFormat( | 2107 | m_log.DebugFormat( |
2089 | "[ENTITY TRANSFER MODULE]: Informing {0} {1} about neighbour {2} {3} at ({4},{5})", | 2108 | "[ENTITY TRANSFER MODULE]: Informing {0} {1} about neighbour {2} {3} at ({4},{5})", |
@@ -2097,6 +2116,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2097 | 2116 | ||
2098 | if (regionAccepted && newAgent) | 2117 | if (regionAccepted && newAgent) |
2099 | { | 2118 | { |
2119 | // give time for createAgent to finish, since it is async and does grid services access | ||
2120 | Thread.Sleep(500); | ||
2121 | |||
2100 | if (m_eqModule != null) | 2122 | if (m_eqModule != null) |
2101 | { | 2123 | { |
2102 | #region IP Translation for NAT | 2124 | #region IP Translation for NAT |