From 8c657e48377213e7ee66c05a4047085cee6084ea Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 14 Aug 2014 20:41:36 +0100 Subject: [PATCH 01/50] add a estimator of client ping time, and painfully make it visible in show connections console command --- OpenSim/Framework/IClientAPI.cs | 2 ++ OpenSim/Region/Application/OpenSim.cs | 4 +++- .../ClientStack/Linden/UDP/LLClientView.cs | 12 ++++++++++++ .../ClientStack/Linden/UDP/LLUDPClient.cs | 16 ++++++++++++++++ .../ClientStack/Linden/UDP/LLUDPServer.cs | 18 +++++++++++++----- .../Server/IRCClientView.cs | 2 ++ .../OptionalModules/World/NPC/NPCAvatar.cs | 2 ++ OpenSim/Tests/Common/Mock/TestClient.cs | 2 ++ 8 files changed, 52 insertions(+), 6 deletions(-) diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 22cc79da33..3b0430bed0 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -755,6 +755,8 @@ namespace OpenSim.Framework /// bool IsActive { get; set; } + int PingTimeMS { get; } + /// /// Set if the client is closing due to a logout request /// diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 85049c9e56..13d817020c 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -978,6 +978,7 @@ namespace OpenSim cdt.AddColumn("Circuit code", 12); cdt.AddColumn("Endpoint", 23); cdt.AddColumn("Active?", 7); + cdt.AddColumn("ping(ms)", 8); SceneManager.ForEachScene( s => s.ForEachClient( @@ -986,7 +987,8 @@ namespace OpenSim c.Name, c.CircuitCode.ToString(), c.RemoteEndPoint.ToString(), - c.IsActive.ToString()))); + c.IsActive.ToString(), + c.PingTimeMS))); MainConsole.Instance.Output(cdt.ToString()); } diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 59d1c69137..e69bf2322e 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -419,6 +419,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP public ulong ActiveGroupPowers { get { return m_activeGroupPowers; } } public bool IsGroupMember(UUID groupID) { return m_groupPowers.ContainsKey(groupID); } + public int PingTimeMS + { + get + { + if (UDPClient != null) + return UDPClient.PingTimeMS; + return 0; + } + } + /// /// Entity update queues /// @@ -461,6 +471,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP set { m_disableFacelights = value; } } + public bool SendLogoutPacketWhenClosing { set { m_SendLogoutPacketWhenClosing = value; } } @@ -1638,6 +1649,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP pc.PingID.OldestUnacked = 0; OutPacket(pc, ThrottleOutPacketType.Unknown); + UDPClient.m_lastStartpingTimeMS = Util.EnvironmentTickCount(); } public void SendKillObject(List localIDs) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index bd4e617da9..9cf65d79c6 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs @@ -163,6 +163,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP private int m_maxRTO = 60000; public bool m_deliverPackets = true; + public int m_lastStartpingTimeMS; + public int m_pingMS; + + public int PingTimeMS + { + get + { + if (m_pingMS < 20) + return 20; + if(m_pingMS > 2000) + return 2000; + return m_pingMS; + } + } + /// /// This is the percentage of the udp texture queue to add to the task queue since /// textures are now generally handled through http. @@ -225,6 +240,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Initialize this to a sane value to prevent early disconnects TickLastPacketReceived = Environment.TickCount & Int32.MaxValue; + m_pingMS = (int)(3.0 * server.TickCountResolution); // so filter doesnt start at 0; } /// diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index fe79f870a9..910d7cf733 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -293,6 +293,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// Flag to signal when clients should send pings protected bool m_sendPing; + private ExpiringCache> m_pendingCache = new ExpiringCache>(); /// @@ -369,16 +370,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Measure the resolution of Environment.TickCount TickCountResolution = 0f; - for (int i = 0; i < 5; i++) + for (int i = 0; i < 10; i++) { int start = Environment.TickCount; int now = start; while (now == start) now = Environment.TickCount; - TickCountResolution += (float)(now - start) * 0.2f; + TickCountResolution += (float)(now - start) * 0.1f; } - m_log.Info("[LLUDPSERVER]: Average Environment.TickCount resolution: " + TickCountResolution + "ms"); TickCountResolution = (float)Math.Ceiling(TickCountResolution); + m_log.Info("[LLUDPSERVER]: Average Environment.TickCount resolution: " + TickCountResolution + "ms"); #endregion Environment.TickCount Measurement @@ -386,6 +387,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP int sceneThrottleBps = 0; bool usePools = false; + + IConfig config = configSource.Configs["ClientStack.LindenUDP"]; if (config != null) { @@ -1128,6 +1131,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP pc.PingID.OldestUnacked = 0; SendPacket(udpClient, pc, ThrottleOutPacketType.Unknown, false, null); + udpClient.m_lastStartpingTimeMS = Util.EnvironmentTickCount(); } public void CompletePing(LLUDPClient udpClient, byte pingID) @@ -1567,7 +1571,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // We don't need to do anything else with ping checks StartPingCheckPacket startPing = (StartPingCheckPacket)packet; CompletePing(udpClient, startPing.PingID.PingID); - + if ((Environment.TickCount - m_elapsedMSSinceLastStatReport) >= 3000) { udpClient.SendPacketStats(); @@ -1577,7 +1581,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP } else if (packet.Type == PacketType.CompletePingCheck) { - // We don't currently track client ping times + int t = Util.EnvironmentTickCountSubtract(udpClient.m_lastStartpingTimeMS); + int c = udpClient.m_pingMS; + c = 900 * c + 100 * t; + c /= 1000; + udpClient.m_pingMS = c; return; } diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index 373ed418fd..f35ea92caf 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs @@ -58,6 +58,8 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server public ISceneAgent SceneAgent { get; set; } + public int PingTimeMS { get { return 0; } } + private string m_username; private string m_nick; diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index c88ccc5e86..7002d75869 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs @@ -81,6 +81,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC get { return m_scene; } } + public int PingTimeMS { get { return 0; } } + public UUID OwnerID { get { return m_ownerID; } diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index 52e0134aff..f3eaed3a2a 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs @@ -379,6 +379,8 @@ namespace OpenSim.Tests.Common.Mock get { return FirstName + " " + LastName; } } + public int PingTimeMS { get { return 0; } } + public bool IsActive { get { return true; } From a46d6004dfdc353678271e36aafff5eaafd3fd91 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 14 Aug 2014 21:04:30 +0100 Subject: [PATCH 02/50] reduce ping filter time constant --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 910d7cf733..bd192dc1dd 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -1583,7 +1583,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { int t = Util.EnvironmentTickCountSubtract(udpClient.m_lastStartpingTimeMS); int c = udpClient.m_pingMS; - c = 900 * c + 100 * t; + c = 800 * c + 200 * t; c /= 1000; udpClient.m_pingMS = c; return; From 538a95ff1e93c6266bb2c269e9f92a5cb7dce10e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 14 Aug 2014 21:05:17 +0100 Subject: [PATCH 03/50] in show connections show also if it is a childagent connection --- OpenSim/Region/Application/OpenSim.cs | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 13d817020c..e1e3d87f89 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -978,17 +978,25 @@ namespace OpenSim cdt.AddColumn("Circuit code", 12); cdt.AddColumn("Endpoint", 23); cdt.AddColumn("Active?", 7); + cdt.AddColumn("ChildAgent?", 7); cdt.AddColumn("ping(ms)", 8); SceneManager.ForEachScene( s => s.ForEachClient( - c => cdt.AddRow( - s.Name, - c.Name, - c.CircuitCode.ToString(), - c.RemoteEndPoint.ToString(), - c.IsActive.ToString(), - c.PingTimeMS))); + c => + { + bool child = false; + if(c.SceneAgent != null && c.SceneAgent.IsChildAgent) + child = true; + cdt.AddRow( + s.Name, + c.Name, + c.CircuitCode.ToString(), + c.RemoteEndPoint.ToString(), + c.IsActive.ToString(), + child.ToString(), + c.PingTimeMS); + })); MainConsole.Instance.Output(cdt.ToString()); } From 0ae8fed4c20f53921193b7b8f0b5b2f4ab1b61b3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 14 Aug 2014 21:18:58 +0100 Subject: [PATCH 04/50] reduce ping cliping lower limit --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index 9cf65d79c6..fe31bd9b79 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs @@ -170,8 +170,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP { get { - if (m_pingMS < 20) - return 20; + if (m_pingMS < 10) + return 10; if(m_pingMS > 2000) return 2000; return m_pingMS; From f798f046862e6130bf8afa9eab3e76f43683fc5f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 14 Aug 2014 22:03:41 +0100 Subject: [PATCH 05/50] add a extra delay in EnableChildAgents between CreateAgent() return and telling client to connect, to account for potencial async tasks that need to finish before the client knocks at the door. Empirical value used --- .../EntityTransfer/EntityTransferModule.cs | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 71148eaeaa..b0483e0e31 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -1870,7 +1870,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer if (external != null) { InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; - d.BeginInvoke(sp, agent, region, external, true, + d.BeginInvoke(sp, agent, region, external, true,true, InformClientOfNeighbourCompleted, d); } @@ -1880,7 +1880,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer #region Enable Child Agents private delegate void InformClientOfNeighbourDelegate( - ScenePresence avatar, AgentCircuitData a, GridRegion reg, IPEndPoint endPoint, bool newAgent); + ScenePresence avatar, AgentCircuitData a, GridRegion reg, IPEndPoint endPoint, bool newAgent, bool doInitialDelay); /// /// This informs all neighbouring regions about agent "avatar". @@ -1993,6 +1993,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer bool newAgent = false; int count = 0; + bool delay = true; foreach (GridRegion neighbour in neighbours) { //m_log.WarnFormat("--> Going to send child agent to {0}", neighbour.RegionName); @@ -2010,7 +2011,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer // Let's put this back at sync, so that it doesn't clog // the network, especially for regions in the same physical server. // We're really not in a hurry here. - InformClientOfNeighbourAsync(sp, cagents[count], neighbour, neighbour.ExternalEndPoint, newAgent); + InformClientOfNeighbourAsync(sp, cagents[count], neighbour, neighbour.ExternalEndPoint, newAgent, delay); + delay = false; // ugly i know.. but there aren't that many neighbours + //InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; //d.BeginInvoke(sp, cagents[count], neighbour, neighbour.ExternalEndPoint, newAgent, // InformClientOfNeighbourCompleted, @@ -2077,11 +2080,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer /// /// private void InformClientOfNeighbourAsync(ScenePresence sp, AgentCircuitData a, GridRegion reg, - IPEndPoint endPoint, bool newAgent) + IPEndPoint endPoint, bool newAgent,bool doinitialdelay) { // Let's wait just a little to give time to originating regions to catch up with closing child agents // after a cross here - Thread.Sleep(500); + if(doinitialdelay) + Thread.Sleep(500); Scene scene = sp.Scene; @@ -2097,6 +2101,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer if (regionAccepted && newAgent) { + // give some time for createAgent finish possible async tasks + int dly = 100 - sp.ControllingClient.PingTimeMS; + if (dly > 20) + Thread.Sleep(dly); + if (m_eqModule != null) { #region IP Translation for NAT From b4a71261678f6a91027d0e25ee506a2ff2e45a77 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 15 Aug 2014 01:22:15 +0100 Subject: [PATCH 06/50] remove the delay on child creation on Neighbour since its amout in not predictable. --- .../Framework/EntityTransfer/EntityTransferModule.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index b0483e0e31..4d6b471460 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -2102,9 +2102,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer if (regionAccepted && newAgent) { // give some time for createAgent finish possible async tasks - int dly = 100 - sp.ControllingClient.PingTimeMS; - if (dly > 20) - Thread.Sleep(dly); + // does nothing usefull... out +// int dly = 100 - sp.ControllingClient.PingTimeMS; +// if (dly > 20) +// Thread.Sleep(dly); if (m_eqModule != null) { From 117d563fd4142f2fbfadad591315ac2c4a88bfcf Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 15 Aug 2014 17:24:01 +0100 Subject: [PATCH 07/50] remove ban check from create caps. That needs to be done on caller (scene.NewUserConnection()) acording to cases, and with minimal calls to external grid services. --- .../Framework/Caps/CapabilitiesModule.cs | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs b/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs index de8925db9c..498cc2f752 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 public void CreateCaps(UUID agentId, uint circuitCode) { +// int ts = Util.EnvironmentTickCount(); +/* this as no business here... + * must be done elsewhere ( and is ) int flags = m_scene.GetUserFlags(agentId); + + m_log.ErrorFormat("[CreateCaps]: banCheck {0} ", Util.EnvironmentTickCountSubtract(ts)); + if (m_scene.RegionInfo.EstateSettings.IsBanned(agentId, flags)) return; - +*/ Caps caps; String capsObjectPath = GetCapsPath(agentId); @@ -132,19 +138,27 @@ namespace OpenSim.Region.CoreModules.Framework if (m_capsObjects.ContainsKey(circuitCode)) { Caps oldCaps = m_capsObjects[circuitCode]; - - //m_log.WarnFormat( - // "[CAPS]: Recreating caps for agent {0} in region {1}. Old caps path {2}, new caps path {3}. ", - // agentId, m_scene.RegionInfo.RegionName, oldCaps.CapsObjectPath, capsObjectPath); + +// if (capsObjectPath == oldCaps.CapsObjectPath) +// { +// m_log.WarnFormat( +// "[CAPS]: Reusing caps for agent {0} in region {1}. Old caps path {2}, new caps path {3}. ", +// agentId, m_scene.RegionInfo.RegionName, oldCaps.CapsObjectPath, capsObjectPath); +// return; +// } } caps = new Caps(MainServer.Instance, m_scene.RegionInfo.ExternalHostName, (MainServer.Instance == null) ? 0: MainServer.Instance.Port, capsObjectPath, agentId, m_scene.RegionInfo.RegionName); +// m_log.ErrorFormat("[CreateCaps]: new caps {0} ", Util.EnvironmentTickCountSubtract(ts)); + m_capsObjects[circuitCode] = caps; } m_scene.EventManager.TriggerOnRegisterCaps(agentId, caps); +// m_log.ErrorFormat("[CreateCaps]: end {0} ", Util.EnvironmentTickCountSubtract(ts)); + } public void RemoveCaps(UUID agentId, uint circuitCode) From 1314a02a95c062e45f3526252a8bc8c1d022ba7d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 15 Aug 2014 17:44:24 +0100 Subject: [PATCH 08/50] adjust createAgent delay on childs creation. Beeing bad, it should be high enougth to reasonable account for grid and region lag spikes --- .../Framework/EntityTransfer/EntityTransferModule.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 4d6b471460..2bbb0a0ef0 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -2097,15 +2097,21 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer string reason = String.Empty; + int ts = Util.EnvironmentTickCount(); bool regionAccepted = scene.SimulationService.CreateAgent(reg, a, (uint)TeleportFlags.Default, out reason); +// m_log.DebugFormat("[ENTITY TRANSFER MODULE] SimulationService.CreateAgent took {0}ms",Util.EnvironmentTickCountSubtract(ts)); + if (regionAccepted && newAgent) { - // give some time for createAgent finish possible async tasks - // does nothing usefull... out -// int dly = 100 - sp.ControllingClient.PingTimeMS; + // give time for createAgent to finish, since it is async and does grid services access + +// int dly = 500 - sp.ControllingClient.PingTimeMS; // if (dly > 20) // Thread.Sleep(dly); + // ping is unrealiable after a login :(, just delay a fair amount + + Thread.Sleep(500); if (m_eqModule != null) { From 4d770082d5dbae95e090c13b12e2c0aad22d8916 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 15 Aug 2014 18:06:04 +0100 Subject: [PATCH 09/50] let failed crossing say something abotu reason --- .../EntityTransfer/EntityTransferModule.cs | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 2bbb0a0ef0..cde7f60b75 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -1381,10 +1381,16 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer #region Agent Crossings - public GridRegion GetDestination(Scene scene, UUID agentID, Vector3 pos, out uint xDest, out uint yDest, out string version, out Vector3 newpos) + { + string r = String.Empty; + return GetDestination(scene, agentID, pos, out xDest, out yDest, out version, out newpos, out r); + } + + public GridRegion GetDestination(Scene scene, UUID agentID, Vector3 pos, out uint xDest, out uint yDest, out string version, out Vector3 newpos, out string reason) { version = String.Empty; + reason = String.Empty; newpos = pos; // m_log.DebugFormat( @@ -1498,8 +1504,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer } GridRegion neighbourRegion = scene.GridService.GetRegionByPosition(scene.RegionInfo.ScopeID, (int)x, (int)y); - - string reason; + if (!scene.SimulationService.QueryAccess(neighbourRegion, agentID, newpos, out version, out reason)) { if (r == null) @@ -1525,11 +1530,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer uint y; Vector3 newpos; string version; + string reason; - GridRegion neighbourRegion = GetDestination(agent.Scene, agent.UUID, agent.AbsolutePosition, out x, out y, out version, out newpos); + GridRegion neighbourRegion = GetDestination(agent.Scene, agent.UUID, agent.AbsolutePosition, out x, out y, out version, out newpos, out reason); if (neighbourRegion == null) { - agent.ControllingClient.SendAlertMessage("Cannot region cross into void"); + if (reason == String.Empty) + agent.ControllingClient.SendAlertMessage("Cannot cross to region"); + else + agent.ControllingClient.SendAlertMessage("Cannot cross to region: " + reason); return false; } From a3e45a45bcd796a0ebfaff9a682e08df469d052a Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 15 Aug 2014 19:05:27 +0100 Subject: [PATCH 10/50] refix hide on crossings --- .../Framework/EntityTransfer/EntityTransferModule.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index cde7f60b75..d326941b7b 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -1752,6 +1752,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer // Unlike a teleport, here we do not wait for the destination region to confirm the receipt. m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.CleaningUp); + agent.parcelRegionCross(false); + agent.MakeChildAgent(); // FIXME: Possibly this should occur lower down after other commands to close other agents, @@ -1765,7 +1767,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer // agent.SendOtherAgentsAvatarDataToMe(); // agent.SendOtherAgentsAppearanceToMe(); - agent.parcelRegionCross(false); // Backwards compatibility. Best effort if (version == "Unknown" || version == string.Empty) From 3e6f49f3be27f5918c4d6322c1882b8267bd4855 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 15 Aug 2014 19:21:32 +0100 Subject: [PATCH 11/50] do CrossAttachmentsIntoNewRegion for old versions in the right place --- .../EntityTransfer/EntityTransferModule.cs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index d326941b7b..84ca52d30d 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -1746,6 +1746,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer capsPath); } + // Backwards compatibility. Best effort + if (version == "Unknown" || version == string.Empty) + { + m_log.DebugFormat("[ENTITY TRANSFER MODULE]: neighbor with old version, passing attachments one by one..."); + Thread.Sleep(3000); // wait a little now that we're not waiting for the callback + CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true); + } + // SUCCESS! m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.ReceivedAtDestination); @@ -1768,13 +1776,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer // agent.SendOtherAgentsAppearanceToMe(); - // Backwards compatibility. Best effort - if (version == "Unknown" || version == string.Empty) - { - m_log.DebugFormat("[ENTITY TRANSFER MODULE]: neighbor with old version, passing attachments one by one..."); - Thread.Sleep(3000); // wait a little now that we're not waiting for the callback - CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true); - } // Next, let's close the child agent connections that are too far away. uint neighbourx; From 72a6bca033f95fa00c9fb21e0a7086f7c3d23f99 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 15 Aug 2014 21:26:50 +0100 Subject: [PATCH 12/50] cleanup a bit --- .../Framework/EntityTransfer/EntityTransferModule.cs | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 84ca52d30d..78464005ba 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -2108,20 +2108,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer string reason = String.Empty; - int ts = Util.EnvironmentTickCount(); bool regionAccepted = scene.SimulationService.CreateAgent(reg, a, (uint)TeleportFlags.Default, out reason); -// m_log.DebugFormat("[ENTITY TRANSFER MODULE] SimulationService.CreateAgent took {0}ms",Util.EnvironmentTickCountSubtract(ts)); - if (regionAccepted && newAgent) { - // give time for createAgent to finish, since it is async and does grid services access - -// int dly = 500 - sp.ControllingClient.PingTimeMS; -// if (dly > 20) -// Thread.Sleep(dly); - // ping is unrealiable after a login :(, just delay a fair amount - + // give time for createAgent to finish, since it is async and does grid services access Thread.Sleep(500); if (m_eqModule != null) From 447fd0850ae3e5e4165561185dca8e5f99904e75 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 15 Aug 2014 21:39:37 +0100 Subject: [PATCH 13/50] remove duplication of textures, wearables and attachments on crossings. receiver checks old method if it doesnt get packed appeareace --- OpenSim/Framework/ChildAgentDataUpdate.cs | 85 +++++++++++++---------- 1 file changed, 50 insertions(+), 35 deletions(-) diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs index 5beb37d64c..91df64d15b 100644 --- a/OpenSim/Framework/ChildAgentDataUpdate.cs +++ b/OpenSim/Framework/ChildAgentDataUpdate.cs @@ -431,6 +431,8 @@ namespace OpenSim.Framework // The code to pack textures, visuals, wearables and attachments // should be removed; packed appearance contains the full appearance // This is retained for backward compatibility only + +/* then lets remove if (Appearance.Texture != null) { byte[] rawtextures = Appearance.Texture.GetBytes(); @@ -459,7 +461,7 @@ namespace OpenSim.Framework args["attachments"] = attachs; } // End of code to remove - +*/ if ((Controllers != null) && (Controllers.Length > 0)) { OSDArray controls = new OSDArray(Controllers.Length); @@ -647,58 +649,71 @@ namespace OpenSim.Framework // AgentTextures[i++] = o.AsUUID(); //} - Appearance = new AvatarAppearance(); - // The code to unpack textures, visuals, wearables and attachments - // should be removed; packed appearance contains the full appearance - // This is retained for backward compatibility only - if (args["texture_entry"] != null) + // packed_appearence should contain all appearance information + if (args.ContainsKey("packed_appearance") && (args["packed_appearance"]).Type == OSDType.Map) { - byte[] rawtextures = args["texture_entry"].AsBinary(); - Primitive.TextureEntry textures = new Primitive.TextureEntry(rawtextures,0,rawtextures.Length); - Appearance.SetTextureEntries(textures); + m_log.WarnFormat("[CHILDAGENTDATAUPDATE] got packed appearance"); + Appearance = new AvatarAppearance((OSDMap)args["packed_appearance"]); } - - if (args["visual_params"] != null) - Appearance.SetVisualParams(args["visual_params"].AsBinary()); - - if ((args["wearables"] != null) && (args["wearables"]).Type == OSDType.Array) + else { - OSDArray wears = (OSDArray)(args["wearables"]); + // if missing try the old pack method + m_log.WarnFormat("[CHILDAGENTDATAUPDATE] No packed appearance, checking old method"); - int count = wears.Count; - if (count > AvatarWearable.MAX_WEARABLES) - count = AvatarWearable.MAX_WEARABLES; + Appearance = new AvatarAppearance(); - for (int i = 0; i < count / 2; i++) + // The code to unpack textures, visuals, wearables and attachments + // should be removed; packed appearance contains the full appearance + // This is retained for backward compatibility only + if (args["texture_entry"] != null) { - AvatarWearable awear = new AvatarWearable((OSDArray)wears[i]); - Appearance.SetWearable(i,awear); + byte[] rawtextures = args["texture_entry"].AsBinary(); + Primitive.TextureEntry textures = new Primitive.TextureEntry(rawtextures, 0, rawtextures.Length); + Appearance.SetTextureEntries(textures); } - } - if ((args["attachments"] != null) && (args["attachments"]).Type == OSDType.Array) - { - OSDArray attachs = (OSDArray)(args["attachments"]); - foreach (OSD o in attachs) + if (args["visual_params"] != null) + Appearance.SetVisualParams(args["visual_params"].AsBinary()); + + if ((args["wearables"] != null) && (args["wearables"]).Type == OSDType.Array) { - if (o.Type == OSDType.Map) + OSDArray wears = (OSDArray)(args["wearables"]); + + int count = wears.Count; + if (count > AvatarWearable.MAX_WEARABLES) + count = AvatarWearable.MAX_WEARABLES; + + for (int i = 0; i < count / 2; i++) { - // We know all of these must end up as attachments so we - // append rather than replace to ensure multiple attachments - // per point continues to work -// m_log.DebugFormat("[CHILDAGENTDATAUPDATE]: Appending attachments for {0}", AgentID); - Appearance.AppendAttachment(new AvatarAttachment((OSDMap)o)); + AvatarWearable awear = new AvatarWearable((OSDArray)wears[i]); + Appearance.SetWearable(i, awear); } } - } - // end of code to remove + if ((args["attachments"] != null) && (args["attachments"]).Type == OSDType.Array) + { + OSDArray attachs = (OSDArray)(args["attachments"]); + foreach (OSD o in attachs) + { + if (o.Type == OSDType.Map) + { + // We know all of these must end up as attachments so we + // append rather than replace to ensure multiple attachments + // per point continues to work + // m_log.DebugFormat("[CHILDAGENTDATAUPDATE]: Appending attachments for {0}", AgentID); + Appearance.AppendAttachment(new AvatarAttachment((OSDMap)o)); + } + } + } + // end of code to remove + } +/* moved above if (args.ContainsKey("packed_appearance") && (args["packed_appearance"]).Type == OSDType.Map) Appearance = new AvatarAppearance((OSDMap)args["packed_appearance"]); else m_log.WarnFormat("[CHILDAGENTDATAUPDATE] No packed appearance"); - +*/ if ((args["controllers"] != null) && (args["controllers"]).Type == OSDType.Array) { OSDArray controls = (OSDArray)(args["controllers"]); From 0720c201b2e5fce2b0432f675125e89fab26fd8f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 15 Aug 2014 23:01:54 +0100 Subject: [PATCH 14/50] on teleports dont send baked textures assets in CreateClient, they will do on the update sent next --- .../Framework/EntityTransfer/EntityTransferModule.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 78464005ba..7ddd1c6e70 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -720,7 +720,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer AgentCircuitData agentCircuit = sp.ControllingClient.RequestClientInfo(); agentCircuit.startpos = position; agentCircuit.child = true; - agentCircuit.Appearance = sp.Appearance; + +// agentCircuit.Appearance = sp.Appearance; + agentCircuit.Appearance = new AvatarAppearance(sp.Appearance, true, false); + if (currentAgentCircuit != null) { agentCircuit.ServiceURLs = currentAgentCircuit.ServiceURLs; From 7d967c37f41c850393a6dd6b80942b2528e4e7d8 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 16 Aug 2014 00:25:27 +0100 Subject: [PATCH 15/50] *test* just send default appearance ( something along path doesnt like null there ) --- .../Framework/EntityTransfer/EntityTransferModule.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 7ddd1c6e70..8d2a276f37 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -722,7 +722,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer agentCircuit.child = true; // agentCircuit.Appearance = sp.Appearance; - agentCircuit.Appearance = new AvatarAppearance(sp.Appearance, true, false); +// agentCircuit.Appearance = new AvatarAppearance(sp.Appearance, true, false); + agentCircuit.Appearance = new AvatarAppearance(); if (currentAgentCircuit != null) { @@ -1848,7 +1849,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer agent.child = true; //agent.Appearance = sp.Appearance; - agent.Appearance = new AvatarAppearance(sp.Appearance, true, false); // guess this should be a lot less + //agent.Appearance = new AvatarAppearance(sp.Appearance, true, false); + agent.Appearance = new AvatarAppearance(); agent.CapsPath = CapsUtil.GetRandomCapsObjectPath(); @@ -1965,7 +1967,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer agent.startpos = sp.AbsolutePosition + CalculateOffset(sp, neighbour); agent.child = true; // agent.Appearance = sp.Appearance; - agent.Appearance = new AvatarAppearance(sp.Appearance, true, false); // guess this should be a lot less + // agent.Appearance = new AvatarAppearance(sp.Appearance, true, false); + agent.Appearance = new AvatarAppearance(); if (currentAgentCircuit != null) { agent.ServiceURLs = currentAgentCircuit.ServiceURLs; From 1edaf29149c767a2742b44d69308edb2e2d64428 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 16 Aug 2014 13:43:26 +0100 Subject: [PATCH 16/50] NextAnimationSequenceNumber be a udpserver variable with random start --- .../ClientStack/Linden/UDP/LLClientView.cs | 7 +++++-- .../ClientStack/Linden/UDP/LLUDPServer.cs | 17 +++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index e69bf2322e..6f41ac89af 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -358,7 +358,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // protected HashSet m_attachmentsSent; private bool m_deliverPackets = true; - private int m_animationSequenceNumber = 1; + private bool m_SendLogoutPacketWhenClosing = true; /// @@ -450,7 +450,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP public string Name { get { return FirstName + " " + LastName; } } public uint CircuitCode { get { return m_circuitCode; } } - public int NextAnimationSequenceNumber { get { return m_animationSequenceNumber++; } } + public int NextAnimationSequenceNumber + { + get { return m_udpServer.NextAnimationSequenceNumber; } + } /// /// As well as it's function in IClientAPI, in LLClientView we are locking on this property in order to diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index bd192dc1dd..3b0312da3b 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -293,6 +293,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// Flag to signal when clients should send pings protected bool m_sendPing; + private int m_animationSequenceNumber; + + public int NextAnimationSequenceNumber + { + get + { + m_animationSequenceNumber++; + if (m_animationSequenceNumber > 2147482624) + m_animationSequenceNumber = 1; + return m_animationSequenceNumber; + } + } + + private ExpiringCache> m_pendingCache = new ExpiringCache>(); @@ -438,6 +452,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_throttle = new TokenBucket(null, sceneThrottleBps); ThrottleRates = new ThrottleRates(configSource); + Random rnd = new Random(Util.EnvironmentTickCount()); + m_animationSequenceNumber = rnd.Next(11474826); + if (usePools) EnablePools(); } From dc178959c5c4e29890e09056e5528e9bf311fe5f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 16 Aug 2014 14:52:09 +0100 Subject: [PATCH 17/50] change how avatar data, appearance and animations are sent, specially the order --- .../Region/Framework/Scenes/ScenePresence.cs | 210 ++++++++---------- 1 file changed, 98 insertions(+), 112 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 0f67d07881..faa5334a22 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1806,6 +1806,17 @@ namespace OpenSim.Region.Framework.Scenes look = new Vector3(0.99f, 0.042f, 0); } + if (!IsChildAgent) + { + InventoryFolderBase cof = m_scene.InventoryService.GetFolderForType(client.AgentId, (AssetType)46); + if (cof == null) + COF = UUID.Zero; + else + COF = cof.ID; + + m_log.DebugFormat("[ScenePresence]: CompleteMovement COF for {0} is {1}", client.AgentId, COF); + } + // Tell the client that we're totally ready ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); @@ -2776,34 +2787,15 @@ namespace OpenSim.Region.Framework.Scenes if (satOnObject) { -// SendAvatarDataToAllAgents(); m_requestedSitTargetID = 0; - part.RemoveSittingAvatar(UUID); - part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK); - } - else if (PhysicsActor == null) - AddToPhysicalScene(false); + SendAvatarDataToAllAgents(); + } Animator.TrySetMovementAnimation("STAND"); - if (satOnObject) - { - ILandObject land = m_scene.LandChannel.GetLandObject(AbsolutePosition.X,AbsolutePosition.Y); - if (land != null) - { - UUID parcelID = land.LandData.GlobalID; - if (m_currentParcelUUID != parcelID) - currentParcelUUID = parcelID; - else - SendAvatarDataToAllAgents(); - } - else - SendAvatarDataToAllAgents(); - } - TriggerScenePresenceUpdated(); } @@ -3078,11 +3070,14 @@ namespace OpenSim.Region.Framework.Scenes ParentPart = part; ParentID = part.LocalId; + + SendAvatarDataToAllAgents(); + if(status == 3) Animator.TrySetMovementAnimation("SIT_GROUND"); else Animator.TrySetMovementAnimation("SIT"); - SendAvatarDataToAllAgents(); + part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK); } @@ -3182,13 +3177,14 @@ namespace OpenSim.Region.Framework.Scenes Velocity = Vector3.Zero; RemoveFromPhysicalScene(); + SendAvatarDataToAllAgents(); + String sitAnimation = "SIT"; if (!String.IsNullOrEmpty(part.SitAnimation)) { sitAnimation = part.SitAnimation; } Animator.TrySetMovementAnimation(sitAnimation); - SendAvatarDataToAllAgents(); TriggerScenePresenceUpdated(); } } @@ -3478,8 +3474,8 @@ namespace OpenSim.Region.Framework.Scenes landch.sendClientInitialLandInfo(ControllingClient); } } - SendOtherAgentsAvatarDataToMe(); - SendOtherAgentsAppearanceToMe(); + + SendOtherAgentsAvatarFullToMe(); EntityBase[] entities = Scene.Entities.GetEntities(); foreach (EntityBase e in entities) @@ -3508,40 +3504,45 @@ namespace OpenSim.Region.Framework.Scenes // to see if all the baked textures are already here. if (m_scene.AvatarFactory != null) cachedappearance = m_scene.AvatarFactory.ValidateBakedTextureCache(this); - + // If we aren't using a cached appearance, then clear out the baked textures if (!cachedappearance) { -// Appearance.ResetAppearance(); -// save what ???? -// maybe needed so the tryretry repair works? if (m_scene.AvatarFactory != null) m_scene.AvatarFactory.QueueAppearanceSave(UUID); } - - // This agent just became root. We are going to tell everyone about it. The process of - // getting other avatars information was initiated elsewhere immediately after the child circuit connected... don't do it - // again here... this comes after the cached appearance check because the avatars - // appearance goes into the avatar update packet SendAvatarDataToAllAgents(); - - // This invocation always shows up in the viewer logs as an error. Is it needed? - // send all information we have - // possible not needed since viewer should ask about it - // least it all ask for baked SendAppearanceToAgent(this); - // If we are using the the cached appearance then send it out to everyone - // send even grays - if (cachedappearance) +// if (cachedappearance) +// { + SendAppearanceToAllOtherAgents(); +// } + Animator.SendAnimPack(); + } + + /// + /// Send avatar full data appearance and animations for all other root agents to this agent, this agent + /// can be either a child or root + /// + public void SendOtherAgentsAvatarFullToMe() + { + int count = 0; + m_scene.ForEachRootScenePresence(delegate(ScenePresence scenePresence) { -// m_log.DebugFormat("[SCENE PRESENCE]: Baked textures are in the cache for {0} in {1}", Name, m_scene.Name); - // If the avatars baked textures are all in the cache, then we have a - // complete appearance... send it out, if not, then we'll send it when - // the avatar finishes updating its appearance - SendAppearanceToAllOtherAgents(); - } + // only send information about other root agents + if (scenePresence.UUID == UUID) + return; + + scenePresence.SendAvatarDataToAgent(this); + scenePresence.SendAppearanceToAgent(this); + scenePresence.SendAnimPackToAgent(this); + // for now attachments are sent with all SOG + count++; + }); + + m_scene.StatsReporter.AddAgentUpdates(count); } /// @@ -3566,33 +3567,12 @@ namespace OpenSim.Region.Framework.Scenes m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) { - SendAvatarDataToAgent(scenePresence); - count++; + SendAvatarDataToAgent(scenePresence); + count++; }); m_scene.StatsReporter.AddAgentUpdates(count); } - - /// - /// Send avatar data for all other root agents to this agent, this agent - /// can be either a child or root - /// - public void SendOtherAgentsAvatarDataToMe() - { - int count = 0; - - m_scene.ForEachRootScenePresence(delegate(ScenePresence scenePresence) - { - // only send information about other root agents - if (scenePresence.UUID == UUID) - return; - - scenePresence.SendAvatarDataToAgent(this); - count++; - }); - - m_scene.StatsReporter.AddAgentUpdates(count); - } /// /// Send avatar data to an agent. @@ -3604,7 +3584,6 @@ namespace OpenSim.Region.Framework.Scenes if (ParcelHideThisAvatar && currentParcelUUID != avatar.currentParcelUUID && avatar.GodLevel < 200) return; avatar.ControllingClient.SendAvatarDataImmediate(this); - Animator.SendAnimPackToClient(avatar.ControllingClient); } /// @@ -3638,28 +3617,6 @@ namespace OpenSim.Region.Framework.Scenes m_scene.StatsReporter.AddAgentUpdates(count); } - /// - /// Send appearance from all other root agents to this agent. this agent - /// can be either root or child - /// - public void SendOtherAgentsAppearanceToMe() - { -// m_log.DebugFormat("[SCENE PRESENCE] SendOtherAgentsAppearanceToMe: {0} {1}", Name, UUID); - - int count = 0; - m_scene.ForEachRootScenePresence(delegate(ScenePresence scenePresence) - { - // only send information about other root agents - if (scenePresence.UUID == UUID) - return; - - scenePresence.SendAppearanceToAgent(this); - count++; - }); - - m_scene.StatsReporter.AddAgentUpdates(count); - } - /// /// Send appearance data to an agent. /// @@ -3674,6 +3631,30 @@ namespace OpenSim.Region.Framework.Scenes UUID, Appearance.VisualParams, Appearance.Texture.GetBytes()); } + public void SendAnimPackToAgent(ScenePresence p) + { + if (IsChildAgent || Animator == null) + return; + + if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200) + return; + + Animator.SendAnimPackToClient(p.ControllingClient); + } + + public void SendAnimPack(UUID[] animations, int[] seqs, UUID[] objectIDs) + { + if (IsChildAgent) + return; + + m_scene.ForEachScenePresence(delegate(ScenePresence p) + { + if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200) + return; + p.ControllingClient.SendAnimations(animations, seqs, ControllingClient.AgentId, objectIDs); + }); + } + #endregion #region Significant Movement Method @@ -4193,13 +4174,15 @@ namespace OpenSim.Region.Framework.Scenes } catch { } + Animator.ResetAnimations(); + // FIXME: Why is this null check necessary? Where are the cases where we get a null Anims object? - if (cAgent.Anims != null) - Animator.Animations.FromArray(cAgent.Anims); if (cAgent.DefaultAnim != null) Animator.Animations.SetDefaultAnimation(cAgent.DefaultAnim.AnimID, cAgent.DefaultAnim.SequenceNum, UUID.Zero); if (cAgent.AnimState != null) Animator.Animations.SetImplicitDefaultAnimation(cAgent.AnimState.AnimID, cAgent.AnimState.SequenceNum, UUID.Zero); + if (cAgent.Anims != null) + Animator.Animations.FromArray(cAgent.Anims); if (Scene.AttachmentsModule != null) Scene.AttachmentsModule.CopyAttachments(cAgent, this); @@ -5442,6 +5425,7 @@ namespace OpenSim.Region.Framework.Scenes p.SendAttachmentsToClient(ControllingClient); if (p.Animator != null) p.Animator.SendAnimPackToClient(ControllingClient); + } } } @@ -5597,36 +5581,37 @@ namespace OpenSim.Region.Framework.Scenes if (GodLevel >= 200) return; - List killsToSendme = new List(); + List killsToSendme = new List(); foreach (ScenePresence p in allpresences) { if (p.IsDeleted || p == this || p.ControllingClient == null || !p.ControllingClient.IsActive) continue; if (p.currentParcelUUID == m_currentParcelUUID) - { - killsToSendme.Add(p); + { + m_log.Debug("[AVATAR]: killMe: " + Lastname + " " + p.Lastname); + killsToSendme.Add(p.LocalId); } } if (killsToSendme.Count > 0) { - foreach (ScenePresence p in killsToSendme) + try { - m_log.Debug("[AVATAR]: killMe: " + Lastname + " " + p.Lastname); - try { ControllingClient.SendKillObject(new List { p.LocalId }); } - catch (NullReferenceException) { } + ControllingClient.SendKillObject(killsToSendme); } + catch (NullReferenceException) { } } + + } } - private void ParcelCrossCheck(UUID currentParcelID,UUID previusParcelID, bool currentParcelHide, bool previusParcelHide, bool oldhide,bool check) { List killsToSendto = new List(); - List killsToSendme = new List(); + List killsToSendme = new List(); List viewsToSendto = new List(); List viewsToSendme = new List(); List allpresences = null; @@ -5697,7 +5682,7 @@ namespace OpenSim.Region.Framework.Scenes if(p.GodLevel < 200) killsToSendto.Add(p); // they dont see me if(GodLevel < 200) - killsToSendme.Add(p); // i dont see them + killsToSendme.Add(p.LocalId); // i dont see them } // only those on new parcel need see if (currentParcelID == p.currentParcelUUID) @@ -5746,7 +5731,7 @@ namespace OpenSim.Region.Framework.Scenes // only those old parcel need receive kills if (previusParcelID == p.currentParcelUUID && GodLevel < 200) { - killsToSendme.Add(p); // i dont see them + killsToSendme.Add(p.LocalId); // i dont see them } else { @@ -5771,14 +5756,15 @@ namespace OpenSim.Region.Framework.Scenes } } - if (killsToSendme.Count > 0 ) + if (killsToSendme.Count > 0) { - foreach (ScenePresence p in killsToSendme) + m_log.Debug("[AVATAR]: killtoMe: " + Lastname + " " + killsToSendme.Count.ToString()); + try { - m_log.Debug("[AVATAR]: killMe: " + Lastname + " " + p.Lastname); - try {ControllingClient.SendKillObject(new List { p.LocalId }); } - catch (NullReferenceException) { } + ControllingClient.SendKillObject(killsToSendme); } + catch (NullReferenceException) { } + } if (viewsToSendto.Count > 0 && PresenceType != PresenceType.Npc) From 21b3980d2b47addfcefa28dff3b8b2b010258233 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 16 Aug 2014 21:46:25 +0100 Subject: [PATCH 18/50] send avatar Height to children, use it in region tp height check --- .../EntityTransfer/EntityTransferModule.cs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 8d2a276f37..890160b22b 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 } // TODO: Get proper AVG Height - float localAVHeight = 1.56f; + float localHalfAVHeight = 0.8f; + if (sp.Appearance != null) + localHalfAVHeight = sp.Appearance.AvatarHeight / 2; + float posZLimit = 22; // TODO: Check other Scene HeightField @@ -439,10 +442,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer posZLimit = (float)sp.Scene.Heightmap[(int)position.X, (int)position.Y]; } - float newPosZ = posZLimit + localAVHeight; - if (posZLimit >= (position.Z - (localAVHeight / 2)) && !(Single.IsInfinity(newPosZ) || Single.IsNaN(newPosZ))) + posZLimit += localHalfAVHeight + 0.1f; + + if ((position.Z < posZLimit) && !(Single.IsInfinity(posZLimit) || Single.IsNaN(posZLimit))) { - position.Z = newPosZ; + position.Z = posZLimit; } if (sp.Flying) @@ -724,6 +728,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer // agentCircuit.Appearance = sp.Appearance; // agentCircuit.Appearance = new AvatarAppearance(sp.Appearance, true, false); agentCircuit.Appearance = new AvatarAppearance(); + agentCircuit.Appearance.AvatarHeight = sp.Appearance.AvatarHeight; if (currentAgentCircuit != null) { @@ -1851,6 +1856,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer //agent.Appearance = sp.Appearance; //agent.Appearance = new AvatarAppearance(sp.Appearance, true, false); agent.Appearance = new AvatarAppearance(); + agent.Appearance.AvatarHeight = sp.Appearance.AvatarHeight; agent.CapsPath = CapsUtil.GetRandomCapsObjectPath(); @@ -1969,6 +1975,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer // agent.Appearance = sp.Appearance; // agent.Appearance = new AvatarAppearance(sp.Appearance, true, false); agent.Appearance = new AvatarAppearance(); + agent.Appearance.AvatarHeight = sp.Appearance.AvatarHeight; + if (currentAgentCircuit != null) { agent.ServiceURLs = currentAgentCircuit.ServiceURLs; From f6642a1cc88db4d021a5f6ed8e983622bb598003 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 16 Aug 2014 21:53:45 +0100 Subject: [PATCH 19/50] minor low resolution debug timming --- .../Framework/EntityTransfer/EntityTransferModule.cs | 7 +++++-- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 4 +++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 890160b22b..f639668aad 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -1674,8 +1674,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer public bool CrossAgentIntoNewRegionMain(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, bool isFlying) { + int ts = Util.EnvironmentTickCount(); try { + AgentData cAgent = new AgentData(); agent.CopyTo(cAgent); cAgent.Position = pos + agent.Velocity; @@ -1704,6 +1706,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer return false; } + m_log.DebugFormat("[CrossAgentIntoNewRegionMain] ok, time {0}ms",Util.EnvironmentTickCountSubtract(ts)); + } catch (Exception e) { @@ -1721,6 +1725,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer public void CrossAgentToNewRegionPost(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, bool isFlying, string version) { + agent.ControllingClient.RequestClientInfo(); string agentcaps; @@ -1784,8 +1789,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer // agent.SendOtherAgentsAvatarDataToMe(); // agent.SendOtherAgentsAppearanceToMe(); - - // Next, let's close the child agent connections that are too far away. uint neighbourx; uint neighboury; diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index faa5334a22..fc08b07e4b 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1754,7 +1754,7 @@ namespace OpenSim.Region.Framework.Scenes /// public void CompleteMovement(IClientAPI client, bool openChildAgents) { -// DateTime startTime = DateTime.Now; + int ts = Util.EnvironmentTickCount(); m_log.InfoFormat( "[SCENE PRESENCE]: Completing movement of {0} into region {1} in position {2}", @@ -1947,6 +1947,8 @@ namespace OpenSim.Region.Framework.Scenes ParcelLoginCheck(m_currentParcelUUID); m_currentParcelHide = newhide; } + + m_log.DebugFormat("[CompleteMovement] end: {0}ms", Util.EnvironmentTickCountSubtract(ts)); } /// From f8b8cf3d8f6c5454967ce1707a007383e3fc5a42 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 16 Aug 2014 22:16:15 +0100 Subject: [PATCH 20/50] more detailed timing on completmovement --- .../Region/Framework/Scenes/ScenePresence.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index fc08b07e4b..5af6a6c132 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1786,6 +1786,9 @@ namespace OpenSim.Region.Framework.Scenes AbsolutePosition = pos; } */ + + m_log.DebugFormat("[CompleteMovement] WaitForUpdateAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); + bool flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); if (!MakeRootAgent(AbsolutePosition, flying)) { @@ -1796,6 +1799,8 @@ namespace OpenSim.Region.Framework.Scenes return; } + m_log.DebugFormat("[CompleteMovement] MakeRootAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); + Vector3 look = Lookat; if ((Math.Abs(look.X) < 0.01) && (Math.Abs(look.Y) < 0.01)) { @@ -1827,6 +1832,8 @@ namespace OpenSim.Region.Framework.Scenes // m_log.DebugFormat("[SCENE PRESENCE] Completed movement"); + m_log.DebugFormat("[CompleteMovement] MoveAgentIntoRegion: {0}ms", Util.EnvironmentTickCountSubtract(ts)); + if (!string.IsNullOrEmpty(m_callbackURI)) { // We cannot sleep here since this would hold up the inbound packet processing thread, as @@ -1855,6 +1862,8 @@ namespace OpenSim.Region.Framework.Scenes // client.Name, client.AgentId, m_scene.RegionInfo.RegionName); // } + m_log.DebugFormat("[CompleteMovement] ReleaseAgent: {0}ms", Util.EnvironmentTickCountSubtract(ts)); + m_previusParcelHide = false; m_previusParcelUUID = UUID.Zero; m_currentParcelHide = false; @@ -1876,6 +1885,8 @@ namespace OpenSim.Region.Framework.Scenes ValidateAndSendAppearanceAndAgentData(); + m_log.DebugFormat("[CompleteMovement] ValidateAndSendAppearanceAndAgentData: {0}ms", Util.EnvironmentTickCountSubtract(ts)); + // attachments if (isNPC || (TeleportFlags & TeleportFlags.ViaLogin) != 0) { @@ -1905,6 +1916,8 @@ namespace OpenSim.Region.Framework.Scenes } } + m_log.DebugFormat("[CompleteMovement] attachments: {0}ms", Util.EnvironmentTickCountSubtract(ts)); + // Create child agents in neighbouring regions if (openChildAgents) { @@ -1914,10 +1927,14 @@ namespace OpenSim.Region.Framework.Scenes } } + m_log.DebugFormat("[CompleteMovement] openChildAgents: {0}ms", Util.EnvironmentTickCountSubtract(ts)); + // send the rest of the world if (m_teleportFlags > 0 && !isNPC) SendInitialDataToMe(); + m_log.DebugFormat("[CompleteMovement] SendInitialDataToMe: {0}ms", Util.EnvironmentTickCountSubtract(ts)); + if (!IsChildAgent) { // moved from makeroot missing in sendInitialDataToMe @@ -1934,6 +1951,8 @@ namespace OpenSim.Region.Framework.Scenes IFriendsModule friendsModule = m_scene.RequestModuleInterface(); if (friendsModule != null) friendsModule.SendFriendsOnlineIfNeeded(ControllingClient); + + m_log.DebugFormat("[CompleteMovement] friendsModule: {0}ms", Util.EnvironmentTickCountSubtract(ts)); } } } From 90987a548421c317802639b34a278deb709780e3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 16 Aug 2014 22:56:56 +0100 Subject: [PATCH 21/50] DEBUG intencional break of sending baked cache --- .../Framework/EntityTransfer/EntityTransferModule.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index f639668aad..b8171aff4b 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -1680,6 +1680,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer AgentData cAgent = new AgentData(); agent.CopyTo(cAgent); +// DEBUG badd !!! + cAgent.Appearance.WearableCacheItems = null; + cAgent.Position = pos + agent.Velocity; if (isFlying) cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; From ff518e7cbbb9f810db4bb9374b98390bd5fb3f11 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 17 Aug 2014 02:12:45 +0100 Subject: [PATCH 22/50] make webutilmore verbose on PUT for avatar updates. Reduce LargeTime debug level to 500ms from 3000ms --- OpenSim/Framework/WebUtil.cs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index 33ef8e01c7..86e529399b 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -81,7 +81,7 @@ namespace OpenSim.Framework /// Number of milliseconds a call can take before it is considered /// a "long" call for warning & debugging purposes /// - public const int LongCallTime = 3000; + public const int LongCallTime = 500; /// /// The maximum length of any data logged because of a long request time. @@ -208,6 +208,9 @@ namespace OpenSim.Framework string errorMessage = "unknown error"; int tickstart = Util.EnvironmentTickCount(); int tickdata = 0; + int tickcompressdata = 0; + int tickJsondata = 0; + int compsize = 0; string strBuffer = null; try @@ -225,6 +228,8 @@ namespace OpenSim.Framework { strBuffer = OSDParser.SerializeJsonString(data); + tickJsondata = Util.EnvironmentTickCountSubtract(tickstart); + if (DebugLevel >= 5) LogOutgoingDetail(strBuffer); @@ -243,13 +248,19 @@ namespace OpenSim.Framework // gets written on the strteam upon Dispose() } byte[] buf = ms.ToArray(); + + tickcompressdata = Util.EnvironmentTickCountSubtract(tickstart); + request.ContentLength = buf.Length; //Count bytes to send + compsize = buf.Length; using (Stream requestStream = request.GetRequestStream()) requestStream.Write(buf, 0, (int)buf.Length); } } else { + tickcompressdata = tickJsondata; + compsize = buffer.Length; request.ContentType = "application/json"; request.ContentLength = buffer.Length; //Count bytes to send using (Stream requestStream = request.GetRequestStream()) @@ -291,12 +302,16 @@ namespace OpenSim.Framework int tickdiff = Util.EnvironmentTickCountSubtract(tickstart); if (tickdiff > LongCallTime) m_log.InfoFormat( - "[WEB UTIL]: Slow ServiceOSD request {0} {1} {2} took {3}ms, {4}ms writing, {5}", + "[WEB UTIL]: Slow ServiceOSD request {0} {1} {2} took {3}ms, {4}ms writing({5} at Json; {6} at comp), {7} bytes ({8} uncomp): {9}", reqnum, method, url, tickdiff, tickdata, + tickJsondata, + tickcompressdata, + compsize, + strBuffer != null ? strBuffer.Length : 0, strBuffer != null ? (strBuffer.Length > MaxRequestDiagLength ? strBuffer.Remove(MaxRequestDiagLength) : strBuffer) : ""); From 4a2076092918d41d62e83c5623d715969f543c1b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 17 Aug 2014 02:26:35 +0100 Subject: [PATCH 23/50] remove hack to break sending of baked cache on agent cross update --- .../Framework/EntityTransfer/EntityTransferModule.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index b8171aff4b..ff0c01a270 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -1680,8 +1680,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer AgentData cAgent = new AgentData(); agent.CopyTo(cAgent); -// DEBUG badd !!! - cAgent.Appearance.WearableCacheItems = null; cAgent.Position = pos + agent.Velocity; if (isFlying) From 722b3a652318ac26e837e2f042b966ee35f6993c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 17 Aug 2014 03:22:05 +0100 Subject: [PATCH 24/50] make EnableChildAgent async from caller --- .../EntityTransfer/EntityTransferModule.cs | 113 ++++++++---------- 1 file changed, 52 insertions(+), 61 deletions(-) diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index ff0c01a270..7f7ee82ca9 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -1892,11 +1892,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer agent.Id0 = currentAgentCircuit.Id0; } + Thread.Sleep(200); // the original delay that was at InformClientOfNeighbourAsync start + IPEndPoint external = region.ExternalEndPoint; if (external != null) { InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; - d.BeginInvoke(sp, agent, region, external, true,true, + d.BeginInvoke(sp, agent, region, external, true, InformClientOfNeighbourCompleted, d); } @@ -1906,7 +1908,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer #region Enable Child Agents private delegate void InformClientOfNeighbourDelegate( - ScenePresence avatar, AgentCircuitData a, GridRegion reg, IPEndPoint endPoint, bool newAgent, bool doInitialDelay); + ScenePresence avatar, AgentCircuitData a, GridRegion reg, IPEndPoint endPoint, bool newAgent); /// /// This informs all neighbouring regions about agent "avatar". @@ -1945,10 +1947,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer List newRegions = NewNeighbours(neighbourHandles, previousRegionNeighbourHandles); List oldRegions = OldNeighbours(neighbourHandles, previousRegionNeighbourHandles); -// Dump("Current Neighbors", neighbourHandles); -// Dump("Previous Neighbours", previousRegionNeighbourHandles); -// Dump("New Neighbours", newRegions); -// Dump("Old Neighbours", oldRegions); + // Dump("Current Neighbors", neighbourHandles); + // Dump("Previous Neighbours", previousRegionNeighbourHandles); + // Dump("New Neighbours", newRegions); + // Dump("Old Neighbours", oldRegions); /// Update the scene presence's known regions here on this region sp.DropOldNeighbours(oldRegions); @@ -2020,64 +2022,58 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer //avatar.Scene.DumpChildrenSeeds(avatar.UUID); //avatar.DumpKnownRegions(); - bool newAgent = false; - int count = 0; - bool delay = true; - foreach (GridRegion neighbour in neighbours) + Util.FireAndForget(delegate { - //m_log.WarnFormat("--> Going to send child agent to {0}", neighbour.RegionName); - // Don't do it if there's already an agent in that region - if (newRegions.Contains(neighbour.RegionHandle)) - newAgent = true; - else - newAgent = false; -// continue; + Thread.Sleep(200); // the original delay that was at InformClientOfNeighbourAsync start + int count = 0; + bool newAgent = false; - if (neighbour.RegionHandle != sp.Scene.RegionInfo.RegionHandle) + foreach (GridRegion neighbour in neighbours) { - try - { - // Let's put this back at sync, so that it doesn't clog - // the network, especially for regions in the same physical server. - // We're really not in a hurry here. - InformClientOfNeighbourAsync(sp, cagents[count], neighbour, neighbour.ExternalEndPoint, newAgent, delay); - delay = false; // ugly i know.. but there aren't that many neighbours + //m_log.WarnFormat("--> Going to send child agent to {0}", neighbour.RegionName); + // Don't do it if there's already an agent in that region + if (newRegions.Contains(neighbour.RegionHandle)) + newAgent = true; + else + newAgent = false; + // continue; - //InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; - //d.BeginInvoke(sp, cagents[count], neighbour, neighbour.ExternalEndPoint, newAgent, - // InformClientOfNeighbourCompleted, - // d); - } + if (neighbour.RegionHandle != sp.Scene.RegionInfo.RegionHandle) + { + try + { + InformClientOfNeighbourAsync(sp, cagents[count], neighbour, neighbour.ExternalEndPoint, newAgent); + } - catch (ArgumentOutOfRangeException) - { - m_log.ErrorFormat( - "[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}).", - neighbour.ExternalHostName, - neighbour.RegionHandle, - neighbour.RegionLocX, - neighbour.RegionLocY); - } - catch (Exception e) - { - m_log.ErrorFormat( - "[ENTITY TRANSFER MODULE]: Could not resolve external hostname {0} for region {1} ({2}, {3}). {4}", - neighbour.ExternalHostName, - neighbour.RegionHandle, + catch (ArgumentOutOfRangeException) + { + m_log.ErrorFormat( + "[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}).", + neighbour.ExternalHostName, + neighbour.RegionHandle, neighbour.RegionLocX, - neighbour.RegionLocY, - e); + neighbour.RegionLocY); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[ENTITY TRANSFER MODULE]: Could not resolve external hostname {0} for region {1} ({2}, {3}). {4}", + neighbour.ExternalHostName, + neighbour.RegionHandle, + neighbour.RegionLocX, + neighbour.RegionLocY, + e); - // FIXME: Okay, even though we've failed, we're still going to throw the exception on, - // since I don't know what will happen if we just let the client continue - - // XXX: Well, decided to swallow the exception instead for now. Let us see how that goes. - // throw e; + // FIXME: Okay, even though we've failed, we're still going to throw the exception on, + // since I don't know what will happen if we just let the client continue + // XXX: Well, decided to swallow the exception instead for now. Let us see how that goes. + // throw e; + } } + count++; } - count++; - } + }); } Vector3 CalculateOffset(ScenePresence sp, GridRegion neighbour) @@ -2109,14 +2105,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer /// /// private void InformClientOfNeighbourAsync(ScenePresence sp, AgentCircuitData a, GridRegion reg, - IPEndPoint endPoint, bool newAgent,bool doinitialdelay) + IPEndPoint endPoint, bool newAgent) { - // Let's wait just a little to give time to originating regions to catch up with closing child agents - // after a cross here - if(doinitialdelay) - Thread.Sleep(500); - - Scene scene = sp.Scene; + Scene scene = sp.Scene; m_log.DebugFormat( "[ENTITY TRANSFER MODULE]: Informing {0} {1} about neighbour {2} {3} at ({4},{5})", From 99a87f18c0ba9135266067d1da2f94a425a98cd8 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 17 Aug 2014 04:24:55 +0100 Subject: [PATCH 25/50] bad test --- .../Framework/EntityTransfer/EntityTransferModule.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 7f7ee82ca9..fb0da2e364 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -2024,7 +2024,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer Util.FireAndForget(delegate { - Thread.Sleep(200); // the original delay that was at InformClientOfNeighbourAsync start + /// 5000 is BAD test + Thread.Sleep(5000); // the original delay that was at InformClientOfNeighbourAsync start int count = 0; bool newAgent = false; From 8d11b96cd989e5e0ddf2a204b1150cca5a5db1a6 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 17 Aug 2014 05:59:14 +0100 Subject: [PATCH 26/50] *DANGER* rearange EnableChildAgents() so that hopefully it does it job better, like not telling clients to log on regions where they are already child --- .../EntityTransfer/EntityTransferModule.cs | 198 ++++++++---------- 1 file changed, 90 insertions(+), 108 deletions(-) diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index fb0da2e364..6ea9325067 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -1841,7 +1841,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer #region Enable Child Agent /// - /// This informs a single neighbouring region about agent "avatar". + /// This informs a single neighbouring region about agent "avatar", and avatar about it /// Calls an asynchronous method to do so.. so it doesn't lag the sim. /// /// @@ -1857,8 +1857,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer agent.startpos = new Vector3(128, 128, 70); agent.child = true; - //agent.Appearance = sp.Appearance; - //agent.Appearance = new AvatarAppearance(sp.Appearance, true, false); agent.Appearance = new AvatarAppearance(); agent.Appearance.AvatarHeight = sp.Appearance.AvatarHeight; @@ -1912,6 +1910,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer /// /// This informs all neighbouring regions about agent "avatar". + /// and as important informs the avatar about then /// /// public void EnableChildAgents(ScenePresence sp) @@ -1928,84 +1927,77 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer m_log.Debug("[ENTITY TRANSFER MODULE]: m_regionInfo was null in EnableChildAgents, is this a NPC?"); } - /// We need to find the difference between the new regions where there are no child agents - /// and the regions where there are already child agents. We only send notification to the former. - List neighbourHandles = NeighbourHandles(neighbours); // on this region - neighbourHandles.Add(sp.Scene.RegionInfo.RegionHandle); // add this region too - List previousRegionNeighbourHandles; + LinkedList previousRegionNeighbourHandles; - if (sp.Scene.CapsModule != null) - { - previousRegionNeighbourHandles = - new List(sp.Scene.CapsModule.GetChildrenSeeds(sp.UUID).Keys); - } - else - { - previousRegionNeighbourHandles = new List(); - } - - List newRegions = NewNeighbours(neighbourHandles, previousRegionNeighbourHandles); - List oldRegions = OldNeighbours(neighbourHandles, previousRegionNeighbourHandles); - - // Dump("Current Neighbors", neighbourHandles); - // Dump("Previous Neighbours", previousRegionNeighbourHandles); - // Dump("New Neighbours", newRegions); - // Dump("Old Neighbours", oldRegions); - - /// Update the scene presence's known regions here on this region - sp.DropOldNeighbours(oldRegions); - - /// Collect as many seeds as possible Dictionary seeds; - if (sp.Scene.CapsModule != null) - seeds = new Dictionary(sp.Scene.CapsModule.GetChildrenSeeds(sp.UUID)); - else - seeds = new Dictionary(); - //m_log.Debug(" !!! No. of seeds: " + seeds.Count); + if (sp.Scene.CapsModule != null) + { + seeds = new Dictionary(sp.Scene.CapsModule.GetChildrenSeeds(sp.UUID)); + previousRegionNeighbourHandles = new LinkedList(seeds.Keys); + } + else + { + seeds = new Dictionary(); + previousRegionNeighbourHandles = new LinkedList(); + } + if (!seeds.ContainsKey(sp.Scene.RegionInfo.RegionHandle)) seeds.Add(sp.Scene.RegionInfo.RegionHandle, sp.ControllingClient.RequestClientInfo().CapsPath); - /// Create the necessary child agents + AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); + + List newneighbours = new List(); List cagents = new List(); + + ulong currentRegionHandler = sp.Scene.RegionInfo.RegionHandle; + foreach (GridRegion neighbour in neighbours) { - if (neighbour.RegionHandle != sp.Scene.RegionInfo.RegionHandle) + ulong handler = neighbour.RegionHandle; + + if (handler == currentRegionHandler) + continue; + + AgentCircuitData agent = sp.ControllingClient.RequestClientInfo(); + agent.BaseFolder = UUID.Zero; + agent.InventoryFolder = UUID.Zero; + agent.startpos = sp.AbsolutePosition + CalculateOffset(sp, neighbour); + agent.child = true; + agent.Appearance = new AvatarAppearance(); + agent.Appearance.AvatarHeight = sp.Appearance.AvatarHeight; + + if (currentAgentCircuit != null) { - AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); - AgentCircuitData agent = sp.ControllingClient.RequestClientInfo(); - agent.BaseFolder = UUID.Zero; - agent.InventoryFolder = UUID.Zero; - agent.startpos = sp.AbsolutePosition + CalculateOffset(sp, neighbour); - agent.child = true; - // agent.Appearance = sp.Appearance; - // agent.Appearance = new AvatarAppearance(sp.Appearance, true, false); - agent.Appearance = new AvatarAppearance(); - agent.Appearance.AvatarHeight = sp.Appearance.AvatarHeight; - - if (currentAgentCircuit != null) - { - agent.ServiceURLs = currentAgentCircuit.ServiceURLs; - agent.IPAddress = currentAgentCircuit.IPAddress; - agent.Viewer = currentAgentCircuit.Viewer; - agent.Channel = currentAgentCircuit.Channel; - agent.Mac = currentAgentCircuit.Mac; - agent.Id0 = currentAgentCircuit.Id0; - } - - if (newRegions.Contains(neighbour.RegionHandle)) - { - agent.CapsPath = CapsUtil.GetRandomCapsObjectPath(); - sp.AddNeighbourRegion(neighbour.RegionHandle, agent.CapsPath); - seeds.Add(neighbour.RegionHandle, agent.CapsPath); - } - else - { - agent.CapsPath = sp.Scene.CapsModule.GetChildSeed(sp.UUID, neighbour.RegionHandle); - } - - cagents.Add(agent); + agent.ServiceURLs = currentAgentCircuit.ServiceURLs; + agent.IPAddress = currentAgentCircuit.IPAddress; + agent.Viewer = currentAgentCircuit.Viewer; + agent.Channel = currentAgentCircuit.Channel; + agent.Mac = currentAgentCircuit.Mac; + agent.Id0 = currentAgentCircuit.Id0; } + + if (previousRegionNeighbourHandles.Contains(handler)) + { + previousRegionNeighbourHandles.Remove(handler); + agent.CapsPath = sp.Scene.CapsModule.GetChildSeed(sp.UUID, handler); + } + else + { + newneighbours.Add(handler); + agent.CapsPath = CapsUtil.GetRandomCapsObjectPath(); + sp.AddNeighbourRegion(handler, agent.CapsPath); + seeds.Add(handler, agent.CapsPath); + } + + cagents.Add(agent); + } + + //sp.DropOldNeighbours(previousRegionNeighbourHandles); + foreach (ulong handle in previousRegionNeighbourHandles) + { + sp.RemoveNeighbourRegion(handle); + Scene.CapsModule.DropChildSeed(sp.UUID, handle); } /// Update all child agent with everyone's seeds @@ -2018,59 +2010,49 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer { sp.Scene.CapsModule.SetChildrenSeed(sp.UUID, seeds); } + sp.KnownRegions = seeds; //avatar.Scene.DumpChildrenSeeds(avatar.UUID); //avatar.DumpKnownRegions(); Util.FireAndForget(delegate { - /// 5000 is BAD test - Thread.Sleep(5000); // the original delay that was at InformClientOfNeighbourAsync start + Thread.Sleep(200); // the original delay that was at InformClientOfNeighbourAsync start int count = 0; - bool newAgent = false; + bool newagent; foreach (GridRegion neighbour in neighbours) { - //m_log.WarnFormat("--> Going to send child agent to {0}", neighbour.RegionName); - // Don't do it if there's already an agent in that region - if (newRegions.Contains(neighbour.RegionHandle)) - newAgent = true; - else - newAgent = false; - // continue; - - if (neighbour.RegionHandle != sp.Scene.RegionInfo.RegionHandle) + try { - try - { - InformClientOfNeighbourAsync(sp, cagents[count], neighbour, neighbour.ExternalEndPoint, newAgent); - } + newagent = newneighbours.Contains(neighbour.RegionHandle); + InformClientOfNeighbourAsync(sp, cagents[count], neighbour, neighbour.ExternalEndPoint, newagent); + } - catch (ArgumentOutOfRangeException) - { - m_log.ErrorFormat( - "[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}).", - neighbour.ExternalHostName, - neighbour.RegionHandle, + catch (ArgumentOutOfRangeException) + { + m_log.ErrorFormat( + "[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}).", + neighbour.ExternalHostName, + neighbour.RegionHandle, + neighbour.RegionLocX, + neighbour.RegionLocY); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[ENTITY TRANSFER MODULE]: Could not resolve external hostname {0} for region {1} ({2}, {3}). {4}", + neighbour.ExternalHostName, + neighbour.RegionHandle, neighbour.RegionLocX, - neighbour.RegionLocY); - } - catch (Exception e) - { - m_log.ErrorFormat( - "[ENTITY TRANSFER MODULE]: Could not resolve external hostname {0} for region {1} ({2}, {3}). {4}", - neighbour.ExternalHostName, - neighbour.RegionHandle, - neighbour.RegionLocX, - neighbour.RegionLocY, - e); + neighbour.RegionLocY, + e); - // FIXME: Okay, even though we've failed, we're still going to throw the exception on, - // since I don't know what will happen if we just let the client continue + // FIXME: Okay, even though we've failed, we're still going to throw the exception on, + // since I don't know what will happen if we just let the client continue - // XXX: Well, decided to swallow the exception instead for now. Let us see how that goes. - // throw e; - } + // XXX: Well, decided to swallow the exception instead for now. Let us see how that goes. + // throw e; } count++; } From d3b38220060c6846dd9efdc2e1d8c196f6402b68 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 17 Aug 2014 07:32:24 +0100 Subject: [PATCH 27/50] TEST DANGER InformClientOfNeighbourAsync do nothing unless a newagent --- .../Framework/EntityTransfer/EntityTransferModule.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 6ea9325067..7adb4b51f6 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -2091,6 +2091,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer IPEndPoint endPoint, bool newAgent) { Scene scene = sp.Scene; + if (!newAgent) + return; m_log.DebugFormat( "[ENTITY TRANSFER MODULE]: Informing {0} {1} about neighbour {2} {3} at ({4},{5})", From 7ce32d717ad0c958e0b59909247f57117f7d54b4 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 17 Aug 2014 07:57:26 +0100 Subject: [PATCH 28/50] TEST disable again baked textures on crossing --- .../Framework/EntityTransfer/EntityTransferModule.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 7adb4b51f6..687871e108 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -1681,6 +1681,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer AgentData cAgent = new AgentData(); agent.CopyTo(cAgent); + agent.Appearance.WearableCacheItems = null; + cAgent.Position = pos + agent.Velocity; if (isFlying) cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; From 31a2c07e833cab6ca2f14e493fd1b96e776097c2 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 17 Aug 2014 09:54:38 +0100 Subject: [PATCH 29/50] put bake bakes, plus a missing change forcing animations to pass by scenepresence --- .../Framework/EntityTransfer/EntityTransferModule.cs | 2 +- .../Framework/Scenes/Animation/ScenePresenceAnimator.cs | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 687871e108..feeb0d5cd6 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -1681,7 +1681,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer AgentData cAgent = new AgentData(); agent.CopyTo(cAgent); - agent.Appearance.WearableCacheItems = null; +// agent.Appearance.WearableCacheItems = null; cAgent.Position = pos + agent.Velocity; if (isFlying) diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs index ecd6a09a9b..668087f6b3 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs @@ -557,6 +557,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation /// public void SendAnimPack(UUID[] animations, int[] seqs, UUID[] objectIDs) { +/* if (m_scenePresence.IsChildAgent) return; @@ -571,6 +572,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation { client.SendAnimations(animations, seqs, m_scenePresence.ControllingClient.AgentId, objectIDs); }); + */ + m_scenePresence.SendAnimPack(animations, seqs, objectIDs); } public void SendAnimPackToClient(IClientAPI client) @@ -602,7 +605,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation m_animations.GetArrays(out animIDs, out sequenceNums, out objectIDs); - SendAnimPack(animIDs, sequenceNums, objectIDs); +// SendAnimPack(animIDs, sequenceNums, objectIDs); + m_scenePresence.SendAnimPack(animIDs, sequenceNums, objectIDs); } public string GetAnimName(UUID animId) From f8e4805d98dc464b703beb21b5896b62a9efded2 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 18 Aug 2014 01:34:16 +0100 Subject: [PATCH 30/50] NOT GOOD. Changed hide code on crossing/tp. Send needed avatar and attachments kills, visible so we can see what is going on, to try to improve later (this are always needed, hidding just made issues more visible ) --- .../EntityTransfer/EntityTransferModule.cs | 18 +++- .../Region/Framework/Scenes/ScenePresence.cs | 97 ++++++++++++------- 2 files changed, 74 insertions(+), 41 deletions(-) diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index feeb0d5cd6..0208676036 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -980,7 +980,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer } // May need to logout or other cleanup - AgentHasMovedAway(sp, logout); +// AgentHasMovedAway(sp, logout); + AgentHasMovedAway(sp, true); // until logout use is checked // Well, this is it. The agent is over there. KillEntity(sp.Scene, sp.LocalId); @@ -1147,7 +1148,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer sp.CloseChildAgents(newRegionX, newRegionY); // May need to logout or other cleanup - AgentHasMovedAway(sp, logout); +// AgentHasMovedAway(sp, logout); + AgentHasMovedAway(sp, true); // Well, this is it. The agent is over there. KillEntity(sp.Scene, sp.LocalId); @@ -1262,7 +1264,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer protected virtual void AgentHasMovedAway(ScenePresence sp, bool logout) { if (sp.Scene.AttachmentsModule != null) - sp.Scene.AttachmentsModule.DeleteAttachmentsFromScene(sp, true); + sp.Scene.AttachmentsModule.DeleteAttachmentsFromScene(sp, logout); } protected void KillEntity(Scene scene, uint localID) @@ -1740,6 +1742,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer } // No turning back + + + agent.IsChildAgent = true; string capsPath = neighbourRegion.ServerURI + CapsUtil.GetCapsSeedPath(agentcaps); @@ -1777,7 +1782,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer // Unlike a teleport, here we do not wait for the destination region to confirm the receipt. m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.CleaningUp); - agent.parcelRegionCross(false); + AgentHasMovedAway(agent, false); + + KillEntity(agent.Scene, agent.LocalId); +// agent.parcelRegionCross(false); agent.MakeChildAgent(); @@ -1803,7 +1811,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer agent.CloseChildAgents(neighbourx, neighboury); - AgentHasMovedAway(agent, false); + // the user may change their profile information in other region, // so the userinfo in UserProfileCache is not reliable any more, delete it diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 5af6a6c132..977ff24985 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1400,7 +1400,7 @@ namespace OpenSim.Region.Framework.Scenes else Animator.ResetAnimations(); - + // m_log.DebugFormat( // "[SCENE PRESENCE]: Downgrading root agent {0}, {1} to a child agent in {2}", // Name, UUID, m_scene.RegionInfo.RegionName); @@ -1876,17 +1876,14 @@ namespace OpenSim.Region.Framework.Scenes if (!IsChildAgent) { - newhide = m_currentParcelHide; - m_currentParcelHide = false; - // take this region out of children Neighbours list - // possible should be done elsewhere - DropThisRootRegionFromNeighbours(); ValidateAndSendAppearanceAndAgentData(); m_log.DebugFormat("[CompleteMovement] ValidateAndSendAppearanceAndAgentData: {0}ms", Util.EnvironmentTickCountSubtract(ts)); + List attachments = GetAttachments(); + // attachments if (isNPC || (TeleportFlags & TeleportFlags.ViaLogin) != 0) { @@ -1899,8 +1896,6 @@ namespace OpenSim.Region.Framework.Scenes } else { - List attachments = GetAttachments(); - if (attachments.Count > 0) { m_log.DebugFormat( @@ -1930,7 +1925,7 @@ namespace OpenSim.Region.Framework.Scenes m_log.DebugFormat("[CompleteMovement] openChildAgents: {0}ms", Util.EnvironmentTickCountSubtract(ts)); // send the rest of the world - if (m_teleportFlags > 0 && !isNPC) + if (m_teleportFlags > 0 && !isNPC || m_currentParcelHide) SendInitialDataToMe(); m_log.DebugFormat("[CompleteMovement] SendInitialDataToMe: {0}ms", Util.EnvironmentTickCountSubtract(ts)); @@ -1961,11 +1956,11 @@ namespace OpenSim.Region.Framework.Scenes m_inTransit = false; } // if hide force a check - if (!IsChildAgent && newhide) - { - ParcelLoginCheck(m_currentParcelUUID); - m_currentParcelHide = newhide; - } + // if (!IsChildAgent && newhide) + // { + // ParcelLoginCheck(m_currentParcelUUID); + // m_currentParcelHide = newhide; + // } m_log.DebugFormat("[CompleteMovement] end: {0}ms", Util.EnvironmentTickCountSubtract(ts)); } @@ -3533,14 +3528,25 @@ namespace OpenSim.Region.Framework.Scenes m_scene.AvatarFactory.QueueAppearanceSave(UUID); } + bool newhide = m_currentParcelHide; + m_currentParcelHide = false; + SendAvatarDataToAllAgents(); + + if (newhide) + { + ParcelLoginCheck(m_currentParcelUUID); + m_currentParcelHide = true; + } + SendAppearanceToAgent(this); // if (cachedappearance) // { SendAppearanceToAllOtherAgents(); // } - Animator.SendAnimPack(); + if(Animator!= null) + Animator.SendAnimPack(); } /// @@ -5481,7 +5487,7 @@ namespace OpenSim.Region.Framework.Scenes private void ParcelLoginCheck(UUID currentParcelID) { List killsToSendto = new List(); - List killsToSendme = new List(); + List killsToSendme = new List(); List viewsToSendto = new List(); List viewsToSendme = new List(); List allpresences = null; @@ -5498,7 +5504,7 @@ namespace OpenSim.Region.Framework.Scenes if (p.GodLevel < 200) killsToSendto.Add(p); if (GodLevel < 200 && p.ParcelHideThisAvatar) - killsToSendme.Add(p); + killsToSendme.Add(p.LocalId); } else { @@ -5522,14 +5528,15 @@ namespace OpenSim.Region.Framework.Scenes if (killsToSendme.Count > 0) { - foreach (ScenePresence p in killsToSendme) + m_log.Debug("[AVATAR]: killMe: " + Lastname + " " + killsToSendme.Count.ToString()); + try { - m_log.Debug("[AVATAR]: killMe: " + Lastname + " " + p.Lastname); - try { ControllingClient.SendKillObject(new List { p.LocalId }); } - catch (NullReferenceException) { } + ControllingClient.SendKillObject(killsToSendme); } - } + catch (NullReferenceException) { } + } +/* if (viewsToSendto.Count > 0 && PresenceType != PresenceType.Npc) { foreach (ScenePresence p in viewsToSendto) @@ -5557,16 +5564,18 @@ namespace OpenSim.Region.Framework.Scenes p.Animator.SendAnimPackToClient(ControllingClient); } } +*/ } public void parcelRegionCross(bool abort) { - if (!ParcelHideThisAvatar) - return; +// if (!ParcelHideThisAvatar) +// return; List allpresences = null; allpresences = m_scene.GetScenePresences(); +// abort no longer complet if (abort) { List viewsToSendme = new List(); @@ -5588,7 +5597,7 @@ namespace OpenSim.Region.Framework.Scenes { if (p.IsChildAgent) continue; -// m_log.Debug("[AVATAR]: viewMe: " + Lastname + " " + p.Lastname); + // m_log.Debug("[AVATAR]: viewMe: " + Lastname + " " + p.Lastname); ControllingClient.SendAvatarDataImmediate(p); p.SendAppearanceToAgent(this); p.SendAttachmentsToClient(ControllingClient); @@ -5599,22 +5608,36 @@ namespace OpenSim.Region.Framework.Scenes } else { - if (GodLevel >= 200) - return; + bool inprivate = ParcelHideThisAvatar && GodLevel < 200; List killsToSendme = new List(); - foreach (ScenePresence p in allpresences) - { - if (p.IsDeleted || p == this || p.ControllingClient == null || !p.ControllingClient.IsActive) - continue; - if (p.currentParcelUUID == m_currentParcelUUID) - { - m_log.Debug("[AVATAR]: killMe: " + Lastname + " " + p.Lastname); + if (inprivate) + { + foreach (ScenePresence p in allpresences) + { + if (p.IsDeleted || p == this || p.ControllingClient == null || !p.ControllingClient.IsActive) + continue; + + if (p.currentParcelUUID == m_currentParcelUUID) + { + m_log.Debug("[AVATAR]: killMe: " + Lastname + " " + p.Lastname); + killsToSendme.Add(p.LocalId); + } + } + } +/* + else + { + foreach (ScenePresence p in allpresences) + { + if (p.IsDeleted || p == this || p.ControllingClient == null || !p.ControllingClient.IsActive) + continue; + killsToSendme.Add(p.LocalId); } } - +*/ if (killsToSendme.Count > 0) { try @@ -5623,8 +5646,10 @@ namespace OpenSim.Region.Framework.Scenes } catch (NullReferenceException) { } } + + if (Scene.AttachmentsModule != null) + Scene.AttachmentsModule.DeleteAttachmentsFromScene(this, true); - } } From 96de2a2fd2feed899d19fabc077a1bd3f7cc3fc8 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 18 Aug 2014 04:07:40 +0100 Subject: [PATCH 31/50] reduce the kills sent, hide attachments kills on origin --- .../EntityTransfer/EntityTransferModule.cs | 5 +- .../Region/Framework/Scenes/ScenePresence.cs | 89 ++++--------------- 2 files changed, 19 insertions(+), 75 deletions(-) diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 0208676036..ec7dd77ad1 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -1782,10 +1782,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer // Unlike a teleport, here we do not wait for the destination region to confirm the receipt. m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.CleaningUp); - AgentHasMovedAway(agent, false); + AgentHasMovedAway(agent, true); - KillEntity(agent.Scene, agent.LocalId); -// agent.parcelRegionCross(false); + agent.parcelRegionCross(); agent.MakeChildAgent(); diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 977ff24985..20d0f2950d 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -5503,8 +5503,8 @@ namespace OpenSim.Region.Framework.Scenes { if (p.GodLevel < 200) killsToSendto.Add(p); - if (GodLevel < 200 && p.ParcelHideThisAvatar) - killsToSendme.Add(p.LocalId); +// if (GodLevel < 200 && p.ParcelHideThisAvatar) +// killsToSendme.Add(p.LocalId); } else { @@ -5567,89 +5567,34 @@ namespace OpenSim.Region.Framework.Scenes */ } - public void parcelRegionCross(bool abort) + public void parcelRegionCross() { -// if (!ParcelHideThisAvatar) -// return; + if (!ParcelHideThisAvatar || GodLevel >= 200) + return; List allpresences = null; allpresences = m_scene.GetScenePresences(); -// abort no longer complet - if (abort) + List killsToSendme = new List(); + + foreach (ScenePresence p in allpresences) { - List viewsToSendme = new List(); + if (p.IsDeleted || p == this || p.ControllingClient == null || !p.ControllingClient.IsActive) + continue; - foreach (ScenePresence p in allpresences) + if (p.currentParcelUUID == m_currentParcelUUID) { - if (p.IsDeleted || p == this || p.ControllingClient == null || !p.ControllingClient.IsActive) - continue; - - if (p.currentParcelUUID == m_currentParcelUUID) - { - viewsToSendme.Add(p); - } - } - - if (viewsToSendme.Count > 0) - { - foreach (ScenePresence p in viewsToSendme) - { - if (p.IsChildAgent) - continue; - // m_log.Debug("[AVATAR]: viewMe: " + Lastname + " " + p.Lastname); - ControllingClient.SendAvatarDataImmediate(p); - p.SendAppearanceToAgent(this); - p.SendAttachmentsToClient(ControllingClient); - if (p.Animator != null) - p.Animator.SendAnimPackToClient(ControllingClient); - } + killsToSendme.Add(p.LocalId); } } - else + + if (killsToSendme.Count > 0) { - - bool inprivate = ParcelHideThisAvatar && GodLevel < 200; - List killsToSendme = new List(); - - if (inprivate) + try { - foreach (ScenePresence p in allpresences) - { - if (p.IsDeleted || p == this || p.ControllingClient == null || !p.ControllingClient.IsActive) - continue; - - if (p.currentParcelUUID == m_currentParcelUUID) - { - m_log.Debug("[AVATAR]: killMe: " + Lastname + " " + p.Lastname); - killsToSendme.Add(p.LocalId); - } - } + ControllingClient.SendKillObject(killsToSendme); } -/* - else - { - foreach (ScenePresence p in allpresences) - { - if (p.IsDeleted || p == this || p.ControllingClient == null || !p.ControllingClient.IsActive) - continue; - - killsToSendme.Add(p.LocalId); - } - } -*/ - if (killsToSendme.Count > 0) - { - try - { - ControllingClient.SendKillObject(killsToSendme); - } - catch (NullReferenceException) { } - } - - if (Scene.AttachmentsModule != null) - Scene.AttachmentsModule.DeleteAttachmentsFromScene(this, true); - + catch (NullReferenceException) { } } } From 83e545df934fc93698b53f9e1ec9621157e93c39 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 18 Aug 2014 19:14:53 +0100 Subject: [PATCH 32/50] *DANGER* *HACKS* on reusing child presences: partA send kills to viewers, partB keep using same localID (as before) --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 20d0f2950d..3c7e4a2b6b 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -5567,6 +5567,7 @@ namespace OpenSim.Region.Framework.Scenes */ } + public void parcelRegionCross() { if (!ParcelHideThisAvatar || GodLevel >= 200) From 73b8dc4183772f584e9c3477217e8736311ebd88 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 18 Aug 2014 19:19:25 +0100 Subject: [PATCH 33/50] missing file for previus commit --- OpenSim/Region/Framework/Scenes/Scene.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 0266faf821..dc3f57a81d 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3903,6 +3903,16 @@ namespace OpenSim.Region.Framework.Scenes sp.LifecycleState = ScenePresenceState.Running; + + //HACK part A + // kill in viewers sp.localID that they may still know about + + SendKillObject(new List { sp.LocalId }); + + //HACK part B + // keep using same localID + + if (EntityTransferModule.IsInTransit(sp.UUID)) { sp.DoNotCloseAfterTeleport = true; From d31f361e8900aebb27f220bf0120dec5eb14c78a Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 18 Aug 2014 19:41:16 +0100 Subject: [PATCH 34/50] moved hacks to scene presence completemovement, possible only needed there? --- OpenSim/Region/Framework/Scenes/Scene.cs | 10 ---------- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 10 ++++++++++ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index dc3f57a81d..0266faf821 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3903,16 +3903,6 @@ namespace OpenSim.Region.Framework.Scenes sp.LifecycleState = ScenePresenceState.Running; - - //HACK part A - // kill in viewers sp.localID that they may still know about - - SendKillObject(new List { sp.LocalId }); - - //HACK part B - // keep using same localID - - if (EntityTransferModule.IsInTransit(sp.UUID)) { sp.DoNotCloseAfterTeleport = true; diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 3c7e4a2b6b..1ace0d9dd5 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1767,10 +1767,20 @@ namespace OpenSim.Region.Framework.Scenes // Make sure it's not a login agent. We don't want to wait for updates during login if (!isNPC && (m_teleportFlags & TeleportFlags.ViaLogin) == 0) { + // Let's wait until UpdateAgent (called by departing region) is done if (!WaitForUpdateAgent(client)) // The sending region never sent the UpdateAgent data, we have to refuse return; + + //HACK part A + // kill in viewers sp.localID that they may still know about + m_log.DebugFormat("[CompleteMovement] send old child kills"); + m_scene.SendKillObject(new List { LocalId }); + + //HACK part B + // keep using same localID + } // Prevent teleporting to an underground location From ffcc1d7fa2735e478b5d020950aa7152e6da2713 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 18 Aug 2014 23:14:04 +0100 Subject: [PATCH 35/50] undo the hack.. its useless --- .../Framework/EntityTransfer/EntityTransferModule.cs | 5 +++-- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 9 --------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index ec7dd77ad1..d5eca03f09 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -1782,10 +1782,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer // Unlike a teleport, here we do not wait for the destination region to confirm the receipt. m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.CleaningUp); - AgentHasMovedAway(agent, true); - + // this may need the attachments agent.parcelRegionCross(); + AgentHasMovedAway(agent, true); + agent.MakeChildAgent(); // FIXME: Possibly this should occur lower down after other commands to close other agents, diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 1ace0d9dd5..68115464ae 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1772,15 +1772,6 @@ namespace OpenSim.Region.Framework.Scenes if (!WaitForUpdateAgent(client)) // The sending region never sent the UpdateAgent data, we have to refuse return; - - //HACK part A - // kill in viewers sp.localID that they may still know about - m_log.DebugFormat("[CompleteMovement] send old child kills"); - m_scene.SendKillObject(new List { LocalId }); - - //HACK part B - // keep using same localID - } // Prevent teleporting to an underground location From e77fafe12d622ba7ce251b1c686fc6fb5fd9579a Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 19 Aug 2014 02:15:01 +0100 Subject: [PATCH 36/50] *test* send attachments in sync, resend avatar at end --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 68115464ae..fe9b1bb54d 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1905,7 +1905,15 @@ namespace OpenSim.Region.Framework.Scenes // Resume scripts this possible should also be moved down after sending the avatar to viewer ? foreach (SceneObjectGroup sog in attachments) { - sog.ScheduleGroupForFullUpdate(); + // sog.ScheduleGroupForFullUpdate(); + m_scene.ForEachScenePresence(delegate(ScenePresence p) + { + if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200) + return; + sog.SendFullUpdateToClient(p.ControllingClient); + p.ControllingClient.SendAvatarDataImmediate(this); // resend our data -> test + }); + sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource()); sog.ResumeScripts(); } From 4c46ebdbf501733e1b9d7e23943da095c4f60bce Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 19 Aug 2014 03:47:26 +0100 Subject: [PATCH 37/50] fix a missed blocking of sending updates the the new attach points above hud indexes --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 6f41ac89af..8f69b3e57c 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -3828,8 +3828,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { SceneObjectPart e = (SceneObjectPart)entity; SceneObjectGroup g = e.ParentGroup; - if (g.RootPart.Shape.State > 30 && g.RootPart.Shape.State < 39) // HUD - if (g.OwnerID != AgentId) + if (g.HasPrivateAttachmentPoint && g.OwnerID != AgentId) return; // Don't send updates for other people's HUDs } From 505cbf9983ffd70d473299e517bf792f3f04d46d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 19 Aug 2014 03:58:16 +0100 Subject: [PATCH 38/50] still another ... --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 8f69b3e57c..608b7396ea 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -3946,8 +3946,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (part.ParentGroup.IsAttachment) { // Someone else's HUD, why are we getting these? - if (part.ParentGroup.OwnerID != AgentId && - part.ParentGroup.RootPart.Shape.State > 30 && part.ParentGroup.RootPart.Shape.State < 39) + if (part.ParentGroup.OwnerID != AgentId && part.ParentGroup.HasPrivateAttachmentPoint) continue; ScenePresence sp; // Owner is not in the sim, don't update it to From 9914e371af90da86c47fe1f57ecfd578cd8e1169 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 19 Aug 2014 04:54:25 +0100 Subject: [PATCH 39/50] minor changes to GetPriorityByBestAvatarResponsiveness code --- .../Region/Framework/Scenes/Prioritizer.cs | 35 ++++++++++--------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Prioritizer.cs b/OpenSim/Region/Framework/Scenes/Prioritizer.cs index ddae0735fc..36a3e37b14 100644 --- a/OpenSim/Region/Framework/Scenes/Prioritizer.cs +++ b/OpenSim/Region/Framework/Scenes/Prioritizer.cs @@ -157,30 +157,31 @@ namespace OpenSim.Region.Framework.Scenes private uint GetPriorityByBestAvatarResponsiveness(IClientAPI client, ISceneEntity entity) { - uint pqueue = ComputeDistancePriority(client,entity,false); + uint pqueue = 2; // keep compiler happy ScenePresence presence = m_scene.GetScenePresence(client.AgentId); if (presence != null) { - if (!presence.IsChildAgent) - { - // All avatars other than our own go into pqueue 1 - if (entity is ScenePresence) - return 1; - - if (entity is SceneObjectPart) - { - // Attachments are high priority, - if (((SceneObjectPart)entity).ParentGroup.IsAttachment) - return 1; + // All avatars other than our own go into pqueue 1 + if (entity is ScenePresence) + return 1; - // Non physical prims are lower priority than physical prims - PhysicsActor physActor = ((SceneObjectPart)entity).ParentGroup.RootPart.PhysActor; - if (physActor == null || !physActor.IsPhysical) - pqueue++; - } + if (entity is SceneObjectPart) + { + // Attachments are high priority, + if (((SceneObjectPart)entity).ParentGroup.IsAttachment) + return 1; + + pqueue = ComputeDistancePriority(client, entity, false); + + // Non physical prims are lower priority than physical prims + PhysicsActor physActor = ((SceneObjectPart)entity).ParentGroup.RootPart.PhysActor; + if (physActor == null || !physActor.IsPhysical) + pqueue++; } } + else + pqueue = ComputeDistancePriority(client, entity, false); return pqueue; } From 42a58101cf21a52d6a0cdb9068c102fac6fe6e63 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 19 Aug 2014 04:56:33 +0100 Subject: [PATCH 40/50] HACK force GetPriorityByBestAvatarResponsiveness ignoring configuration --- OpenSim/Region/Framework/Scenes/Prioritizer.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/OpenSim/Region/Framework/Scenes/Prioritizer.cs b/OpenSim/Region/Framework/Scenes/Prioritizer.cs index 36a3e37b14..19d268943a 100644 --- a/OpenSim/Region/Framework/Scenes/Prioritizer.cs +++ b/OpenSim/Region/Framework/Scenes/Prioritizer.cs @@ -91,6 +91,11 @@ namespace OpenSim.Region.Framework.Scenes return 0; uint priority; + + + // HACK + return GetPriorityByBestAvatarResponsiveness(client, entity); + switch (m_scene.UpdatePrioritizationScheme) { From 1c9af8727d73f64fdf50f6ec9a95dc4b9b77f0cd Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 19 Aug 2014 05:13:18 +0100 Subject: [PATCH 41/50] send the avatar data after sending attachments, by the same Entity updates path --- .../Region/Framework/Scenes/ScenePresence.cs | 50 ++++++++++++++++--- 1 file changed, 42 insertions(+), 8 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index fe9b1bb54d..f58d7f203d 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1908,10 +1908,12 @@ namespace OpenSim.Region.Framework.Scenes // sog.ScheduleGroupForFullUpdate(); m_scene.ForEachScenePresence(delegate(ScenePresence p) { + if (p != this && sog.HasPrivateAttachmentPoint) + return; if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200) return; sog.SendFullUpdateToClient(p.ControllingClient); - p.ControllingClient.SendAvatarDataImmediate(this); // resend our data -> test + SendFullUpdateToClient(p.ControllingClient); // resend our data by updates path }); sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource()); @@ -3377,6 +3379,16 @@ namespace OpenSim.Region.Framework.Scenes ControllingClient.SendAgentTerseUpdate(p); } + public void SendFullUpdateToClient(IClientAPI remoteClient) + { + if (remoteClient.IsActive) + { + //m_log.DebugFormat("[SCENE PRESENCE]: " + Name + " sending TerseUpdate to " + remoteClient.Name + " : Pos={0} Rot={1} Vel={2}", m_pos, Rotation, m_velocity); + remoteClient.SendEntityUpdate(this, PrimUpdateFlags.FullUpdate); + m_scene.StatsReporter.AddAgentUpdates(1); + } + } + /// /// Sends a location update to the client connected to this scenePresence /// via entity updates @@ -4672,18 +4684,40 @@ namespace OpenSim.Region.Framework.Scenes return validated; } - - public void SendAttachmentsToClient(IClientAPI client) + public void SendAttachmentsToAllAgents() { lock (m_attachments) { - foreach (SceneObjectGroup gobj in m_attachments) + foreach (SceneObjectGroup sog in m_attachments) { - gobj.SendFullUpdateToClient(client); + m_scene.ForEachScenePresence(delegate(ScenePresence p) + { + if (p != this && sog.HasPrivateAttachmentPoint) + return; + if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200) + return; + sog.SendFullUpdateToClient(p.ControllingClient); + SendFullUpdateToClient(p.ControllingClient); // resend our data by updates path + }); } } } + // send attachments to a client without filters except for huds + // for now they are checked in several places down the line... + public void SendAttachmentsToAgentNF(ScenePresence p) + { + lock (m_attachments) + { + foreach (SceneObjectGroup sog in m_attachments) + { + if (p == this || !sog.HasPrivateAttachmentPoint) + sog.SendFullUpdateToClient(p.ControllingClient); + } + SendFullUpdateToClient(p.ControllingClient); // resend our data by updates path + } + } + /// /// Send a script event to this scene presence's attachments /// @@ -5458,7 +5492,7 @@ namespace OpenSim.Region.Framework.Scenes m_log.Debug("[AVATAR]: viewMe: " + Lastname + " " + p.Lastname); ControllingClient.SendAvatarDataImmediate(p); p.SendAppearanceToAgent(this); - p.SendAttachmentsToClient(ControllingClient); + p.SendAttachmentsToAgentNF(this); if (p.Animator != null) p.Animator.SendAnimPackToClient(ControllingClient); @@ -5775,7 +5809,7 @@ namespace OpenSim.Region.Framework.Scenes p.ControllingClient.SendAvatarDataImmediate(this); // m_log.Debug("[AVATAR]: viewTo: " + Lastname + " " + p.Lastname); SendAppearanceToAgent(p); - SendAttachmentsToClient(p.ControllingClient); + SendAttachmentsToAgentNF(p); if (Animator != null) Animator.SendAnimPackToClient(p.ControllingClient); } @@ -5790,7 +5824,7 @@ namespace OpenSim.Region.Framework.Scenes // m_log.Debug("[AVATAR]: viewMe: " + Lastname + "<-" + p.Lastname); ControllingClient.SendAvatarDataImmediate(p); p.SendAppearanceToAgent(this); - p.SendAttachmentsToClient(ControllingClient); + p.SendAttachmentsToAgentNF(this); if (p.Animator != null) p.Animator.SendAnimPackToClient(ControllingClient); } From 65983cc4fcef4ebba0d288301b8db73ee0981992 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 19 Aug 2014 06:23:30 +0100 Subject: [PATCH 42/50] test --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index f58d7f203d..62084162ea 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1882,9 +1882,7 @@ namespace OpenSim.Region.Framework.Scenes ValidateAndSendAppearanceAndAgentData(); m_log.DebugFormat("[CompleteMovement] ValidateAndSendAppearanceAndAgentData: {0}ms", Util.EnvironmentTickCountSubtract(ts)); - - List attachments = GetAttachments(); - + // attachments if (isNPC || (TeleportFlags & TeleportFlags.ViaLogin) != 0) { @@ -1897,13 +1895,13 @@ namespace OpenSim.Region.Framework.Scenes } else { - if (attachments.Count > 0) + if (m_attachments.Count > 0) { m_log.DebugFormat( "[SCENE PRESENCE]: Restarting scripts in attachments for {0} in {1}", Name, Scene.Name); // Resume scripts this possible should also be moved down after sending the avatar to viewer ? - foreach (SceneObjectGroup sog in attachments) + foreach (SceneObjectGroup sog in m_attachments) { // sog.ScheduleGroupForFullUpdate(); m_scene.ForEachScenePresence(delegate(ScenePresence p) @@ -5809,9 +5807,9 @@ namespace OpenSim.Region.Framework.Scenes p.ControllingClient.SendAvatarDataImmediate(this); // m_log.Debug("[AVATAR]: viewTo: " + Lastname + " " + p.Lastname); SendAppearanceToAgent(p); - SendAttachmentsToAgentNF(p); if (Animator != null) Animator.SendAnimPackToClient(p.ControllingClient); + SendAttachmentsToAgentNF(p); } } @@ -5824,9 +5822,9 @@ namespace OpenSim.Region.Framework.Scenes // m_log.Debug("[AVATAR]: viewMe: " + Lastname + "<-" + p.Lastname); ControllingClient.SendAvatarDataImmediate(p); p.SendAppearanceToAgent(this); - p.SendAttachmentsToAgentNF(this); if (p.Animator != null) p.Animator.SendAnimPackToClient(ControllingClient); + p.SendAttachmentsToAgentNF(this); } } } From e883fb519b51642320526dad279e85c1e13646d9 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 19 Aug 2014 06:53:02 +0100 Subject: [PATCH 43/50] test --- .../Region/Framework/Scenes/ScenePresence.cs | 53 ++++++++++++++----- 1 file changed, 40 insertions(+), 13 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 62084162ea..e3e8871b86 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1912,6 +1912,7 @@ namespace OpenSim.Region.Framework.Scenes return; sog.SendFullUpdateToClient(p.ControllingClient); SendFullUpdateToClient(p.ControllingClient); // resend our data by updates path + SendTerseUpdateToAgent(p); }); sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource()); @@ -3370,11 +3371,16 @@ namespace OpenSim.Region.Framework.Scenes #region Update Client(s) - // this is diferente from SendTerseUpdateToClient - // this sends bypassing ententies updates - public void SendAgentTerseUpdate(ISceneEntity p) + public void SendUpdateToAgent(ScenePresence p) { - ControllingClient.SendAgentTerseUpdate(p); + IClientAPI remoteClient = p.ControllingClient; + + if (remoteClient.IsActive) + { + //m_log.DebugFormat("[SCENE PRESENCE]: " + Name + " sending TerseUpdate to " + remoteClient.Name + " : Pos={0} Rot={1} Vel={2}", m_pos, Rotation, m_velocity); + remoteClient.SendEntityUpdate(this, PrimUpdateFlags.FullUpdate); + m_scene.StatsReporter.AddAgentUpdates(1); + } } public void SendFullUpdateToClient(IClientAPI remoteClient) @@ -3387,6 +3393,13 @@ namespace OpenSim.Region.Framework.Scenes } } + // this is diferente from SendTerseUpdateToClient + // this sends bypassing entities updates + public void SendAgentTerseUpdate(ISceneEntity p) + { + ControllingClient.SendAgentTerseUpdate(p); + } + /// /// Sends a location update to the client connected to this scenePresence /// via entity updates @@ -3408,7 +3421,7 @@ namespace OpenSim.Region.Framework.Scenes } } - public void SendTerseUpdateToAgentClient(ScenePresence p) + public void SendTerseUpdateToAgent(ScenePresence p) { IClientAPI remoteClient = p.ControllingClient; @@ -3427,6 +3440,18 @@ namespace OpenSim.Region.Framework.Scenes m_scene.StatsReporter.AddAgentUpdates(1); } + public void SendTerseUpdateToAgentNF(ScenePresence p) + { + IClientAPI remoteClient = p.ControllingClient; + if (remoteClient.IsActive) + { + //m_log.DebugFormat("[SCENE PRESENCE]: " + Name + " sending TerseUpdate to " + remoteClient.Name + " : Pos={0} Rot={1} Vel={2}", m_pos, Rotation, m_velocity); + remoteClient.SendEntityUpdate(this, PrimUpdateFlags.FullUpdate); + m_scene.StatsReporter.AddAgentUpdates(1); + } + } + + // vars to support reduced update frequency when velocity is unchanged private Vector3 lastVelocitySentToAllClients = Vector3.Zero; private Vector3 lastPositionSentToAllClients = Vector3.Zero; @@ -3468,7 +3493,7 @@ namespace OpenSim.Region.Framework.Scenes // Console.WriteLine("Scheduled update for {0} in {1}", Name, Scene.Name); // m_scene.ForEachClient(SendTerseUpdateToClient); - m_scene.ForEachScenePresence(SendTerseUpdateToAgentClient); + m_scene.ForEachScenePresence(SendTerseUpdateToAgent); } TriggerScenePresenceUpdated(); } @@ -5487,13 +5512,13 @@ namespace OpenSim.Region.Framework.Scenes { if (p.IsChildAgent) continue; - m_log.Debug("[AVATAR]: viewMe: " + Lastname + " " + p.Lastname); - ControllingClient.SendAvatarDataImmediate(p); + + p.SendUpdateToAgent(this); + p.SendAgentTerseUpdate(this); p.SendAppearanceToAgent(this); - p.SendAttachmentsToAgentNF(this); if (p.Animator != null) p.Animator.SendAnimPackToClient(ControllingClient); - + p.SendAttachmentsToAgentNF(this); } } } @@ -5804,8 +5829,8 @@ namespace OpenSim.Region.Framework.Scenes { foreach (ScenePresence p in viewsToSendto) { - p.ControllingClient.SendAvatarDataImmediate(this); -// m_log.Debug("[AVATAR]: viewTo: " + Lastname + " " + p.Lastname); + SendUpdateToAgent(p); + SendAgentTerseUpdate(p); SendAppearanceToAgent(p); if (Animator != null) Animator.SendAnimPackToClient(p.ControllingClient); @@ -5820,7 +5845,9 @@ namespace OpenSim.Region.Framework.Scenes if (p.IsChildAgent) continue; // m_log.Debug("[AVATAR]: viewMe: " + Lastname + "<-" + p.Lastname); - ControllingClient.SendAvatarDataImmediate(p); + + p.SendUpdateToAgent(this); + p.SendAgentTerseUpdate(this); p.SendAppearanceToAgent(this); if (p.Animator != null) p.Animator.SendAnimPackToClient(ControllingClient); From 8f0d35e59a77ec44c7ee55296a02882b424b469f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 19 Aug 2014 09:04:20 +0100 Subject: [PATCH 44/50] fix the encoding of rotation in updates, not just using the next field to override w bytes. ( specially having it commented ) --- .../ClientStack/Linden/UDP/LLClientView.cs | 27 +++++++++---------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 608b7396ea..6eb0c5e7ec 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -5291,16 +5291,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP byte[] objectData = new byte[76]; + Vector3 velocity = data.Velocity; + Vector3 acceleration = new Vector3(0, 0, 0); + rotation.Normalize(); + Vector3 vrot = new Vector3(rotation.X, rotation.Y, rotation.Z); + data.CollisionPlane.ToBytes(objectData, 0); offsetPosition.ToBytes(objectData, 16); - Vector3 velocity = new Vector3(0, 0, 0); - Vector3 acceleration = new Vector3(0, 0, 0); velocity.ToBytes(objectData, 28); acceleration.ToBytes(objectData, 40); -// data.Velocity.ToBytes(objectData, 28); -// data.Acceleration.ToBytes(objectData, 40); - rotation.ToBytes(objectData, 52); - //data.AngularVelocity.ToBytes(objectData, 64); + vrot.ToBytes(objectData, 52); + data.AngularVelocity.ToBytes(objectData, 64); ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock(); @@ -5356,15 +5357,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP data.RelativePosition.ToBytes(objectData, 0); data.Velocity.ToBytes(objectData, 12); data.Acceleration.ToBytes(objectData, 24); - try - { - data.RotationOffset.ToBytes(objectData, 36); - } - catch (Exception e) - { - m_log.Warn("[LLClientView]: exception converting quaternion to bytes, using Quaternion.Identity. Exception: " + e.ToString()); - OpenMetaverse.Quaternion.Identity.ToBytes(objectData, 36); - } + + Quaternion rotation = data.RotationOffset; + rotation.Normalize(); + Vector3 vrot = new Vector3(rotation.X, rotation.Y, rotation.Z); + vrot.ToBytes(objectData, 36); data.AngularVelocity.ToBytes(objectData, 48); ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock(); From b0253362c7f93543b50943f71485a3b3d9bcf2f2 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 19 Aug 2014 09:18:29 +0100 Subject: [PATCH 45/50] remove the silly sendTerseUpdates. I was fooled by wingridproxy not decoding updates correctly --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index e3e8871b86..4f768bb5ca 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -5514,7 +5514,6 @@ namespace OpenSim.Region.Framework.Scenes continue; p.SendUpdateToAgent(this); - p.SendAgentTerseUpdate(this); p.SendAppearanceToAgent(this); if (p.Animator != null) p.Animator.SendAnimPackToClient(ControllingClient); @@ -5830,7 +5829,6 @@ namespace OpenSim.Region.Framework.Scenes foreach (ScenePresence p in viewsToSendto) { SendUpdateToAgent(p); - SendAgentTerseUpdate(p); SendAppearanceToAgent(p); if (Animator != null) Animator.SendAnimPackToClient(p.ControllingClient); @@ -5847,7 +5845,6 @@ namespace OpenSim.Region.Framework.Scenes // m_log.Debug("[AVATAR]: viewMe: " + Lastname + "<-" + p.Lastname); p.SendUpdateToAgent(this); - p.SendAgentTerseUpdate(this); p.SendAppearanceToAgent(this); if (p.Animator != null) p.Animator.SendAnimPackToClient(ControllingClient); From ca43a7fe63f8c2582c59419ce29687609e5e4257 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 19 Aug 2014 09:42:45 +0100 Subject: [PATCH 46/50] variationsss... --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 4f768bb5ca..8c3f5162f3 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1912,7 +1912,6 @@ namespace OpenSim.Region.Framework.Scenes return; sog.SendFullUpdateToClient(p.ControllingClient); SendFullUpdateToClient(p.ControllingClient); // resend our data by updates path - SendTerseUpdateToAgent(p); }); sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource()); @@ -3657,6 +3656,11 @@ namespace OpenSim.Region.Framework.Scenes avatar.ControllingClient.SendAvatarDataImmediate(this); } + public void SendAvatarDataToAgentNF(ScenePresence avatar) + { + avatar.ControllingClient.SendAvatarDataImmediate(this); + } + /// /// Send this agent's appearance to all other root and child agents in the scene /// This agent must be root. @@ -5513,7 +5517,7 @@ namespace OpenSim.Region.Framework.Scenes if (p.IsChildAgent) continue; - p.SendUpdateToAgent(this); + p.SendAvatarDataToAgentNF(this); p.SendAppearanceToAgent(this); if (p.Animator != null) p.Animator.SendAnimPackToClient(ControllingClient); @@ -5828,7 +5832,7 @@ namespace OpenSim.Region.Framework.Scenes { foreach (ScenePresence p in viewsToSendto) { - SendUpdateToAgent(p); + SendAvatarDataToAgentNF(p); SendAppearanceToAgent(p); if (Animator != null) Animator.SendAnimPackToClient(p.ControllingClient); @@ -5844,7 +5848,7 @@ namespace OpenSim.Region.Framework.Scenes continue; // m_log.Debug("[AVATAR]: viewMe: " + Lastname + "<-" + p.Lastname); - p.SendUpdateToAgent(this); + p.SendAvatarDataToAgentNF(this); p.SendAppearanceToAgent(this); if (p.Animator != null) p.Animator.SendAnimPackToClient(ControllingClient); From 919aef157385c694b598439e3a50a2fe7a4f9e98 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 19 Aug 2014 10:03:04 +0100 Subject: [PATCH 47/50] send zero velocity again on avatar full update or its ugly --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 6eb0c5e7ec..b0cb4ea7a8 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -5291,7 +5291,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP byte[] objectData = new byte[76]; - Vector3 velocity = data.Velocity; + Vector3 velocity = new Vector3(0, 0, 0); Vector3 acceleration = new Vector3(0, 0, 0); rotation.Normalize(); Vector3 vrot = new Vector3(rotation.X, rotation.Y, rotation.Z); From cca2ae3c896fd61cb66d31cc59ace2b1361cdcd5 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 19 Aug 2014 19:47:41 +0100 Subject: [PATCH 48/50] test --- .../Region/Framework/Scenes/ScenePresence.cs | 150 +++++++++++++++++- 1 file changed, 148 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 8c3f5162f3..ad70ce3b83 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -4745,6 +4745,152 @@ namespace OpenSim.Region.Framework.Scenes } } + public void SendAttachmentsToAgentNFPK(ScenePresence p) + { + lock (m_attachments) + { + List pk = new List(); + foreach (SceneObjectGroup sog in m_attachments) + { + foreach (SceneObjectPart part in sog.Parts) + pk.Add(part.LocalId); + } + + p.ControllingClient.SendKillObject(pk); + + foreach (SceneObjectGroup sog in m_attachments) + { + if (p == this || !sog.HasPrivateAttachmentPoint) + sog.SendFullUpdateToClient(p.ControllingClient); + } + SendFullUpdateToClient(p.ControllingClient); // resend our data by updates path + } + } + + + public void SendAttachmentScheduleUpdate(SceneObjectGroup sog) + { + if (IsChildAgent) + return; + + m_scene.ForEachScenePresence(delegate(ScenePresence p) + { + if (p != this && sog.HasPrivateAttachmentPoint) + return; + if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200) + return; + + SceneObjectPart[] parts = sog.Parts; + + for (int i = 0; i < parts.Length; i++) + { + SceneObjectPart part = parts[i]; + if (part.UpdateFlag == UpdateRequired.TERSE) + { + p.ControllingClient.SendEntityUpdate(part, + PrimUpdateFlags.Position | PrimUpdateFlags.Rotation | PrimUpdateFlags.Velocity + | PrimUpdateFlags.Acceleration | PrimUpdateFlags.AngularVelocity); + part.UpdateFlag = 0; + } + else if (part.UpdateFlag == UpdateRequired.FULL) + { + p.ControllingClient.SendEntityUpdate(part, PrimUpdateFlags.FullUpdate); + part.UpdateFlag = 0; + } + } + }); + } + + public void SendAttachmentScheduleUpdate(SceneObjectPart part) + { + if (IsChildAgent) + return; + + m_scene.ForEachScenePresence(delegate(ScenePresence p) + { + if (p != this && part.ParentGroup.HasPrivateAttachmentPoint) + return; + + if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200) + return; + + if (part.UpdateFlag == UpdateRequired.TERSE) + { + p.ControllingClient.SendEntityUpdate(part, + PrimUpdateFlags.Position | PrimUpdateFlags.Rotation | PrimUpdateFlags.Velocity + | PrimUpdateFlags.Acceleration | PrimUpdateFlags.AngularVelocity); + part.UpdateFlag = 0; + } + else if (part.UpdateFlag == UpdateRequired.FULL) + { + p.ControllingClient.SendEntityUpdate(part, PrimUpdateFlags.FullUpdate); + part.UpdateFlag = 0; + } + }); + } + + public void SendAttachmentUpdate(SceneObjectGroup sog, UpdateRequired UpdateFlag) + { + if (IsChildAgent) + return; + + m_scene.ForEachScenePresence(delegate(ScenePresence p) + { + if (p != this && sog.HasPrivateAttachmentPoint) + return; + + if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200) + return; + + SceneObjectPart[] parts = sog.Parts; + + for (int i = 0; i < parts.Length; i++) + { + SceneObjectPart part = parts[i]; + if (UpdateFlag == UpdateRequired.TERSE) + { + p.ControllingClient.SendEntityUpdate(part, + PrimUpdateFlags.Position | PrimUpdateFlags.Rotation | PrimUpdateFlags.Velocity + | PrimUpdateFlags.Acceleration | PrimUpdateFlags.AngularVelocity); + part.UpdateFlag = 0; + } + else if (UpdateFlag == UpdateRequired.FULL) + { + p.ControllingClient.SendEntityUpdate(part, PrimUpdateFlags.FullUpdate); + part.UpdateFlag = 0; + } + } + }); + } + + public void SendAttachmentUpdate(SceneObjectPart part, UpdateRequired UpdateFlag) + { + if (IsChildAgent) + return; + + m_scene.ForEachScenePresence(delegate(ScenePresence p) + { + if (p != this && part.ParentGroup.HasPrivateAttachmentPoint) + return; + + if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200) + return; + + if (UpdateFlag == UpdateRequired.TERSE) + { + p.ControllingClient.SendEntityUpdate(part, + PrimUpdateFlags.Position | PrimUpdateFlags.Rotation | PrimUpdateFlags.Velocity + | PrimUpdateFlags.Acceleration | PrimUpdateFlags.AngularVelocity); + part.UpdateFlag = 0; + } + else if (UpdateFlag == UpdateRequired.FULL) + { + p.ControllingClient.SendEntityUpdate(part, PrimUpdateFlags.FullUpdate); + part.UpdateFlag = 0; + } + }); + } + /// /// Send a script event to this scene presence's attachments /// @@ -5521,7 +5667,7 @@ namespace OpenSim.Region.Framework.Scenes p.SendAppearanceToAgent(this); if (p.Animator != null) p.Animator.SendAnimPackToClient(ControllingClient); - p.SendAttachmentsToAgentNF(this); + p.SendAttachmentsToAgentNFPK(this); } } } @@ -5852,7 +5998,7 @@ namespace OpenSim.Region.Framework.Scenes p.SendAppearanceToAgent(this); if (p.Animator != null) p.Animator.SendAnimPackToClient(ControllingClient); - p.SendAttachmentsToAgentNF(this); + p.SendAttachmentsToAgentNFPK(this); } } } From 6aa60a5d970ef88cce639c92184e0590c2f25903 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 19 Aug 2014 19:56:43 +0100 Subject: [PATCH 49/50] test .... --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index ad70ce3b83..a1d40fdabb 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -5982,7 +5982,7 @@ namespace OpenSim.Region.Framework.Scenes SendAppearanceToAgent(p); if (Animator != null) Animator.SendAnimPackToClient(p.ControllingClient); - SendAttachmentsToAgentNF(p); + SendAttachmentsToAgentNFPK(p); } } From d16f7df673def43dfe922689a8c301ffe034ecaa Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 19 Aug 2014 20:33:26 +0100 Subject: [PATCH 50/50] also send attachment pre-kills on crossings --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index a1d40fdabb..a0c3ba985c 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1900,22 +1900,35 @@ namespace OpenSim.Region.Framework.Scenes m_log.DebugFormat( "[SCENE PRESENCE]: Restarting scripts in attachments for {0} in {1}", Name, Scene.Name); + List kk = new List(); + // Resume scripts this possible should also be moved down after sending the avatar to viewer ? foreach (SceneObjectGroup sog in m_attachments) { + foreach (SceneObjectPart part in sog.Parts) + kk.Add(part.LocalId); + + sog.SendFullUpdateToClient(ControllingClient); + SendFullUpdateToClient(ControllingClient); + // sog.ScheduleGroupForFullUpdate(); m_scene.ForEachScenePresence(delegate(ScenePresence p) { - if (p != this && sog.HasPrivateAttachmentPoint) + if (p == this) + return; + if (sog.HasPrivateAttachmentPoint) return; if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200) return; + + p.ControllingClient.SendKillObject(kk); sog.SendFullUpdateToClient(p.ControllingClient); SendFullUpdateToClient(p.ControllingClient); // resend our data by updates path }); sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource()); sog.ResumeScripts(); + kk.Clear(); } } }