diff options
author | UbitUmarov | 2015-08-30 19:17:35 +0100 |
---|---|---|
committer | UbitUmarov | 2015-08-30 19:17:35 +0100 |
commit | 0edffae7e42c0705303e015036fa85687508ecf0 (patch) | |
tree | ba27f1567c7c351e4befd032b948fb3423fa0ca4 /OpenSim/Region/CoreModules | |
parent | cache in memory water texture (diff) | |
download | opensim-SC_OLD-0edffae7e42c0705303e015036fa85687508ecf0.zip opensim-SC_OLD-0edffae7e42c0705303e015036fa85687508ecf0.tar.gz opensim-SC_OLD-0edffae7e42c0705303e015036fa85687508ecf0.tar.bz2 opensim-SC_OLD-0edffae7e42c0705303e015036fa85687508ecf0.tar.xz |
more on tps and crossings
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | 239 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | 6 |
2 files changed, 117 insertions, 128 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 49d3b9b..efee080 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -724,10 +724,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
724 | return; | 724 | return; |
725 | } | 725 | } |
726 | 726 | ||
727 | uint newRegionX, newRegionY, oldRegionX, oldRegionY; | ||
728 | Util.RegionHandleToRegionLoc(reg.RegionHandle, out newRegionX, out newRegionY); | ||
729 | Util.RegionHandleToRegionLoc(sp.Scene.RegionInfo.RegionHandle, out oldRegionX, out oldRegionY); | ||
730 | |||
731 | ulong destinationHandle = finalDestination.RegionHandle; | 727 | ulong destinationHandle = finalDestination.RegionHandle; |
732 | 728 | ||
733 | // Let's do DNS resolution only once in this process, please! | 729 | // Let's do DNS resolution only once in this process, please! |
@@ -815,7 +811,19 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
815 | } | 811 | } |
816 | 812 | ||
817 | IClientIPEndpoint ipepClient; | 813 | IClientIPEndpoint ipepClient; |
818 | if (NeedsNewAgent(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY)) | 814 | |
815 | uint newRegionX, newRegionY, oldRegionX, oldRegionY; | ||
816 | Util.RegionHandleToRegionLoc(destinationHandle, out newRegionX, out newRegionY); | ||
817 | Util.RegionHandleToRegionLoc(sourceRegion.RegionHandle, out oldRegionX, out oldRegionY); | ||
818 | int oldSizeX = (int)sourceRegion.RegionSizeX; | ||
819 | int oldSizeY = (int)sourceRegion.RegionSizeY; | ||
820 | int newSizeX = finalDestination.RegionSizeX; | ||
821 | int newSizeY = finalDestination.RegionSizeY; | ||
822 | |||
823 | bool OutSideViewRange = NeedsNewAgent(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY, | ||
824 | oldSizeX, oldSizeY, newSizeX, newSizeY); | ||
825 | |||
826 | if (OutSideViewRange) | ||
819 | { | 827 | { |
820 | m_log.DebugFormat( | 828 | m_log.DebugFormat( |
821 | "[ENTITY TRANSFER MODULE]: Determined that region {0} at {1},{2} needs new child agent for agent {3} from {4}", | 829 | "[ENTITY TRANSFER MODULE]: Determined that region {0} at {1},{2} needs new child agent for agent {3} from {4}", |
@@ -846,13 +854,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
846 | float.TryParse(versionComponents[1], out versionNumber); | 854 | float.TryParse(versionComponents[1], out versionNumber); |
847 | 855 | ||
848 | if (versionNumber >= 0.2f && MaxOutgoingTransferVersion >= versionNumber) | 856 | if (versionNumber >= 0.2f && MaxOutgoingTransferVersion >= versionNumber) |
849 | TransferAgent_V2(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, oldRegionX, newRegionX, oldRegionY, newRegionY, version, out reason); | 857 | TransferAgent_V2(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, OutSideViewRange , version, out reason); |
850 | else | 858 | else |
851 | TransferAgent_V1(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, oldRegionX, newRegionX, oldRegionY, newRegionY, version, out reason); | 859 | TransferAgent_V1(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, OutSideViewRange, version, out reason); |
852 | } | 860 | } |
853 | 861 | ||
854 | private void TransferAgent_V1(ScenePresence sp, AgentCircuitData agentCircuit, GridRegion reg, GridRegion finalDestination, | 862 | private void TransferAgent_V1(ScenePresence sp, AgentCircuitData agentCircuit, GridRegion reg, GridRegion finalDestination, |
855 | IPEndPoint endPoint, uint teleportFlags, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, string version, out string reason) | 863 | IPEndPoint endPoint, uint teleportFlags, bool OutSideViewRange, string version, out string reason) |
856 | { | 864 | { |
857 | ulong destinationHandle = finalDestination.RegionHandle; | 865 | ulong destinationHandle = finalDestination.RegionHandle; |
858 | AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); | 866 | AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); |
@@ -904,9 +912,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
904 | m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.Transferring); | 912 | m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.Transferring); |
905 | 913 | ||
906 | // OK, it got this agent. Let's close some child agents | 914 | // OK, it got this agent. Let's close some child agents |
907 | |||
908 | 915 | ||
909 | if (NeedsNewAgent(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY)) | 916 | |
917 | if (OutSideViewRange) | ||
910 | { | 918 | { |
911 | if (m_eqModule != null) | 919 | if (m_eqModule != null) |
912 | { | 920 | { |
@@ -1065,17 +1073,16 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1065 | // Well, this is it. The agent is over there. | 1073 | // Well, this is it. The agent is over there. |
1066 | // KillEntity(sp.Scene, sp.LocalId); | 1074 | // KillEntity(sp.Scene, sp.LocalId); |
1067 | 1075 | ||
1068 | bool l_needsclosing = NeedsClosing(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY, reg); | 1076 | sp.HasMovedAway(!OutSideViewRange); |
1069 | sp.HasMovedAway(!l_needsclosing); | ||
1070 | 1077 | ||
1071 | sp.CloseChildAgents(newRegionX, newRegionY); | 1078 | sp.CloseChildAgents(destinationHandle,finalDestination.RegionSizeX,finalDestination.RegionSizeY); |
1072 | 1079 | ||
1073 | // Now let's make it officially a child agent | 1080 | // Now let's make it officially a child agent |
1074 | sp.MakeChildAgent(destinationHandle); | 1081 | sp.MakeChildAgent(destinationHandle); |
1075 | 1082 | ||
1076 | // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone | 1083 | // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone |
1077 | 1084 | ||
1078 | if (l_needsclosing) | 1085 | if (OutSideViewRange) |
1079 | { | 1086 | { |
1080 | if (!sp.Scene.IncomingPreCloseClient(sp)) | 1087 | if (!sp.Scene.IncomingPreCloseClient(sp)) |
1081 | return; | 1088 | return; |
@@ -1090,17 +1097,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1090 | 1097 | ||
1091 | sp.Scene.CloseAgent(sp.UUID, false); | 1098 | sp.Scene.CloseAgent(sp.UUID, false); |
1092 | } | 1099 | } |
1093 | /* | ||
1094 | else | ||
1095 | { | ||
1096 | // now we have a child agent in this region. | ||
1097 | sp.Reset(); | ||
1098 | } | ||
1099 | */ | ||
1100 | } | 1100 | } |
1101 | 1101 | ||
1102 | private void TransferAgent_V2(ScenePresence sp, AgentCircuitData agentCircuit, GridRegion reg, GridRegion finalDestination, | 1102 | private void TransferAgent_V2(ScenePresence sp, AgentCircuitData agentCircuit, GridRegion reg, GridRegion finalDestination, |
1103 | IPEndPoint endPoint, uint teleportFlags, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, string version, out string reason) | 1103 | IPEndPoint endPoint, uint teleportFlags, bool OutSideViewRange, string version, out string reason) |
1104 | { | 1104 | { |
1105 | ulong destinationHandle = finalDestination.RegionHandle; | 1105 | ulong destinationHandle = finalDestination.RegionHandle; |
1106 | AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); | 1106 | AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); |
@@ -1207,8 +1207,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1207 | 1207 | ||
1208 | m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.CleaningUp); | 1208 | m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.CleaningUp); |
1209 | 1209 | ||
1210 | bool l_needsclosing = NeedsClosing(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY, reg); | 1210 | sp.HasMovedAway(!OutSideViewRange); |
1211 | sp.HasMovedAway(!l_needsclosing); | ||
1212 | 1211 | ||
1213 | // Need to signal neighbours whether child agents may need closing irrespective of whether this | 1212 | // Need to signal neighbours whether child agents may need closing irrespective of whether this |
1214 | // one needed closing. We also need to close child agents as quickly as possible to avoid complicated | 1213 | // one needed closing. We also need to close child agents as quickly as possible to avoid complicated |
@@ -1216,7 +1215,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1216 | // to a neighbour A2 then off to a non-neighbour C). Closing child agents any later requires complex | 1215 | // to a neighbour A2 then off to a non-neighbour C). Closing child agents any later requires complex |
1217 | // distributed checks to avoid problems in rapid reteleporting scenarios and where child agents are | 1216 | // distributed checks to avoid problems in rapid reteleporting scenarios and where child agents are |
1218 | // abandoned without proper close by viewer but then re-used by an incoming connection. | 1217 | // abandoned without proper close by viewer but then re-used by an incoming connection. |
1219 | sp.CloseChildAgents(newRegionX, newRegionY); | 1218 | sp.CloseChildAgents(destinationHandle, finalDestination.RegionSizeX, finalDestination.RegionSizeY); |
1220 | 1219 | ||
1221 | // AgentHasMovedAway(sp, true); | 1220 | // AgentHasMovedAway(sp, true); |
1222 | // Well, this is it. The agent is over there. | 1221 | // Well, this is it. The agent is over there. |
@@ -1226,7 +1225,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1226 | sp.MakeChildAgent(destinationHandle); | 1225 | sp.MakeChildAgent(destinationHandle); |
1227 | 1226 | ||
1228 | // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone | 1227 | // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone |
1229 | if (l_needsclosing) | 1228 | if (OutSideViewRange) |
1230 | { | 1229 | { |
1231 | if (!sp.Scene.IncomingPreCloseClient(sp)) | 1230 | if (!sp.Scene.IncomingPreCloseClient(sp)) |
1232 | return; | 1231 | return; |
@@ -1350,7 +1349,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1350 | // This returns 'true' if the new region already has a child agent for our | 1349 | // This returns 'true' if the new region already has a child agent for our |
1351 | // incoming agent. The implication is that, if 'false', we have to create the | 1350 | // incoming agent. The implication is that, if 'false', we have to create the |
1352 | // child and then teleport into the region. | 1351 | // child and then teleport into the region. |
1353 | protected virtual bool NeedsNewAgent(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY) | 1352 | protected virtual bool NeedsNewAgent(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, |
1353 | int oldsizeX, int oldsizeY, int newsizeX, int newsizeY) | ||
1354 | { | 1354 | { |
1355 | if (m_regionCombinerModule != null && m_regionCombinerModule.IsRootForMegaregion(Scene.RegionInfo.RegionID)) | 1355 | if (m_regionCombinerModule != null && m_regionCombinerModule.IsRootForMegaregion(Scene.RegionInfo.RegionID)) |
1356 | { | 1356 | { |
@@ -1363,17 +1363,19 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1363 | 1363 | ||
1364 | return !(newRegionX >= swCorner.X && newRegionX <= neCorner.X && newRegionY >= swCorner.Y && newRegionY <= neCorner.Y); | 1364 | return !(newRegionX >= swCorner.X && newRegionX <= neCorner.X && newRegionY >= swCorner.Y && newRegionY <= neCorner.Y); |
1365 | } | 1365 | } |
1366 | else | ||
1367 | { | ||
1368 | return Util.IsOutsideView(drawdist, oldRegionX, newRegionX, oldRegionY, newRegionY); | ||
1369 | } | ||
1370 | } | ||
1371 | 1366 | ||
1372 | protected virtual bool NeedsClosing(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, GridRegion reg) | 1367 | return Util.IsOutsideView(drawdist, oldRegionX, newRegionX, oldRegionY, newRegionY, |
1373 | { | 1368 | oldsizeX, oldsizeY, newsizeX, newsizeY); |
1374 | return Util.IsOutsideView(drawdist, oldRegionX, newRegionX, oldRegionY, newRegionY); | ||
1375 | } | 1369 | } |
1370 | /* | ||
1371 | protected virtual bool NeedsClosing(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, | ||
1372 | uint oldsizeX, uint oldsizeY, uint newsizeX, uint newsizeY, GridRegion reg) | ||
1373 | { | ||
1376 | 1374 | ||
1375 | return Util.IsOutsideView(drawdist, oldRegionX, newRegionX, oldRegionY, newRegionY, | ||
1376 | oldsizeX, oldsizeY, newsizeX, newsizeY); | ||
1377 | } | ||
1378 | */ | ||
1377 | #endregion | 1379 | #endregion |
1378 | 1380 | ||
1379 | #region Landmark Teleport | 1381 | #region Landmark Teleport |
@@ -1830,9 +1832,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1830 | // this may need the attachments | 1832 | // this may need the attachments |
1831 | 1833 | ||
1832 | agent.HasMovedAway(true); | 1834 | agent.HasMovedAway(true); |
1833 | // agent.parcelRegionCross(); | ||
1834 | |||
1835 | // AgentHasMovedAway(agent, true); | ||
1836 | 1835 | ||
1837 | agent.MakeChildAgent(neighbourRegion.RegionHandle); | 1836 | agent.MakeChildAgent(neighbourRegion.RegionHandle); |
1838 | 1837 | ||
@@ -1840,19 +1839,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1840 | // but not sure yet what the side effects would be. | 1839 | // but not sure yet what the side effects would be. |
1841 | m_entityTransferStateMachine.ResetFromTransit(agent.UUID); | 1840 | m_entityTransferStateMachine.ResetFromTransit(agent.UUID); |
1842 | 1841 | ||
1843 | // now we have a child agent in this region. Request all interesting data about other (root) agents | 1842 | agent.CloseChildAgents(neighbourRegion.RegionHandle, neighbourRegion.RegionSizeX, neighbourRegion.RegionSizeY); |
1844 | |||
1845 | // why do that? we either where a root having all that or we are leaving the area | ||
1846 | 1843 | ||
1847 | // agent.SendOtherAgentsAvatarDataToMe(); | ||
1848 | // agent.SendOtherAgentsAppearanceToMe(); | ||
1849 | |||
1850 | // Next, let's close the child agent connections that are too far away. | ||
1851 | uint neighbourx; | ||
1852 | uint neighboury; | ||
1853 | Util.RegionHandleToRegionLoc(neighbourRegion.RegionHandle, out neighbourx, out neighboury); | ||
1854 | |||
1855 | agent.CloseChildAgents(neighbourx, neighboury); | ||
1856 | 1844 | ||
1857 | // the user may change their profile information in other region, | 1845 | // the user may change their profile information in other region, |
1858 | // so the userinfo in UserProfileCache is not reliable any more, delete it | 1846 | // so the userinfo in UserProfileCache is not reliable any more, delete it |
@@ -1908,12 +1896,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1908 | 1896 | ||
1909 | if (seeds.ContainsKey(regionhandler)) | 1897 | if (seeds.ContainsKey(regionhandler)) |
1910 | seeds.Remove(regionhandler); | 1898 | seeds.Remove(regionhandler); |
1911 | 1899 | /* | |
1912 | List<ulong> oldregions = new List<ulong>(seeds.Keys); | 1900 | List<ulong> oldregions = new List<ulong>(seeds.Keys); |
1913 | 1901 | ||
1914 | if (oldregions.Contains(currentRegionHandler)) | 1902 | if (oldregions.Contains(currentRegionHandler)) |
1915 | oldregions.Remove(currentRegionHandler); | 1903 | oldregions.Remove(currentRegionHandler); |
1916 | 1904 | */ | |
1917 | if (!seeds.ContainsKey(currentRegionHandler)) | 1905 | if (!seeds.ContainsKey(currentRegionHandler)) |
1918 | seeds.Add(currentRegionHandler, sp.ControllingClient.RequestClientInfo().CapsPath); | 1906 | seeds.Add(currentRegionHandler, sp.ControllingClient.RequestClientInfo().CapsPath); |
1919 | 1907 | ||
@@ -1927,6 +1915,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1927 | agent.Appearance.AvatarHeight = sp.Appearance.AvatarHeight; | 1915 | agent.Appearance.AvatarHeight = sp.Appearance.AvatarHeight; |
1928 | 1916 | ||
1929 | agent.CapsPath = CapsUtil.GetRandomCapsObjectPath(); | 1917 | agent.CapsPath = CapsUtil.GetRandomCapsObjectPath(); |
1918 | |||
1930 | seeds.Add(regionhandler, agent.CapsPath); | 1919 | seeds.Add(regionhandler, agent.CapsPath); |
1931 | 1920 | ||
1932 | // agent.ChildrenCapSeeds = new Dictionary<ulong, string>(seeds); | 1921 | // agent.ChildrenCapSeeds = new Dictionary<ulong, string>(seeds); |
@@ -1936,7 +1925,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1936 | { | 1925 | { |
1937 | sp.Scene.CapsModule.SetChildrenSeed(sp.UUID, seeds); | 1926 | sp.Scene.CapsModule.SetChildrenSeed(sp.UUID, seeds); |
1938 | } | 1927 | } |
1928 | |||
1939 | sp.KnownRegions = seeds; | 1929 | sp.KnownRegions = seeds; |
1930 | sp.AddNeighbourRegionSizeInfo(region); | ||
1940 | 1931 | ||
1941 | if (currentAgentCircuit != null) | 1932 | if (currentAgentCircuit != null) |
1942 | { | 1933 | { |
@@ -2012,7 +2003,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2012 | 2003 | ||
2013 | if (m_regionInfo != null) | 2004 | if (m_regionInfo != null) |
2014 | { | 2005 | { |
2015 | neighbours = GetNeighbours(sp, m_regionInfo.RegionLocX, m_regionInfo.RegionLocY); | 2006 | neighbours = GetNeighbors(sp, m_regionInfo.RegionLocX, m_regionInfo.RegionLocY); |
2016 | } | 2007 | } |
2017 | else | 2008 | else |
2018 | { | 2009 | { |
@@ -2024,7 +2015,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2024 | LinkedList<ulong> previousRegionNeighbourHandles; | 2015 | LinkedList<ulong> previousRegionNeighbourHandles; |
2025 | Dictionary<ulong, string> seeds; | 2016 | Dictionary<ulong, string> seeds; |
2026 | ICapabilitiesModule capsModule = spScene.CapsModule; | 2017 | ICapabilitiesModule capsModule = spScene.CapsModule; |
2027 | 2018 | ||
2028 | if (capsModule != null) | 2019 | if (capsModule != null) |
2029 | { | 2020 | { |
2030 | seeds = new Dictionary<ulong, string>(capsModule.GetChildrenSeeds(sp.UUID)); | 2021 | seeds = new Dictionary<ulong, string>(capsModule.GetChildrenSeeds(sp.UUID)); |
@@ -2046,7 +2037,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2046 | 2037 | ||
2047 | List<AgentCircuitData> cagents = new List<AgentCircuitData>(); | 2038 | List<AgentCircuitData> cagents = new List<AgentCircuitData>(); |
2048 | List<ulong> newneighbours = new List<ulong>(); | 2039 | List<ulong> newneighbours = new List<ulong>(); |
2049 | 2040 | ||
2050 | foreach (GridRegion neighbour in neighbours) | 2041 | foreach (GridRegion neighbour in neighbours) |
2051 | { | 2042 | { |
2052 | ulong handler = neighbour.RegionHandle; | 2043 | ulong handler = neighbour.RegionHandle; |
@@ -2096,13 +2087,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2096 | seeds.Remove(handler); | 2087 | seeds.Remove(handler); |
2097 | 2088 | ||
2098 | /// Update all child agent with everyone's seeds | 2089 | /// Update all child agent with everyone's seeds |
2099 | // foreach (AgentCircuitData a in cagents) | 2090 | // foreach (AgentCircuitData a in cagents) |
2100 | // a.ChildrenCapSeeds = new Dictionary<ulong, string>(seeds); | 2091 | // a.ChildrenCapSeeds = new Dictionary<ulong, string>(seeds); |
2101 | 2092 | ||
2102 | if (capsModule != null) | 2093 | if (capsModule != null) |
2103 | capsModule.SetChildrenSeed(sp.UUID, seeds); | 2094 | capsModule.SetChildrenSeed(sp.UUID, seeds); |
2104 | 2095 | ||
2105 | sp.KnownRegions = seeds; | 2096 | sp.KnownRegions = seeds; |
2097 | sp.SetNeighbourRegionSizeInfo(neighbours); | ||
2106 | 2098 | ||
2107 | AgentPosition agentpos = new AgentPosition(); | 2099 | AgentPosition agentpos = new AgentPosition(); |
2108 | agentpos.AgentID = new UUID(sp.UUID.Guid); | 2100 | agentpos.AgentID = new UUID(sp.UUID.Guid); |
@@ -2114,59 +2106,56 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2114 | agentpos.Velocity = sp.Velocity; | 2106 | agentpos.Velocity = sp.Velocity; |
2115 | agentpos.RegionHandle = currentRegionHandler; | 2107 | agentpos.RegionHandle = currentRegionHandler; |
2116 | agentpos.Throttles = spClient.GetThrottlesPacked(1); | 2108 | agentpos.Throttles = spClient.GetThrottlesPacked(1); |
2117 | // agentpos.ChildrenCapSeeds = seeds; | 2109 | // agentpos.ChildrenCapSeeds = seeds; |
2118 | 2110 | ||
2119 | if (neighbours.Count - previousRegionNeighbourHandles.Count > 0) | 2111 | Util.FireAndForget(delegate |
2120 | { | 2112 | { |
2121 | Util.FireAndForget(delegate | 2113 | Thread.Sleep(200); // the original delay that was at InformClientOfNeighbourAsync start |
2122 | { | 2114 | int count = 0; |
2123 | Thread.Sleep(200); // the original delay that was at InformClientOfNeighbourAsync start | ||
2124 | int count = 0; | ||
2125 | 2115 | ||
2126 | foreach (GridRegion neighbour in neighbours) | 2116 | foreach (GridRegion neighbour in neighbours) |
2117 | { | ||
2118 | ulong handler = neighbour.RegionHandle; | ||
2119 | try | ||
2127 | { | 2120 | { |
2128 | ulong handler = neighbour.RegionHandle; | 2121 | if (newneighbours.Contains(handler)) |
2129 | try | ||
2130 | { | ||
2131 | if (newneighbours.Contains(handler)) | ||
2132 | { | ||
2133 | InformClientOfNeighbourAsync(sp, cagents[count], neighbour, | ||
2134 | neighbour.ExternalEndPoint, true); | ||
2135 | count++; | ||
2136 | } | ||
2137 | else if(!previousRegionNeighbourHandles.Contains(handler)) | ||
2138 | { | ||
2139 | spScene.SimulationService.UpdateAgent(neighbour, agentpos); | ||
2140 | } | ||
2141 | } | ||
2142 | catch (ArgumentOutOfRangeException) | ||
2143 | { | 2122 | { |
2144 | m_log.ErrorFormat( | 2123 | InformClientOfNeighbourAsync(sp, cagents[count], neighbour, |
2145 | "[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}).", | 2124 | neighbour.ExternalEndPoint, true); |
2146 | neighbour.ExternalHostName, | 2125 | count++; |
2147 | neighbour.RegionHandle, | ||
2148 | neighbour.RegionLocX, | ||
2149 | neighbour.RegionLocY); | ||
2150 | } | 2126 | } |
2151 | catch (Exception e) | 2127 | else if (!previousRegionNeighbourHandles.Contains(handler)) |
2152 | { | 2128 | { |
2153 | m_log.ErrorFormat( | 2129 | spScene.SimulationService.UpdateAgent(neighbour, agentpos); |
2154 | "[ENTITY TRANSFER MODULE]: Could not resolve external hostname {0} for region {1} ({2}, {3}). {4}", | ||
2155 | neighbour.ExternalHostName, | ||
2156 | neighbour.RegionHandle, | ||
2157 | neighbour.RegionLocX, | ||
2158 | neighbour.RegionLocY, | ||
2159 | e); | ||
2160 | |||
2161 | // FIXME: Okay, even though we've failed, we're still going to throw the exception on, | ||
2162 | // since I don't know what will happen if we just let the client continue | ||
2163 | |||
2164 | // XXX: Well, decided to swallow the exception instead for now. Let us see how that goes. | ||
2165 | // throw e; | ||
2166 | } | 2130 | } |
2167 | } | 2131 | } |
2168 | }); | 2132 | catch (ArgumentOutOfRangeException) |
2169 | } | 2133 | { |
2134 | m_log.ErrorFormat( | ||
2135 | "[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}).", | ||
2136 | neighbour.ExternalHostName, | ||
2137 | neighbour.RegionHandle, | ||
2138 | neighbour.RegionLocX, | ||
2139 | neighbour.RegionLocY); | ||
2140 | } | ||
2141 | catch (Exception e) | ||
2142 | { | ||
2143 | m_log.ErrorFormat( | ||
2144 | "[ENTITY TRANSFER MODULE]: Could not resolve external hostname {0} for region {1} ({2}, {3}). {4}", | ||
2145 | neighbour.ExternalHostName, | ||
2146 | neighbour.RegionHandle, | ||
2147 | neighbour.RegionLocX, | ||
2148 | neighbour.RegionLocY, | ||
2149 | e); | ||
2150 | |||
2151 | // FIXME: Okay, even though we've failed, we're still going to throw the exception on, | ||
2152 | // since I don't know what will happen if we just let the client continue | ||
2153 | |||
2154 | // XXX: Well, decided to swallow the exception instead for now. Let us see how that goes. | ||
2155 | // throw e; | ||
2156 | } | ||
2157 | } | ||
2158 | }); | ||
2170 | } | 2159 | } |
2171 | 2160 | ||
2172 | // Computes the difference between two region bases. | 2161 | // Computes the difference between two region bases. |
@@ -2179,12 +2168,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2179 | 0f); | 2168 | 0f); |
2180 | } | 2169 | } |
2181 | 2170 | ||
2182 | public GridRegion GetRegionContainingWorldLocation(IGridService pGridService, UUID pScopeID, double px, double py) | ||
2183 | { | ||
2184 | // Since we don't know how big the regions could be, we have to search a very large area | ||
2185 | // to find possible regions. | ||
2186 | return GetRegionContainingWorldLocation(pGridService, pScopeID, px, py, Constants.MaximumRegionSize); | ||
2187 | } | ||
2188 | 2171 | ||
2189 | #region NotFoundLocationCache class | 2172 | #region NotFoundLocationCache class |
2190 | // A collection of not found locations to make future lookups 'not found' lookups quick. | 2173 | // A collection of not found locations to make future lookups 'not found' lookups quick. |
@@ -2269,6 +2252,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2269 | #endregion // NotFoundLocationCache class | 2252 | #endregion // NotFoundLocationCache class |
2270 | private NotFoundLocationCache m_notFoundLocationCache = new NotFoundLocationCache(); | 2253 | private NotFoundLocationCache m_notFoundLocationCache = new NotFoundLocationCache(); |
2271 | 2254 | ||
2255 | // needed for current OSG or old grid code | ||
2256 | |||
2257 | public GridRegion GetRegionContainingWorldLocation(IGridService pGridService, UUID pScopeID, double px, double py) | ||
2258 | { | ||
2259 | // Since we don't know how big the regions could be, we have to search a very large area | ||
2260 | // to find possible regions. | ||
2261 | return GetRegionContainingWorldLocation(pGridService, pScopeID, px, py, Constants.MaximumRegionSize); | ||
2262 | } | ||
2263 | |||
2272 | // Given a world position, get the GridRegion info for | 2264 | // Given a world position, get the GridRegion info for |
2273 | // the region containing that point. | 2265 | // the region containing that point. |
2274 | // Someday this should be a method on GridService. | 2266 | // Someday this should be a method on GridService. |
@@ -2457,7 +2449,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2457 | /// <param name="pRegionLocX"></param> | 2449 | /// <param name="pRegionLocX"></param> |
2458 | /// <param name="pRegionLocY"></param> | 2450 | /// <param name="pRegionLocY"></param> |
2459 | /// <returns></returns> | 2451 | /// <returns></returns> |
2460 | protected List<GridRegion> GetNeighbours(ScenePresence avatar, uint pRegionLocX, uint pRegionLocY) | 2452 | protected List<GridRegion> GetNeighbors(ScenePresence avatar, uint pRegionLocX, uint pRegionLocY) |
2461 | { | 2453 | { |
2462 | Scene pScene = avatar.Scene; | 2454 | Scene pScene = avatar.Scene; |
2463 | RegionInfo m_regionInfo = pScene.RegionInfo; | 2455 | RegionInfo m_regionInfo = pScene.RegionInfo; |
@@ -2468,23 +2460,20 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2468 | // view to include everything in the megaregion | 2460 | // view to include everything in the megaregion |
2469 | if (m_regionCombinerModule == null || !m_regionCombinerModule.IsRootForMegaregion(Scene.RegionInfo.RegionID)) | 2461 | if (m_regionCombinerModule == null || !m_regionCombinerModule.IsRootForMegaregion(Scene.RegionInfo.RegionID)) |
2470 | { | 2462 | { |
2471 | // The area to check is as big as the current region. | 2463 | uint dd = (uint)avatar.DrawDistance; |
2472 | // We presume all adjacent regions are the same size as this region. | 2464 | |
2473 | // this needs to be reduced a lot | 2465 | // until avatar movement updates client connections, we need to seend at least this current region imediate Neighbors |
2474 | // and updated in avatar CheckForSignificantMovement (larger than current 64m?) | 2466 | uint ddX = Math.Max(dd, Constants.RegionSize); |
2475 | // and draw distance changes | 2467 | uint ddY = Math.Max(dd, Constants.RegionSize); |
2476 | // sending client the necessary information | 2468 | |
2477 | uint dd = Math.Max((uint)avatar.DrawDistance, Constants.RegionSize); | 2469 | ddX--; |
2478 | 2470 | ddY--; | |
2479 | dd--; | 2471 | |
2480 | uint ddX = Math.Max(dd, Scene.RegionInfo.RegionSizeX); | 2472 | // reference to region edges. Should be avatar position |
2481 | uint ddY = Math.Max(dd, Scene.RegionInfo.RegionSizeY); | 2473 | uint startX = Util.RegionToWorldLoc(pRegionLocX); |
2482 | 2474 | uint endX = startX + m_regionInfo.RegionSizeX; | |
2483 | // region center. Should be avatar position | 2475 | uint startY = Util.RegionToWorldLoc(pRegionLocY); |
2484 | uint startX = Util.RegionToWorldLoc(pRegionLocX) + m_regionInfo.RegionSizeX / 2; | 2476 | uint endY = startY + m_regionInfo.RegionSizeY; |
2485 | uint endX = startX; | ||
2486 | uint startY = Util.RegionToWorldLoc(pRegionLocY) + m_regionInfo.RegionSizeY / 2; | ||
2487 | uint endY = startY; | ||
2488 | 2477 | ||
2489 | startX -= ddX; | 2478 | startX -= ddX; |
2490 | startY -= ddY; | 2479 | startY -= ddY; |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index 7abdc21..4ef2fa9 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | |||
@@ -243,19 +243,19 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
243 | 243 | ||
244 | return region; | 244 | return region; |
245 | } | 245 | } |
246 | 246 | /* NEEDFIX | |
247 | protected override bool NeedsClosing(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, GridRegion reg) | 247 | protected override bool NeedsClosing(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, GridRegion reg) |
248 | { | 248 | { |
249 | if (base.NeedsClosing(drawdist, oldRegionX, newRegionX, oldRegionY, newRegionY, reg)) | 249 | if (base.NeedsClosing(drawdist, oldRegionX, newRegionX, oldRegionY, newRegionY, reg)) |
250 | return true; | 250 | return true; |
251 | 251 | ||
252 | int flags = Scene.GridService.GetRegionFlags(Scene.RegionInfo.ScopeID, reg.RegionID); | 252 | int flags = Scene.GridService.GetRegionFlags(Scene.RegionInfo.ScopeID, reg.RegionID); |
253 | if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Framework.RegionFlags.Hyperlink) != 0) | 253 | if (flags == -1 || (flags & (int)OpenSim.Framework.RegionFlags.Hyperlink) != 0) |
254 | return true; | 254 | return true; |
255 | 255 | ||
256 | return false; | 256 | return false; |
257 | } | 257 | } |
258 | 258 | */ | |
259 | protected override void AgentHasMovedAway(ScenePresence sp, bool logout) | 259 | protected override void AgentHasMovedAway(ScenePresence sp, bool logout) |
260 | { | 260 | { |
261 | base.AgentHasMovedAway(sp, logout); | 261 | base.AgentHasMovedAway(sp, logout); |