From c24601bc6a9be5ab84a8c7b4600382ef9f0c895e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 25 Aug 2014 21:49:39 +0100 Subject: [PATCH 1/9] change enconding of attachment updates NameValue and State fields --- .../ClientStack/Linden/UDP/LLClientView.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index e19877c690..b45d561038 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -5393,6 +5393,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP //update.JointType = 0; update.Material = data.Material; update.MediaURL = Utils.EmptyBytes; // FIXME: Support this in OpenSim +/* if (data.ParentGroup.IsAttachment) { update.NameValue = Util.StringToBytes256("AttachItemID STRING RW SV " + data.ParentGroup.FromItemID); @@ -5406,6 +5407,24 @@ namespace OpenSim.Region.ClientStack.LindenUDP // case for attachments may contain conflicting values that can end up crashing the viewer. update.State = data.ParentGroup.RootPart.Shape.State; } + */ + + if (data.ParentGroup.IsAttachment) + { + if (data.UUID != data.ParentGroup.RootPart.UUID) + { + update.NameValue = Util.StringToBytes256("AttachItemID STRING RW SV " + data.ParentGroup.FromItemID); + } + else + update.NameValue = Utils.EmptyBytes; + + int st = (int)data.ParentGroup.RootPart.Shape.State; + st = (st & 0xf0) >> 4 + (st & 0x0f) << 4; + update.State = (byte)st; + } +// else +// update.State = data.Shape.State; // not sure about this + // m_log.DebugFormat( // "[LLCLIENTVIEW]: Sending state {0} for {1} {2} to {3}", From 75cbe620c025dba998d8291277e499ecb27a250c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 25 Aug 2014 22:45:31 +0100 Subject: [PATCH 2/9] *test* cleanup the bugs nest --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index b45d561038..06639835d7 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -5411,19 +5411,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (data.ParentGroup.IsAttachment) { - if (data.UUID != data.ParentGroup.RootPart.UUID) + if (data.UUID == data.ParentGroup.RootPart.UUID) { update.NameValue = Util.StringToBytes256("AttachItemID STRING RW SV " + data.ParentGroup.FromItemID); } else update.NameValue = Utils.EmptyBytes; - int st = (int)data.ParentGroup.RootPart.Shape.State; - st = (st & 0xf0) >> 4 + (st & 0x0f) << 4; - update.State = (byte)st; + int st = (int)data.ParentGroup.AttachmentPoint; + update.State = (byte)(((st & 0xf0) >> 4) + ((st & 0x0f) << 4)); ; + } + else + { + update.NameValue = Utils.EmptyBytes; + update.State = data.Shape.State; // not sure about this } -// else -// update.State = data.Shape.State; // not sure about this // m_log.DebugFormat( From 6857afe2a4ca73da904b9928c282c0087ff4b3bf Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 25 Aug 2014 23:31:04 +0100 Subject: [PATCH 3/9] *test* back to no sog kills, little retouch on attachment updates, NameValue AttachItemID is a root part thing only --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 2 +- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 06639835d7..7087bb79e7 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -5411,7 +5411,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (data.ParentGroup.IsAttachment) { - if (data.UUID == data.ParentGroup.RootPart.UUID) + if (data.IsRoot) { update.NameValue = Util.StringToBytes256("AttachItemID STRING RW SV " + data.ParentGroup.FromItemID); } diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 4fa95fddba..58d3ef6f6c 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -5982,10 +5982,10 @@ namespace OpenSim.Region.Framework.Scenes public void SendKillTo(ScenePresence p) { List ids = new List(m_attachments.Count + 1); - foreach (SceneObjectGroup sog in m_attachments) - { - ids.Add(sog.RootPart.LocalId); - } +// foreach (SceneObjectGroup sog in m_attachments) +// { +// ids.Add(sog.RootPart.LocalId); +// } ids.Add(LocalId); p.ControllingClient.SendKillObject(ids); From 3ee6144d0ca1d35d6660b006b89fc883e1a2bfda Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 26 Aug 2014 00:00:21 +0100 Subject: [PATCH 4/9] even less kills on tps --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 58d3ef6f6c..9fe3a9e212 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -5966,7 +5966,7 @@ namespace OpenSim.Region.Framework.Scenes public void HasMovedAway() { List allpresences = m_scene.GetScenePresences(); - foreach (ScenePresence p in allpresences) + /* foreach (ScenePresence p in allpresences) { if (p == this) continue; @@ -5974,6 +5974,7 @@ namespace OpenSim.Region.Framework.Scenes if (!p.IsChildAgent) p.SendKillTo(this); } + */ if (Scene.AttachmentsModule != null) Scene.AttachmentsModule.DeleteAttachmentsFromScene(this, true); } From dde2ac254497053bb7ec8e5f1757ddf13e5ea033 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 26 Aug 2014 02:22:25 +0100 Subject: [PATCH 5/9] still testing --- .../Region/Framework/Scenes/ScenePresence.cs | 60 +++++++++---------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 9fe3a9e212..2b1b342933 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1887,30 +1887,27 @@ namespace OpenSim.Region.Framework.Scenes 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 m_attachments) + foreach(SceneObjectGroup sog in m_attachments) { - SendFullUpdateToClient(ControllingClient); - SendAttachmentFullUpdateToAgentNF(sog, this); - - if (!sog.HasPrivateAttachmentPoint) - { - // sog.ScheduleGroupForFullUpdate(); - foreach(ScenePresence p in allpresences) - { - if (p == this) - continue; - - if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200) - continue; - - SendFullUpdateToClient(p.ControllingClient); // resend our data by updates path - SendAttachmentFullUpdateToAgentNF(sog, p); - }; - } sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource()); sog.ResumeScripts(); } + + foreach (ScenePresence p in allpresences) + { + if (p == this) + { + SendTerseUpdateToAgentNF(this); + SendAttachmentsToAgentNF(this); + continue; + } + + if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200) + continue; + + SendTerseUpdateToAgentNF(p); + SendAttachmentsToAgentNF(p); + } } } @@ -3428,7 +3425,9 @@ namespace OpenSim.Region.Framework.Scenes 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); + remoteClient.SendEntityUpdate(this, + PrimUpdateFlags.Position | PrimUpdateFlags.Rotation | PrimUpdateFlags.Velocity + | PrimUpdateFlags.Acceleration | PrimUpdateFlags.AngularVelocity); m_scene.StatsReporter.AddAgentUpdates(1); } } @@ -4761,8 +4760,8 @@ namespace OpenSim.Region.Framework.Scenes if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200) return; + SendTerseUpdateToAgentNF(p); SendAttachmentFullUpdateToAgentNF(sog, p); - SendFullUpdateToClient(p.ControllingClient); // resend our data by updates path }); } } @@ -4772,13 +4771,13 @@ namespace OpenSim.Region.Framework.Scenes // for now they are checked in several places down the line... public void SendAttachmentsToAgentNF(ScenePresence p) { + SendTerseUpdateToAgentNF(p); lock (m_attachments) { foreach (SceneObjectGroup sog in m_attachments) { SendAttachmentFullUpdateToAgentNF(sog, p); - } - SendFullUpdateToClient(p.ControllingClient); // resend our data by updates path + } } } @@ -5966,7 +5965,7 @@ namespace OpenSim.Region.Framework.Scenes public void HasMovedAway() { List allpresences = m_scene.GetScenePresences(); - /* foreach (ScenePresence p in allpresences) + foreach (ScenePresence p in allpresences) { if (p == this) continue; @@ -5974,19 +5973,20 @@ namespace OpenSim.Region.Framework.Scenes if (!p.IsChildAgent) p.SendKillTo(this); } - */ + if (Scene.AttachmentsModule != null) Scene.AttachmentsModule.DeleteAttachmentsFromScene(this, true); } + // kill with attachs root kills public void SendKillTo(ScenePresence p) { List ids = new List(m_attachments.Count + 1); -// foreach (SceneObjectGroup sog in m_attachments) -// { -// ids.Add(sog.RootPart.LocalId); -// } + foreach (SceneObjectGroup sog in m_attachments) + { + ids.Add(sog.RootPart.LocalId); + } ids.Add(LocalId); p.ControllingClient.SendKillObject(ids); From 92b0b27caff9f73f619e1df32a430706b53f6782 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 26 Aug 2014 17:42:44 +0100 Subject: [PATCH 6/9] dont append acks to a resend packet --- 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 3b0312da3b..dea9d7fe2c 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -1245,7 +1245,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP int dataLength = buffer.DataLength; // NOTE: I'm seeing problems with some viewers when ACKs are appended to zerocoded packets so I've disabled that here - if (!isZerocoded) + if (!isZerocoded && !isResend) { // Keep appending ACKs until there is no room left in the buffer or there are // no more ACKs to append From 620443f85840aab0f2ddc4a88656a166cc148b69 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 27 Aug 2014 00:37:05 +0100 Subject: [PATCH 7/9] on TPs to nearby regions, only send kills if needed by parcel privacy --- .../EntityTransfer/EntityTransferModule.cs | 12 ++++-- .../Region/Framework/Scenes/ScenePresence.cs | 40 ++++++++++++++----- 2 files changed, 38 insertions(+), 14 deletions(-) diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 37aae0893a..b3e556f7f2 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -986,7 +986,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer // Well, this is it. The agent is over there. // KillEntity(sp.Scene, sp.LocalId); - sp.HasMovedAway(); + bool nearRegion = sp.KnownRegions.ContainsKey(destinationHandle); + sp.HasMovedAway(nearRegion); // Now let's make it officially a child agent sp.MakeChildAgent(); @@ -1141,7 +1142,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.CleaningUp); - sp.HasMovedAway(); + bool nearRegion = sp.KnownRegions.ContainsKey(destinationHandle); + sp.HasMovedAway(nearRegion); // Need to signal neighbours whether child agents may need closing irrespective of whether this // one needed closing. We also need to close child agents as quickly as possible to avoid complicated @@ -1784,9 +1786,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.CleaningUp); // this may need the attachments - agent.parcelRegionCross(); - AgentHasMovedAway(agent, true); + agent.HasMovedAway(true); +// agent.parcelRegionCross(); + +// AgentHasMovedAway(agent, true); agent.MakeChildAgent(); diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 2b1b342933..d7656e8bfa 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -5962,18 +5962,38 @@ namespace OpenSim.Region.Framework.Scenes } } - public void HasMovedAway() + public void HasMovedAway(bool nearRegion) { - List allpresences = m_scene.GetScenePresences(); - foreach (ScenePresence p in allpresences) - { - if (p == this) - continue; - SendKillTo(p); - if (!p.IsChildAgent) - p.SendKillTo(this); - } + if (nearRegion) + { + if (!ParcelHideThisAvatar || GodLevel >= 200) + return; + + List allpresences = m_scene.GetScenePresences(); + foreach (ScenePresence p in allpresences) + { + if (p.IsDeleted || p == this || p.IsChildAgent || p.ControllingClient == null || !p.ControllingClient.IsActive) + continue; + + if (p.currentParcelUUID == m_currentParcelUUID) + { + p.SendKillTo(this); + } + } + } + else + { + List allpresences = m_scene.GetScenePresences(); + foreach (ScenePresence p in allpresences) + { + if (p == this) + continue; + SendKillTo(p); + if (!p.IsChildAgent) + p.SendKillTo(this); + } + } if (Scene.AttachmentsModule != null) Scene.AttachmentsModule.DeleteAttachmentsFromScene(this, true); } From 07ee101a057c9b5dee27c4248ce15dd8bfaae380 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 27 Aug 2014 01:09:11 +0100 Subject: [PATCH 8/9] bug fix. Was not deleting attachments if on public parcel --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index d7656e8bfa..58682514d7 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -5967,6 +5967,9 @@ namespace OpenSim.Region.Framework.Scenes if (nearRegion) { + if (Scene.AttachmentsModule != null) + Scene.AttachmentsModule.DeleteAttachmentsFromScene(this, true); + if (!ParcelHideThisAvatar || GodLevel >= 200) return; @@ -5993,9 +5996,10 @@ namespace OpenSim.Region.Framework.Scenes if (!p.IsChildAgent) p.SendKillTo(this); } + + if (Scene.AttachmentsModule != null) + Scene.AttachmentsModule.DeleteAttachmentsFromScene(this, true); } - if (Scene.AttachmentsModule != null) - Scene.AttachmentsModule.DeleteAttachmentsFromScene(this, true); } From 1e888d61caf80c3ac5748fb3550dd8137818f4cd Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 27 Aug 2014 01:33:09 +0100 Subject: [PATCH 9/9] enqueue also if m_nextPackets[category] is not null. This is really the top element of a category queue, equivalente to using a queue.peek() if avaiable --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index fe31bd9b79..8852715037 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs @@ -364,6 +364,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP int texture = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; int asset = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); + int total = resend + land + wind + cloud + task + texture + asset; + total /= 128; + // Make sure none of the throttles are set below our packet MTU, // otherwise a throttle could become permanently clogged resend = Math.Max(resend, LLUDPServer.MTU); @@ -379,8 +382,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP // the task queue (e.g. object updates) task = task + (int)(m_cannibalrate * texture); texture = (int)((1 - m_cannibalrate) * texture); - - //int total = resend + land + wind + cloud + task + texture + asset; + + total = resend + land + wind + cloud + task + texture + asset; + total /= 128; //m_log.DebugFormat("[LLUDPCLIENT]: {0} is setting throttles. Resend={1}, Land={2}, Wind={3}, Cloud={4}, Task={5}, Texture={6}, Asset={7}, Total={8}", // AgentID, resend, land, wind, cloud, task, texture, asset, total); @@ -484,7 +488,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Don't send this packet if there is already a packet waiting in the queue // even if we have the tokens to send it, tokens should go to the already // queued packets - if (queue.Count > 0) + if (queue.Count > 0 || m_nextPackets[category] != null) { queue.Enqueue(packet, highPriority); return true; @@ -528,7 +532,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// True if any packets were sent, otherwise false public bool DequeueOutgoing() { - if (m_deliverPackets == false) return false; +// if (m_deliverPackets == false) return false; OutgoingPacket packet = null; DoubleLocklessQueue queue;