aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorUbitUmarov2014-10-19 15:51:12 +0100
committerUbitUmarov2014-10-19 15:51:12 +0100
commitf44c29effbd0d14427f288470aee028e9e09d6e3 (patch)
treee36ceb596388272eace994827f210ff56749d554
parent change position in new region estimation. Reduce border jitter margin (diff)
downloadopensim-SC-f44c29effbd0d14427f288470aee028e9e09d6e3.zip
opensim-SC-f44c29effbd0d14427f288470aee028e9e09d6e3.tar.gz
opensim-SC-f44c29effbd0d14427f288470aee028e9e09d6e3.tar.bz2
opensim-SC-f44c29effbd0d14427f288470aee028e9e09d6e3.tar.xz
try to fix propagation of seeds to all relevante regions
-rw-r--r--OpenSim/Framework/ChildAgentDataUpdate.cs38
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs104
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs8
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs26
4 files changed, 139 insertions, 37 deletions
diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs
index 5078f69..0763bbc 100644
--- a/OpenSim/Framework/ChildAgentDataUpdate.cs
+++ b/OpenSim/Framework/ChildAgentDataUpdate.cs
@@ -94,6 +94,7 @@ namespace OpenSim.Framework
94 // This probably shouldn't be here 94 // This probably shouldn't be here
95 public byte[] Throttles; 95 public byte[] Throttles;
96 96
97 public Dictionary<ulong, string> ChildrenCapSeeds = null;
97 98
98 public OSDMap Pack() 99 public OSDMap Pack()
99 { 100 {
@@ -119,6 +120,19 @@ namespace OpenSim.Framework
119 if ((Throttles != null) && (Throttles.Length > 0)) 120 if ((Throttles != null) && (Throttles.Length > 0))
120 args["throttles"] = OSD.FromBinary(Throttles); 121 args["throttles"] = OSD.FromBinary(Throttles);
121 122
123 if (ChildrenCapSeeds != null && ChildrenCapSeeds.Count > 0)
124 {
125 OSDArray childrenSeeds = new OSDArray(ChildrenCapSeeds.Count);
126 foreach (KeyValuePair<ulong, string> kvp in ChildrenCapSeeds)
127 {
128 OSDMap pair = new OSDMap();
129 pair["handle"] = OSD.FromString(kvp.Key.ToString());
130 pair["seed"] = OSD.FromString(kvp.Value);
131 childrenSeeds.Add(pair);
132 }
133 args["children_seeds"] = childrenSeeds;
134 }
135
122 return args; 136 return args;
123 } 137 }
124 138
@@ -165,6 +179,30 @@ namespace OpenSim.Framework
165 179
166 if (args["throttles"] != null) 180 if (args["throttles"] != null)
167 Throttles = args["throttles"].AsBinary(); 181 Throttles = args["throttles"].AsBinary();
182
183 if (args.ContainsKey("children_seeds") && (args["children_seeds"] != null) &&
184 (args["children_seeds"].Type == OSDType.Array))
185 {
186 OSDArray childrenSeeds = (OSDArray)(args["children_seeds"]);
187 ChildrenCapSeeds = new Dictionary<ulong, string>();
188 foreach (OSD o in childrenSeeds)
189 {
190 if (o.Type == OSDType.Map)
191 {
192 ulong handle = 0;
193 string seed = "";
194 OSDMap pair = (OSDMap)o;
195 if (pair["handle"] != null)
196 if (!UInt64.TryParse(pair["handle"].AsString(), out handle))
197 continue;
198 if (pair["seed"] != null)
199 seed = pair["seed"].AsString();
200 if (!ChildrenCapSeeds.ContainsKey(handle))
201 ChildrenCapSeeds.Add(handle, seed);
202 }
203 }
204 }
205
168 } 206 }
169 207
170 /// <summary> 208 /// <summary>
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index ae571c0..87a0ff6 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -1838,33 +1838,43 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1838 { 1838 {
1839 m_log.DebugFormat("[ENTITY TRANSFER]: Enabling child agent in new neighbour {0}", region.RegionName); 1839 m_log.DebugFormat("[ENTITY TRANSFER]: Enabling child agent in new neighbour {0}", region.RegionName);
1840 1840
1841 ulong currentRegionHandler = sp.Scene.RegionInfo.RegionHandle;
1842 ulong regionhandler = region.RegionHandle;
1843
1844 Dictionary<ulong, string> seeds = new Dictionary<ulong, string>(sp.Scene.CapsModule.GetChildrenSeeds(sp.UUID));
1845
1846 if (seeds.ContainsKey(regionhandler))
1847 seeds.Remove(regionhandler);
1848
1849 List<ulong> oldregions = new List<ulong>(seeds.Keys);
1850
1851 if (oldregions.Contains(currentRegionHandler))
1852 oldregions.Remove(currentRegionHandler);
1853
1854 if (!seeds.ContainsKey(currentRegionHandler))
1855 seeds.Add(currentRegionHandler, sp.ControllingClient.RequestClientInfo().CapsPath);
1856
1841 AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); 1857 AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode);
1842 AgentCircuitData agent = sp.ControllingClient.RequestClientInfo(); 1858 AgentCircuitData agent = sp.ControllingClient.RequestClientInfo();
1843 agent.BaseFolder = UUID.Zero; 1859 agent.BaseFolder = UUID.Zero;
1844 agent.InventoryFolder = UUID.Zero; 1860 agent.InventoryFolder = UUID.Zero;
1845 agent.startpos = sp.AbsolutePosition + CalculateOffset(sp, region); 1861 agent.startpos = sp.AbsolutePosition + CalculateOffset(sp, region);
1846 agent.child = true; 1862 agent.child = true;
1847
1848 agent.Appearance = new AvatarAppearance(); 1863 agent.Appearance = new AvatarAppearance();
1849 agent.Appearance.AvatarHeight = sp.Appearance.AvatarHeight; 1864 agent.Appearance.AvatarHeight = sp.Appearance.AvatarHeight;
1850 1865
1851 agent.CapsPath = CapsUtil.GetRandomCapsObjectPath(); 1866 agent.CapsPath = CapsUtil.GetRandomCapsObjectPath();
1867 seeds.Add(regionhandler, agent.CapsPath);
1852 1868
1853 agent.ChildrenCapSeeds = new Dictionary<ulong, string>(sp.Scene.CapsModule.GetChildrenSeeds(sp.UUID)); 1869 agent.ChildrenCapSeeds = new Dictionary<ulong, string>(seeds);
1854 //m_log.DebugFormat("[XXX] Seeds 1 {0}", agent.ChildrenCapSeeds.Count); 1870
1855
1856 if (!agent.ChildrenCapSeeds.ContainsKey(sp.Scene.RegionInfo.RegionHandle))
1857 agent.ChildrenCapSeeds.Add(sp.Scene.RegionInfo.RegionHandle, sp.ControllingClient.RequestClientInfo().CapsPath);
1858 //m_log.DebugFormat("[XXX] Seeds 2 {0}", agent.ChildrenCapSeeds.Count);
1859
1860 sp.AddNeighbourRegion(region.RegionHandle, agent.CapsPath);
1861 agent.ChildrenCapSeeds.Add(region.RegionHandle, agent.CapsPath);
1862
1863 if (sp.Scene.CapsModule != null) 1871 if (sp.Scene.CapsModule != null)
1864 { 1872 {
1865 sp.Scene.CapsModule.SetChildrenSeed(sp.UUID, agent.ChildrenCapSeeds); 1873 sp.Scene.CapsModule.SetChildrenSeed(sp.UUID, seeds);
1866 } 1874 }
1867 1875
1876 sp.KnownRegions = seeds;
1877
1868 if (currentAgentCircuit != null) 1878 if (currentAgentCircuit != null)
1869 { 1879 {
1870 agent.ServiceURLs = currentAgentCircuit.ServiceURLs; 1880 agent.ServiceURLs = currentAgentCircuit.ServiceURLs;
@@ -1875,7 +1885,22 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1875 agent.Id0 = currentAgentCircuit.Id0; 1885 agent.Id0 = currentAgentCircuit.Id0;
1876 } 1886 }
1877 1887
1878 Thread.Sleep(200); // the original delay that was at InformClientOfNeighbourAsync start 1888 AgentPosition agentpos = null;
1889
1890 if (oldregions.Count > 0)
1891 {
1892 agentpos = new AgentPosition();
1893 agentpos.AgentID = new UUID(sp.UUID.Guid);
1894 agentpos.SessionID = sp.ControllingClient.SessionId;
1895 agentpos.Size = sp.Appearance.AvatarSize;
1896 agentpos.Center = sp.CameraPosition;
1897 agentpos.Far = sp.DrawDistance;
1898 agentpos.Position = sp.AbsolutePosition;
1899 agentpos.Velocity = sp.Velocity;
1900 agentpos.RegionHandle = currentRegionHandler;
1901 agentpos.Throttles = sp.ControllingClient.GetThrottlesPacked(1);
1902 agentpos.ChildrenCapSeeds = seeds;
1903 }
1879 1904
1880 IPEndPoint external = region.ExternalEndPoint; 1905 IPEndPoint external = region.ExternalEndPoint;
1881 if (external != null) 1906 if (external != null)
@@ -1885,7 +1910,22 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1885 InformClientOfNeighbourCompleted, 1910 InformClientOfNeighbourCompleted,
1886 d); 1911 d);
1887 } 1912 }
1913
1914 if(oldregions.Count >0)
1915 {
1916 uint neighbourx;
1917 uint neighboury;
1918 UUID scope = sp.Scene.RegionInfo.ScopeID;
1919 foreach (ulong handler in oldregions)
1920 {
1921 // crap code
1922 Utils.LongToUInts(handler, out neighbourx, out neighboury);
1923 GridRegion neighbour = sp.Scene.GridService.GetRegionByPosition(scope, (int)neighbourx, (int)neighboury);
1924 sp.Scene.SimulationService.UpdateAgent(neighbour, agentpos);
1925 }
1926 }
1888 } 1927 }
1928
1889 #endregion 1929 #endregion
1890 1930
1891 #region Enable Child Agents 1931 #region Enable Child Agents
@@ -1935,7 +1975,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1935 AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); 1975 AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode);
1936 1976
1937 List<AgentCircuitData> cagents = new List<AgentCircuitData>(); 1977 List<AgentCircuitData> cagents = new List<AgentCircuitData>();
1938 List<GridRegion> newneighbours = new List<GridRegion>(); 1978 List<ulong> newneighbours = new List<ulong>();
1939 1979
1940 ulong currentRegionHandler = sp.Scene.RegionInfo.RegionHandle; 1980 ulong currentRegionHandler = sp.Scene.RegionInfo.RegionHandle;
1941 1981
@@ -1972,7 +2012,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1972 agent.Id0 = currentAgentCircuit.Id0; 2012 agent.Id0 = currentAgentCircuit.Id0;
1973 } 2013 }
1974 2014
1975 newneighbours.Add(neighbour); 2015 newneighbours.Add(handler);
1976 agent.CapsPath = CapsUtil.GetRandomCapsObjectPath(); 2016 agent.CapsPath = CapsUtil.GetRandomCapsObjectPath();
1977 seeds.Add(handler, agent.CapsPath); 2017 seeds.Add(handler, agent.CapsPath);
1978 cagents.Add(agent); 2018 cagents.Add(agent);
@@ -1993,21 +2033,41 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1993 sp.Scene.CapsModule.SetChildrenSeed(sp.UUID, seeds); 2033 sp.Scene.CapsModule.SetChildrenSeed(sp.UUID, seeds);
1994 2034
1995 sp.KnownRegions = seeds; 2035 sp.KnownRegions = seeds;
1996 2036
1997 if (newneighbours.Count > 0) 2037 AgentPosition agentpos = new AgentPosition();
2038 agentpos.AgentID = new UUID(sp.UUID.Guid);
2039 agentpos.SessionID = sp.ControllingClient.SessionId;
2040 agentpos.Size = sp.Appearance.AvatarSize;
2041 agentpos.Center = sp.CameraPosition;
2042 agentpos.Far = sp.DrawDistance;
2043 agentpos.Position = sp.AbsolutePosition;
2044 agentpos.Velocity = sp.Velocity;
2045 agentpos.RegionHandle = currentRegionHandler;
2046 agentpos.Throttles = sp.ControllingClient.GetThrottlesPacked(1);
2047 agentpos.ChildrenCapSeeds = seeds;
2048
2049 if (neighbours.Count - previousRegionNeighbourHandles.Count > 0)
1998 { 2050 {
1999 Util.FireAndForget(delegate 2051 Util.FireAndForget(delegate
2000 { 2052 {
2001 Thread.Sleep(200); // the original delay that was at InformClientOfNeighbourAsync start 2053 Thread.Sleep(200); // the original delay that was at InformClientOfNeighbourAsync start
2002 int count = 0; 2054 int count = 0;
2003 2055
2004 foreach (GridRegion neighbour in newneighbours) 2056 foreach (GridRegion neighbour in neighbours)
2005 { 2057 {
2058 ulong handler = neighbour.RegionHandle;
2006 try 2059 try
2007 { 2060 {
2008 InformClientOfNeighbourAsync(sp, cagents[count], neighbour, 2061 if (newneighbours.Contains(handler))
2009 neighbour.ExternalEndPoint, true); 2062 {
2010 count++; 2063 InformClientOfNeighbourAsync(sp, cagents[count], neighbour,
2064 neighbour.ExternalEndPoint, true);
2065 count++;
2066 }
2067 else if(!previousRegionNeighbourHandles.Contains(handler))
2068 {
2069 sp.Scene.SimulationService.UpdateAgent(neighbour, agentpos);
2070 }
2011 } 2071 }
2012 catch (ArgumentOutOfRangeException) 2072 catch (ArgumentOutOfRangeException)
2013 { 2073 {
@@ -2483,7 +2543,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
2483 // no one or failed lets go back and tell physics to go on 2543 // no one or failed lets go back and tell physics to go on
2484 oldGroupPosition.X = Util.Clamp<float>(oldGroupPosition.X, 0.5f, (float)Constants.RegionSize - 0.5f); 2544 oldGroupPosition.X = Util.Clamp<float>(oldGroupPosition.X, 0.5f, (float)Constants.RegionSize - 0.5f);
2485 oldGroupPosition.Y = Util.Clamp<float>(oldGroupPosition.Y, 0.5f, (float)Constants.RegionSize - 0.5f); 2545 oldGroupPosition.Y = Util.Clamp<float>(oldGroupPosition.Y, 0.5f, (float)Constants.RegionSize - 0.5f);
2486 oldGroupPosition.Z = Util.Clamp<float>(oldGroupPosition.Z, 0.5f, 4096.0f); 2546// oldGroupPosition.Z = Util.Clamp<float>(oldGroupPosition.Z, 0.5f, 4096.0f);
2487 2547
2488 grp.AbsolutePosition = oldGroupPosition; 2548 grp.AbsolutePosition = oldGroupPosition;
2489 grp.Velocity = Vector3.Zero; 2549 grp.Velocity = Vector3.Zero;
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 829d4ce..4a6f72c 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -4558,8 +4558,14 @@ namespace OpenSim.Region.Framework.Scenes
4558 // a UseCircuitCode packet which in turn calls AddNewAgent which finally creates the ScenePresence. 4558 // a UseCircuitCode packet which in turn calls AddNewAgent which finally creates the ScenePresence.
4559 ScenePresence sp = WaitGetScenePresence(cAgentData.AgentID); 4559 ScenePresence sp = WaitGetScenePresence(cAgentData.AgentID);
4560 4560
4561 if (sp != null) 4561 if (sp != null)
4562 { 4562 {
4563 if (!sp.IsChildAgent)
4564 {
4565 m_log.WarnFormat("[SCENE]: Ignoring a child update on a root agent {0} {1} in {2}",
4566 sp.Name, sp.UUID, Name);
4567 return false;
4568 }
4563 if (cAgentData.SessionID != sp.ControllingClient.SessionId) 4569 if (cAgentData.SessionID != sp.ControllingClient.SessionId)
4564 { 4570 {
4565 m_log.WarnFormat( 4571 m_log.WarnFormat(
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index fbb18b7..405ad73 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1684,20 +1684,6 @@ namespace OpenSim.Region.Framework.Scenes
1684 return; 1684 return;
1685 } 1685 }
1686 1686
1687 // Prevent teleporting to an underground location
1688 // (may crash client otherwise)
1689 //
1690
1691/* this is done in MakeRootAgent
1692 Vector3 pos = AbsolutePosition;
1693 float ground = m_scene.GetGroundHeight(pos.X, pos.Y);
1694 if (pos.Z < ground + 1.5f)
1695 {
1696 pos.Z = ground + 1.5f;
1697 AbsolutePosition = pos;
1698 }
1699*/
1700
1701 m_log.DebugFormat("[CompleteMovement] WaitForUpdateAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); 1687 m_log.DebugFormat("[CompleteMovement] WaitForUpdateAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts));
1702 1688
1703 bool flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); 1689 bool flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0);
@@ -1904,7 +1890,9 @@ namespace OpenSim.Region.Framework.Scenes
1904 { 1890 {
1905 IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>(); 1891 IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>();
1906 if (m_agentTransfer != null) 1892 if (m_agentTransfer != null)
1893 {
1907 m_agentTransfer.EnableChildAgents(this); 1894 m_agentTransfer.EnableChildAgents(this);
1895 }
1908 } 1896 }
1909 } 1897 }
1910 1898
@@ -4171,6 +4159,16 @@ namespace OpenSim.Region.Framework.Scenes
4171 if ((cAgentData.Throttles != null) && cAgentData.Throttles.Length > 0) 4159 if ((cAgentData.Throttles != null) && cAgentData.Throttles.Length > 0)
4172 ControllingClient.SetChildAgentThrottle(cAgentData.Throttles); 4160 ControllingClient.SetChildAgentThrottle(cAgentData.Throttles);
4173 4161
4162 if(cAgentData.ChildrenCapSeeds != null && cAgentData.ChildrenCapSeeds.Count >0)
4163 {
4164 if (Scene.CapsModule != null)
4165 {
4166 Scene.CapsModule.SetChildrenSeed(UUID, cAgentData.ChildrenCapSeeds);
4167 }
4168
4169 KnownRegions = cAgentData.ChildrenCapSeeds;
4170 }
4171
4174 //cAgentData.AVHeight; 4172 //cAgentData.AVHeight;
4175 //m_velocity = cAgentData.Velocity; 4173 //m_velocity = cAgentData.Velocity;
4176 } 4174 }