From 6bac16fd884a51a7874348928d45c883f9d5968f Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 15 May 2011 14:55:36 +0200 Subject: Fix up handling of the estate dialog to prevent duplication of ban list names. Allow more than 61 names in ban list without crashing the viewer. --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 57 ++++++++++++---------- 1 file changed, 32 insertions(+), 25 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 7564907..05e6d27 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -4372,37 +4372,44 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (bl[i].BannedUserID == UUID.Zero) continue; BannedUsers.Add(bl[i].BannedUserID); - } - EstateOwnerMessagePacket packet = new EstateOwnerMessagePacket(); - packet.AgentData.TransactionID = UUID.Random(); - packet.AgentData.AgentID = AgentId; - packet.AgentData.SessionID = SessionId; - packet.MethodData.Invoice = invoice; - packet.MethodData.Method = Utils.StringToBytes("setaccess"); + if (BannedUsers.Count >= 50 || (i == (bl.Length - 1) && BannedUsers.Count > 0)) + { + EstateOwnerMessagePacket packet = new EstateOwnerMessagePacket(); + packet.AgentData.TransactionID = UUID.Random(); + packet.AgentData.AgentID = AgentId; + packet.AgentData.SessionID = SessionId; + packet.MethodData.Invoice = invoice; + packet.MethodData.Method = Utils.StringToBytes("setaccess"); - EstateOwnerMessagePacket.ParamListBlock[] returnblock = new EstateOwnerMessagePacket.ParamListBlock[6 + BannedUsers.Count]; + EstateOwnerMessagePacket.ParamListBlock[] returnblock = new EstateOwnerMessagePacket.ParamListBlock[6 + BannedUsers.Count]; - for (int i = 0; i < (6 + BannedUsers.Count); i++) - { - returnblock[i] = new EstateOwnerMessagePacket.ParamListBlock(); - } - int j = 0; + int j; + for (j = 0; j < (6 + BannedUsers.Count); j++) + { + returnblock[j] = new EstateOwnerMessagePacket.ParamListBlock(); + } + j = 0; - returnblock[j].Parameter = Utils.StringToBytes(estateID.ToString()); j++; - returnblock[j].Parameter = Utils.StringToBytes(((int)Constants.EstateAccessCodex.EstateBans).ToString()); j++; - returnblock[j].Parameter = Utils.StringToBytes("0"); j++; - returnblock[j].Parameter = Utils.StringToBytes("0"); j++; - returnblock[j].Parameter = Utils.StringToBytes(BannedUsers.Count.ToString()); j++; - returnblock[j].Parameter = Utils.StringToBytes("0"); j++; + returnblock[j].Parameter = Utils.StringToBytes(estateID.ToString()); j++; + returnblock[j].Parameter = Utils.StringToBytes(((int)Constants.EstateAccessCodex.EstateBans).ToString()); j++; + returnblock[j].Parameter = Utils.StringToBytes("0"); j++; + returnblock[j].Parameter = Utils.StringToBytes("0"); j++; + returnblock[j].Parameter = Utils.StringToBytes(BannedUsers.Count.ToString()); j++; + returnblock[j].Parameter = Utils.StringToBytes("0"); j++; - foreach (UUID banned in BannedUsers) - { - returnblock[j].Parameter = banned.GetBytes(); j++; + foreach (UUID banned in BannedUsers) + { + returnblock[j].Parameter = banned.GetBytes(); j++; + } + packet.ParamList = returnblock; + packet.Header.Reliable = true; + OutPacket(packet, ThrottleOutPacketType.Task); + + BannedUsers.Clear(); + } } - packet.ParamList = returnblock; - packet.Header.Reliable = false; - OutPacket(packet, ThrottleOutPacketType.Task); + } public void SendRegionInfoToEstateMenu(RegionInfoForEstateMenuArgs args) -- cgit v1.1 From 06d5989f4d44de2dfedbb3858f706940a56361ed Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 6 Jul 2011 09:59:05 +0200 Subject: Fix parcel prim count and max reporting. Viewer already multiplies. --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 6048518..ecf10e4 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -4589,7 +4589,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (landData.SimwideArea > 0) { - int simulatorCapacity = (int)(((float)landData.SimwideArea / 65536.0f) * (float)m_scene.RegionInfo.ObjectCapacity * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus); + int simulatorCapacity = (int)((double)(landData.SimwideArea * m_scene.RegionInfo.ObjectCapacity) * m_scene.RegionInfo.RegionSettings.ObjectBonus) / 65536; + // Never report more than sim total capacity + if (simulatorCapacity > m_scene.RegionInfo.ObjectCapacity) + simulatorCapacity = m_scene.RegionInfo.ObjectCapacity; updateMessage.SimWideMaxPrims = simulatorCapacity; } else -- cgit v1.1 From 96174595da269f50d37c88c213ad00b79a7c7c83 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 23 Jul 2011 11:39:32 +0100 Subject: Fix LLTextBox to work with the updated libOMV --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 99552f1..d5419cc 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -12129,7 +12129,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP OutPacket(packet, ThrottleOutPacketType.Task); } - public void SendTextBoxRequest(string message, int chatChannel, string objectname, string ownerFirstName, string ownerLastName, UUID objectId) + public void SendTextBoxRequest(string message, int chatChannel, string objectname, UUID ownerID, string ownerFirstName, string ownerLastName, UUID objectId) { ScriptDialogPacket dialog = (ScriptDialogPacket)PacketPool.Instance.GetPacket(PacketType.ScriptDialog); dialog.Data.ObjectID = objectId; @@ -12145,6 +12145,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP buttons[0] = new ScriptDialogPacket.ButtonsBlock(); buttons[0].ButtonLabel = Util.StringToBytes256("!!llTextBox!!"); dialog.Buttons = buttons; + + dialog.OwnerData = new ScriptDialogPacket.OwnerDataBlock[1]; + dialog.OwnerData[0] = new ScriptDialogPacket.OwnerDataBlock(); + dialog.OwnerData[0].OwnerID = ownerID; + OutPacket(dialog, ThrottleOutPacketType.Task); } -- cgit v1.1 From 04eaca2af85bd8261c426e4c1049a73b4badf072 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 27 Jul 2011 08:35:19 +0200 Subject: Ensure that packet headers get parsed correctly --- .../Region/ClientStack/Linden/UDP/LLUDPServer.cs | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index ab6674d..fead4d9 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -160,6 +160,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP public Socket Server { get { return null; } } + private int m_malformedCount = 0; // Guard against a spamming attack + public LLUDPServer(IPAddress listenIP, ref uint port, int proxyPortOffsetParm, bool allow_alternate_port, IConfigSource configSource, AgentCircuitManager circuitManager) : base(listenIP, (int)port) { @@ -612,6 +614,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP #region Decoding + if (buffer.DataLength < 7) + return; // Drop undersizd packet + + int headerLen = 7; + if (buffer.Data[6] == 0xFF) + { + if (buffer.Data[7] == 0xFF) + headerLen = 10; + else + headerLen = 8; + } + + if (buffer.DataLength < headerLen) + return; // Malformed header + try { packet = Packet.BuildPacket(buffer.Data, ref packetEnd, @@ -621,6 +638,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP catch (MalformedDataException) { } + catch (IndexOutOfRangeException) + { + return; // Drop short packet + } + catch(Exception e) + { + if (m_malformedCount < 100) + m_log.DebugFormat("[LLUDPSERVER]: Dropped malformed packet: " + e.ToString()); + m_malformedCount++; + if ((m_malformedCount % 100000) == 0) + m_log.DebugFormat("[LLUDPSERVER]: Received {0} malformed packets so far, probable network attack.", m_malformedCount); + } // Fail-safe check if (packet == null) -- cgit v1.1 From 0e9dda91cbaa0a4431772daeb338ecebf0d2268d Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 9 Aug 2011 20:55:06 +0200 Subject: Guard against a bad login leaving us with a null queue --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index 95a8e23..758fd93 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs @@ -521,7 +521,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // No dequeued packet waiting to be sent, try to pull one off // this queue queue = m_packetOutboxes[i]; - if (queue.Dequeue(out packet)) + if (queue != null && queue.Dequeue(out packet)) { // A packet was pulled off the queue. See if we have // enough tokens in the bucket to send it out -- cgit v1.1 From 03f6734f4367b08e2b181ed68bc80b885e76148f Mon Sep 17 00:00:00 2001 From: Tom Date: Wed, 7 Sep 2011 09:42:18 -0700 Subject: First set of merge fixes --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 5c94fba..db81fea 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -3747,7 +3747,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (!m_scene.TryGetScenePresence(part.OwnerID, out sp)) continue; - List atts = sp.Attachments; + List atts = sp.GetAttachments(); bool found = false; foreach (SceneObjectGroup att in atts) { -- cgit v1.1 From f4de1a6d9b54a85da08de3daadf094c562f88011 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 12 Oct 2011 06:48:40 +0200 Subject: HACK: Remove advanced property resending until it is fixed properly in core. --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 24 +++++++++++++--------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 575e5a2..0c92308 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -4220,11 +4220,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Pass in the delegate so that if this packet needs to be resent, we send the current properties // of the object rather than the properties when the packet was created - OutPacket(packet, ThrottleOutPacketType.Task, true, - delegate(OutgoingPacket oPacket) - { - ResendPropertyUpdates(updates, oPacket); - }); + // HACK : Remove intelligent resending until it's fixed in core + //OutPacket(packet, ThrottleOutPacketType.Task, true, + // delegate(OutgoingPacket oPacket) + // { + // ResendPropertyUpdates(updates, oPacket); + // }); + OutPacket(packet, ThrottleOutPacketType.Task, true); // pbcnt += blocks.Count; // ppcnt++; @@ -4250,11 +4252,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP // of the object rather than the properties when the packet was created List updates = new List(); updates.Add(familyUpdates.Value[i]); - OutPacket(packet, ThrottleOutPacketType.Task, true, - delegate(OutgoingPacket oPacket) - { - ResendPropertyUpdates(updates, oPacket); - }); + // HACK : Remove intelligent resending until it's fixed in core + //OutPacket(packet, ThrottleOutPacketType.Task, true, + // delegate(OutgoingPacket oPacket) + // { + // ResendPropertyUpdates(updates, oPacket); + // }); + OutPacket(packet, ThrottleOutPacketType.Task, true); // fpcnt++; // fbcnt++; -- cgit v1.1 From ec8c93aa5e1d0af2c0adf38156b05e85421f4a81 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 4 Dec 2011 12:35:01 +0100 Subject: Implement ChangeInventoryItemFlagsPacket handling --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 3186dff..effa8d0 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -286,6 +286,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP public event GroupVoteHistoryRequest OnGroupVoteHistoryRequest; public event SimWideDeletesDelegate OnSimWideDeletes; public event SendPostcard OnSendPostcard; + public event ChangeInventoryItemFlags OnChangeInventoryItemFlags; public event MuteListEntryUpdate OnUpdateMuteListEntry; public event MuteListEntryRemove OnRemoveMuteListEntry; public event GodlikeMessage onGodlikeMessage; @@ -5344,6 +5345,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP AddLocalPacketHandler(PacketType.GroupVoteHistoryRequest, HandleGroupVoteHistoryRequest); AddLocalPacketHandler(PacketType.SimWideDeletes, HandleSimWideDeletes); AddLocalPacketHandler(PacketType.SendPostcard, HandleSendPostcard); + AddLocalPacketHandler(PacketType.ChangeInventoryItemFlags, HandleChangeInventoryItemFlags); AddGenericPacketHandler("autopilot", HandleAutopilot); } @@ -9822,6 +9824,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP return false; } + private bool HandleChangeInventoryItemFlags(IClientAPI client, Packet packet) + { + ChangeInventoryItemFlagsPacket ChangeInventoryItemFlags = + (ChangeInventoryItemFlagsPacket)packet; + ChangeInventoryItemFlags handlerChangeInventoryItemFlags = OnChangeInventoryItemFlags; + if (handlerChangeInventoryItemFlags != null) + { + foreach(ChangeInventoryItemFlagsPacket.InventoryDataBlock b in ChangeInventoryItemFlags.InventoryData) + handlerChangeInventoryItemFlags(this, b.ItemID, b.Flags); + return true; + } + return false; + } + private bool HandleUseCircuitCode(IClientAPI sender, Packet Pack) { return true; -- cgit v1.1 From b45923983381d57e8befbdfb1953ebc349ff7d8e Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 8 Dec 2011 01:08:40 +0100 Subject: Recover from an internal mess-up in the outgoing packet queues by creating a new queue object. --- .../Region/ClientStack/Linden/UDP/LLUDPClient.cs | 55 ++++++++++++++-------- 1 file changed, 36 insertions(+), 19 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index c951071..ae72175 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs @@ -498,7 +498,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { if (m_deliverPackets == false) return false; - OutgoingPacket packet; + OutgoingPacket packet = null; OpenSim.Framework.LocklessQueue queue; TokenBucket bucket; bool packetSent = false; @@ -530,32 +530,49 @@ namespace OpenSim.Region.ClientStack.LindenUDP // No dequeued packet waiting to be sent, try to pull one off // this queue queue = m_packetOutboxes[i]; - if (queue != null && queue.Dequeue(out packet)) + if (queue != null) { - // A packet was pulled off the queue. See if we have - // enough tokens in the bucket to send it out - if (bucket.RemoveTokens(packet.Buffer.DataLength)) + bool success = false; + try { - // Send the packet - m_udpServer.SendPacketFinal(packet); - packetSent = true; + success = queue.Dequeue(out packet); } - else + catch { - // Save the dequeued packet for the next iteration - m_nextPackets[i] = packet; + m_packetOutboxes[i] = new OpenSim.Framework.LocklessQueue(); } - - // If the queue is empty after this dequeue, fire the queue - // empty callback now so it has a chance to fill before we - // get back here - if (queue.Count == 0) + if (success) + { + // A packet was pulled off the queue. See if we have + // enough tokens in the bucket to send it out + if (bucket.RemoveTokens(packet.Buffer.DataLength)) + { + // Send the packet + m_udpServer.SendPacketFinal(packet); + packetSent = true; + } + else + { + // Save the dequeued packet for the next iteration + m_nextPackets[i] = packet; + } + + // If the queue is empty after this dequeue, fire the queue + // empty callback now so it has a chance to fill before we + // get back here + if (queue.Count == 0) + emptyCategories |= CategoryToFlag(i); + } + else + { + // No packets in this queue. Fire the queue empty callback + // if it has not been called recently emptyCategories |= CategoryToFlag(i); + } } else { - // No packets in this queue. Fire the queue empty callback - // if it has not been called recently + m_packetOutboxes[i] = new OpenSim.Framework.LocklessQueue(); emptyCategories |= CategoryToFlag(i); } } @@ -713,4 +730,4 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } } -} \ No newline at end of file +} -- cgit v1.1 From 5afb70b9feb58b17261bc6f04f9c923c0da588e5 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 17 Jan 2012 15:30:52 +0100 Subject: Fix prim calculations so that > 32767 prims are supported --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 873c56c..01e1383 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -4612,7 +4612,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (landData.SimwideArea > 0) { - int simulatorCapacity = (int)((double)(landData.SimwideArea * m_scene.RegionInfo.ObjectCapacity) * m_scene.RegionInfo.RegionSettings.ObjectBonus) / 65536; + int simulatorCapacity = (int)((long)landData.SimwideArea * (long)m_scene.RegionInfo.ObjectCapacity * (long)m_scene.RegionInfo.RegionSettings.ObjectBonus / 65536L); // Never report more than sim total capacity if (simulatorCapacity > m_scene.RegionInfo.ObjectCapacity) simulatorCapacity = m_scene.RegionInfo.ObjectCapacity; -- cgit v1.1 From dac826da4ea2e1208f420a1fbf652417f858a8c1 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 28 Jan 2012 20:38:50 +0100 Subject: Prevent an overlong description from messing up a ParcelInfoReply --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index bbaa08e..a50a61d 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -2766,7 +2766,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP reply.Data.ParcelID = parcelID; reply.Data.OwnerID = land.OwnerID; reply.Data.Name = Utils.StringToBytes(land.Name); - reply.Data.Desc = Utils.StringToBytes(land.Description); + reply.Data.Desc = Utils.StringToBytes(land.Description.Substring(0, land.Description.Length > 254 ? 254: land.Description.Length)); reply.Data.ActualArea = land.Area; reply.Data.BillableArea = land.Area; // TODO: what is this? -- cgit v1.1 From 0f181fe5d05e24886586e5882f4f6fe60c1dc30d Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 30 Jan 2012 22:30:02 +0100 Subject: Fix displaying landmark and search info properly with long names --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index a50a61d..4f09d8f 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -2766,7 +2766,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP reply.Data.ParcelID = parcelID; reply.Data.OwnerID = land.OwnerID; reply.Data.Name = Utils.StringToBytes(land.Name); - reply.Data.Desc = Utils.StringToBytes(land.Description.Substring(0, land.Description.Length > 254 ? 254: land.Description.Length)); + if (land != null && land.Description != null && land.Description != String.Empty) + reply.Data.Desc = Utils.StringToBytes(land.Description.Substring(0, land.Description.Length > 254 ? 254: land.Description.Length)); + else + reply.Data.Desc = new Byte[0]; reply.Data.ActualArea = land.Area; reply.Data.BillableArea = land.Area; // TODO: what is this? -- cgit v1.1 From 07c487a28f6ce6d85cf32fba0c2ded724f7b5af7 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 2 Feb 2012 21:36:45 +0100 Subject: Make ban, eject, freeze and the scripted versions of those work. --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index d126f5f..8c0a7e9 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -4684,7 +4684,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } - public void SendLandAccessListData(List avatars, uint accessFlag, int localLandID) + public void SendLandAccessListData(List accessList, uint accessFlag, int localLandID) { ParcelAccessListReplyPacket replyPacket = (ParcelAccessListReplyPacket)PacketPool.Instance.GetPacket(PacketType.ParcelAccessListReply); replyPacket.Data.AgentID = AgentId; @@ -4693,12 +4693,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP replyPacket.Data.SequenceID = 0; List list = new List(); - foreach (UUID avatar in avatars) + foreach (LandAccessEntry entry in accessList) { ParcelAccessListReplyPacket.ListBlock block = new ParcelAccessListReplyPacket.ListBlock(); block.Flags = accessFlag; - block.ID = avatar; - block.Time = 0; + block.ID = entry.AgentID; + block.Time = entry.Expires; list.Add(block); } @@ -8641,13 +8641,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP } #endregion - List entries = new List(); + List entries = new List(); foreach (ParcelAccessListUpdatePacket.ListBlock block in updatePacket.List) { - ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); + LandAccessEntry entry = new LandAccessEntry(); entry.AgentID = block.ID; entry.Flags = (AccessList)block.Flags; - entry.Time = Util.ToDateTime(block.Time); + entry.Expires = block.Time; entries.Add(entry); } -- cgit v1.1 From 2d3381b795611a8857077d1effb41323c2cb8658 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 14 Feb 2012 23:16:20 +0100 Subject: Implement region crossing of sitting avatars. Edit mode and llSetPos work but unscripted default sit anim is lost. Still some Gfx glitching. Physical crossing doesn't work yet. --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 8ed250d..161feda 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -1549,7 +1549,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP public void SendKillObject(ulong regionHandle, List localIDs) { -// m_log.DebugFormat("[CLIENT]: Sending KillObjectPacket to {0} for {1} in {2}", Name, localID, regionHandle); +// foreach (uint id in localIDs) +// m_log.DebugFormat("[CLIENT]: Sending KillObjectPacket to {0} for {1} in {2}", Name, id, regionHandle); KillObjectPacket kill = (KillObjectPacket)PacketPool.Instance.GetPacket(PacketType.KillObject); // TODO: don't create new blocks if recycling an old packet -- cgit v1.1 From 56cc573d2ff71c6caa5b0f28d784f7c3c7751e52 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 23 Feb 2012 12:20:20 +0100 Subject: Show avatars as sitting on proot prims only to avoid motion jitter for passengers --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 36 +++++++++++++++++++--- 1 file changed, 31 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 161feda..1ac3b76 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -4828,9 +4828,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP { ScenePresence presence = (ScenePresence)entity; + position = presence.OffsetPosition; + rotation = presence.Rotation; + + if (presence.ParentID != 0) + { + SceneObjectPart part = m_scene.GetSceneObjectPart(presence.ParentID); + if (part != null && part != part.ParentGroup.RootPart) + { + position = part.OffsetPosition + presence.OffsetPosition * part.RotationOffset; + rotation = presence.Rotation * part.RotationOffset; + } + } + attachPoint = 0; collisionPlane = presence.CollisionPlane; - position = presence.OffsetPosition; velocity = presence.Velocity; acceleration = Vector3.Zero; @@ -4840,7 +4852,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP // acceleration = new Vector3(1, 0, 0); angularVelocity = Vector3.Zero; - rotation = presence.Rotation; if (sendTexture) textureEntry = presence.Appearance.Texture.GetBytes(); @@ -4945,13 +4956,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP protected ObjectUpdatePacket.ObjectDataBlock CreateAvatarUpdateBlock(ScenePresence data) { + Vector3 offsetPosition = data.OffsetPosition; + Quaternion rotation = data.Rotation; + uint parentID = data.ParentID; + + if (parentID != 0) + { + SceneObjectPart part = m_scene.GetSceneObjectPart(parentID); + if (part != null && part != part.ParentGroup.RootPart) + { + offsetPosition = part.OffsetPosition + data.OffsetPosition * part.RotationOffset; + rotation = data.Rotation * part.RotationOffset; + parentID = part.ParentGroup.RootPart.LocalId; + } + } + byte[] objectData = new byte[76]; data.CollisionPlane.ToBytes(objectData, 0); - data.OffsetPosition.ToBytes(objectData, 16); + offsetPosition.ToBytes(objectData, 16); // data.Velocity.ToBytes(objectData, 28); // data.Acceleration.ToBytes(objectData, 40); - data.Rotation.ToBytes(objectData, 52); + rotation.ToBytes(objectData, 52); //data.AngularVelocity.ToBytes(objectData, 64); ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock(); @@ -4965,7 +4991,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP update.NameValue = Utils.StringToBytes("FirstName STRING RW SV " + data.Firstname + "\nLastName STRING RW SV " + data.Lastname + "\nTitle STRING RW SV " + data.Grouptitle); update.ObjectData = objectData; - update.ParentID = data.ParentID; + update.ParentID = parentID; update.PathCurve = 16; update.PathScaleX = 100; update.PathScaleY = 100; -- cgit v1.1 From dc835717d66678eddfd802717a068c6131e460fc Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 23 Feb 2012 14:08:35 +0100 Subject: Properly sequence updates of avatars and attachments so that we don't update attachments on child avatars or intermingle agent and attachment updates, which would render the root prim of huds invisible --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 1ac3b76..2e86315 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -3774,6 +3774,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP // doesn't seem to be attached, skip if (!found) continue; + + // On vehicle crossing, the attachments are received + // while the avatar is still a child. Don't send + // updates here because the LocalId has not yet + // been updated and the viewer will derender the + // attachments until the avatar becomes root. + if (sp.IsChildAgent) + continue; } if (part.ParentGroup.IsAttachment && m_disableFacelights) { -- cgit v1.1 From 1c0adfa6e025045b6c309943f886f641a4df8e38 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 23 Feb 2012 22:26:17 +0100 Subject: Correct sit position calculations --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 2e86315..f835e56 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -4845,7 +4845,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (part != null && part != part.ParentGroup.RootPart) { position = part.OffsetPosition + presence.OffsetPosition * part.RotationOffset; - rotation = presence.Rotation * part.RotationOffset; + rotation = part.RotationOffset * presence.Rotation; } } @@ -4974,7 +4974,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (part != null && part != part.ParentGroup.RootPart) { offsetPosition = part.OffsetPosition + data.OffsetPosition * part.RotationOffset; - rotation = data.Rotation * part.RotationOffset; + rotation = part.RotationOffset * data.Rotation; parentID = part.ParentGroup.RootPart.LocalId; } } -- cgit v1.1 From 05cdf9bda910ced0da29474b8b40a58e8a423d69 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 9 Mar 2012 01:53:58 +0000 Subject: more changes in undo/redo. Basicly moved control to llclientview.cs. later we can move back to a dispatcher function on SOG that handles the several cases( in a viwer independent way (?)) and calls current exec funtions. made cosmetic changes replacing decimals by hexs so bits are easier to read. Changed behavour of case 12 and 28 ( 0x0c and 0x1c) to make identical to 0x0d and 0x1d ( scale only and scale plus position). DOn't see 12 and 28 in use... cases 1c and 1d still broken --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 221 ++++++++++++++------- 1 file changed, 154 insertions(+), 67 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index f835e56..c7fc827 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -11518,183 +11518,269 @@ namespace OpenSim.Region.ClientStack.LindenUDP // } UpdatePrimGroupRotation handlerUpdatePrimGroupRotation; + UpdateVector handlerUpdatePrimGroupScale; + + Quaternion arot; + Vector3 ascale; + Vector3 apos; +/*ubit from ll JIRA: + * 0x01 position + * 0x02 rotation + * 0x04 scale + + * 0x08 LINK_SET + * 0x10 UNIFORM for scale + */ + switch (block.Type) { - case 1: - Vector3 pos1 = new Vector3(block.Data, 0); + case 1: //change position sp + apos = new Vector3(block.Data, 0); UpdateVector handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition; if (handlerUpdatePrimSinglePosition != null) { + part.StoreUndoState(); + part.IgnoreUndoUpdate = true; + // m_log.Debug("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z); - handlerUpdatePrimSinglePosition(localId, pos1, this); + handlerUpdatePrimSinglePosition(localId, apos, this); + + part.IgnoreUndoUpdate = false; } break; - case 2: - Quaternion rot1 = new Quaternion(block.Data, 0, true); + case 2: // rotation sp + arot = new Quaternion(block.Data, 0, true); UpdatePrimSingleRotation handlerUpdatePrimSingleRotation = OnUpdatePrimSingleRotation; if (handlerUpdatePrimSingleRotation != null) { - // m_log.Info("new tab rotation is " + rot1.X + " , " + rot1.Y + " , " + rot1.Z + " , " + rot1.W); - handlerUpdatePrimSingleRotation(localId, rot1, this); + part.StoreUndoState(); + part.IgnoreUndoUpdate = true; + + handlerUpdatePrimSingleRotation(localId, arot, this); + + part.IgnoreUndoUpdate = false; } break; - case 3: - Vector3 rotPos = new Vector3(block.Data, 0); - Quaternion rot2 = new Quaternion(block.Data, 12, true); + case 3: // position plus rotation + apos = new Vector3(block.Data, 0); + arot = new Quaternion(block.Data, 12, true); UpdatePrimSingleRotationPosition handlerUpdatePrimSingleRotationPosition = OnUpdatePrimSingleRotationPosition; if (handlerUpdatePrimSingleRotationPosition != null) { - // m_log.Debug("new mouse rotation position is " + rotPos.X + " , " + rotPos.Y + " , " + rotPos.Z); - // m_log.Info("new mouse rotation is " + rot2.X + " , " + rot2.Y + " , " + rot2.Z + " , " + rot2.W); - handlerUpdatePrimSingleRotationPosition(localId, rot2, rotPos, this); + part.StoreUndoState(); + part.IgnoreUndoUpdate = true; + + handlerUpdatePrimSingleRotationPosition(localId, arot, apos, this); + + part.IgnoreUndoUpdate = false; } break; - case 4: - case 20: - Vector3 scale4 = new Vector3(block.Data, 0); + case 4: // scale sp + case 0x14: // uniform scale sp + ascale = new Vector3(block.Data, 0); UpdateVector handlerUpdatePrimScale = OnUpdatePrimScale; if (handlerUpdatePrimScale != null) { - // m_log.Debug("new scale is " + scale4.X + " , " + scale4.Y + " , " + scale4.Z); - handlerUpdatePrimScale(localId, scale4, this); + part.StoreUndoState(); + part.IgnoreUndoUpdate = true; + + handlerUpdatePrimScale(localId, ascale, this); + + part.IgnoreUndoUpdate = false; } break; - case 5: - Vector3 scale1 = new Vector3(block.Data, 12); - Vector3 pos11 = new Vector3(block.Data, 0); + case 5: // scale and position sp + apos = new Vector3(block.Data, 0); + ascale = new Vector3(block.Data, 12); + handlerUpdatePrimScale = OnUpdatePrimScale; if (handlerUpdatePrimScale != null) { - // m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); - handlerUpdatePrimScale(localId, scale1, this); + part.StoreUndoState(); + part.IgnoreUndoUpdate = true; + + handlerUpdatePrimScale(localId, ascale, this); handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition; + if (handlerUpdatePrimSinglePosition != null) { - handlerUpdatePrimSinglePosition(localId, pos11, this); + handlerUpdatePrimSinglePosition(localId, apos, this); } + part.IgnoreUndoUpdate = false; } break; - case 9: - Vector3 pos2 = new Vector3(block.Data, 0); + case 0x15: //uniform scale and position + apos = new Vector3(block.Data, 0); + ascale = new Vector3(block.Data, 12); + + + handlerUpdatePrimScale = OnUpdatePrimScale; + if (handlerUpdatePrimScale != null) + { + part.StoreUndoState(false); + part.IgnoreUndoUpdate = true; + + // m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); + handlerUpdatePrimScale(localId, ascale, this); + handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition; + if (handlerUpdatePrimSinglePosition != null) + { + handlerUpdatePrimSinglePosition(localId, apos, this); + } + + part.IgnoreUndoUpdate = false; + } + break; + +// now group related (bit 4) + case 9: //( 8 + 1 )group position + apos = new Vector3(block.Data, 0); UpdateVector handlerUpdateVector = OnUpdatePrimGroupPosition; if (handlerUpdateVector != null) { - handlerUpdateVector(localId, pos2, this); + part.StoreUndoState(true); + part.IgnoreUndoUpdate = true; + + handlerUpdateVector(localId, apos, this); + + part.IgnoreUndoUpdate = false; } break; - case 10: - Quaternion rot3 = new Quaternion(block.Data, 0, true); + case 0x0A: // (8 + 2) group rotation + arot = new Quaternion(block.Data, 0, true); UpdatePrimRotation handlerUpdatePrimRotation = OnUpdatePrimGroupRotation; if (handlerUpdatePrimRotation != null) { // Console.WriteLine("new rotation is " + rot3.X + " , " + rot3.Y + " , " + rot3.Z + " , " + rot3.W); - handlerUpdatePrimRotation(localId, rot3, this); + part.StoreUndoState(true); + part.IgnoreUndoUpdate = true; + + handlerUpdatePrimRotation(localId, arot, this); + + part.IgnoreUndoUpdate = false; } break; - case 11: - Vector3 pos3 = new Vector3(block.Data, 0); - Quaternion rot4 = new Quaternion(block.Data, 12, true); + case 0x0B: //( 8 + 2 + 1) group rotation and position + apos = new Vector3(block.Data, 0); + arot = new Quaternion(block.Data, 12, true); handlerUpdatePrimGroupRotation = OnUpdatePrimGroupMouseRotation; if (handlerUpdatePrimGroupRotation != null) { // m_log.Debug("new rotation position is " + pos.X + " , " + pos.Y + " , " + pos.Z); // m_log.Debug("new group mouse rotation is " + rot4.X + " , " + rot4.Y + " , " + rot4.Z + " , " + rot4.W); - handlerUpdatePrimGroupRotation(localId, pos3, rot4, this); + part.StoreUndoState(true); + part.IgnoreUndoUpdate = true; + + handlerUpdatePrimGroupRotation(localId, apos, arot, this); + + part.IgnoreUndoUpdate = false; } break; - case 12: - case 28: - Vector3 scale7 = new Vector3(block.Data, 0); - UpdateVector handlerUpdatePrimGroupScale = OnUpdatePrimGroupScale; - if (handlerUpdatePrimGroupScale != null) + case 0x0C: // (8 + 4) group scale + // only afects root prim and only sent by viewer editor object tab scaling + // mouse edition only allows uniform scaling + // SL MAY CHANGE THIS in viewers + + ascale = new Vector3(block.Data, 0); + + handlerUpdatePrimScale = OnUpdatePrimScale; + if (handlerUpdatePrimScale != null) { // m_log.Debug("new scale is " + scale7.X + " , " + scale7.Y + " , " + scale7.Z); - handlerUpdatePrimGroupScale(localId, scale7, this); + part.StoreUndoState(false); // <- SL Exception make it apply to root prim and not group + part.IgnoreUndoUpdate = true; + + handlerUpdatePrimScale(localId, ascale, this); + + part.IgnoreUndoUpdate = false; } break; - case 13: - Vector3 scale2 = new Vector3(block.Data, 12); - Vector3 pos4 = new Vector3(block.Data, 0); + case 0x0D: //(8 + 4 + 1) group scale and position + // exception as above + apos = new Vector3(block.Data, 0); + ascale = new Vector3(block.Data, 12); + handlerUpdatePrimScale = OnUpdatePrimScale; if (handlerUpdatePrimScale != null) { //m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); - handlerUpdatePrimScale(localId, scale2, this); + part.StoreUndoState(false); // <- make it apply to root prim and not group + part.IgnoreUndoUpdate = true; + + handlerUpdatePrimScale(localId, ascale, this); // Change the position based on scale (for bug number 246) handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition; // m_log.Debug("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z); if (handlerUpdatePrimSinglePosition != null) { - handlerUpdatePrimSinglePosition(localId, pos4, this); + handlerUpdatePrimSinglePosition(localId, apos, this); } + + part.IgnoreUndoUpdate = false; } break; - case 29: - Vector3 scale5 = new Vector3(block.Data, 12); - Vector3 pos5 = new Vector3(block.Data, 0); + case 0x1C: // (0x10 + 8 + 4 ) group scale UNIFORM + ascale = new Vector3(block.Data, 0); handlerUpdatePrimGroupScale = OnUpdatePrimGroupScale; if (handlerUpdatePrimGroupScale != null) { - // m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); + // m_log.Debug("new scale is " + scale7.X + " , " + scale7.Y + " , " + scale7.Z); part.StoreUndoState(true); part.IgnoreUndoUpdate = true; - handlerUpdatePrimGroupScale(localId, scale5, this); - handlerUpdateVector = OnUpdatePrimGroupPosition; - if (handlerUpdateVector != null) - { - handlerUpdateVector(localId, pos5, this); - } + handlerUpdatePrimGroupScale(localId, ascale, this); part.IgnoreUndoUpdate = false; } - break; - case 21: - Vector3 scale6 = new Vector3(block.Data, 12); - Vector3 pos6 = new Vector3(block.Data, 0); + case 0x1D: // (UNIFORM + GROUP + SCALE + POS) + apos = new Vector3(block.Data, 0); + Vector3 scale5 = new Vector3(block.Data, 12); + - handlerUpdatePrimScale = OnUpdatePrimScale; - if (handlerUpdatePrimScale != null) + handlerUpdatePrimGroupScale = OnUpdatePrimGroupScale; + if (handlerUpdatePrimGroupScale != null) { - part.StoreUndoState(false); + // m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); + part.StoreUndoState(true); part.IgnoreUndoUpdate = true; - // m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); - handlerUpdatePrimScale(localId, scale6, this); - handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition; - if (handlerUpdatePrimSinglePosition != null) + handlerUpdatePrimGroupScale(localId, scale5, this); + handlerUpdateVector = OnUpdatePrimGroupPosition; + + if (handlerUpdateVector != null) { - handlerUpdatePrimSinglePosition(localId, pos6, this); + handlerUpdateVector(localId, apos, this); } part.IgnoreUndoUpdate = false; } + break; default: @@ -11704,6 +11790,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // for (int j = 0; j < parts.Length; j++) // parts[j].IgnoreUndoUpdate = false; + } } } -- cgit v1.1 From e5786ba0435bee04246fcd689a103f2df338dba9 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 9 Mar 2012 02:56:14 +0000 Subject: more changes on undo/redo group scaling seems to work better --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index c7fc827..051c4fa 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -11760,7 +11760,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP case 0x1D: // (UNIFORM + GROUP + SCALE + POS) apos = new Vector3(block.Data, 0); - Vector3 scale5 = new Vector3(block.Data, 12); + ascale = new Vector3(block.Data, 12); handlerUpdatePrimGroupScale = OnUpdatePrimGroupScale; @@ -11770,7 +11770,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP part.StoreUndoState(true); part.IgnoreUndoUpdate = true; - handlerUpdatePrimGroupScale(localId, scale5, this); + handlerUpdatePrimGroupScale(localId, ascale, this); + handlerUpdateVector = OnUpdatePrimGroupPosition; if (handlerUpdateVector != null) -- cgit v1.1 From 908abb1c3dded307e769abac71f660b835875975 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 10 Mar 2012 20:32:19 +0000 Subject: BIG MESS. changed Iclient interface so only one event is used to inform scene about position scale or rotation change by client (others can be added). Its served at SceneGraph that does permition checks, undostore and sends down to SOG. changed values are stored in a class (ObjectChangeData) and what is changed as a enum (ObjectChangeWhat) with bit fields and 'macros' of this for better readability (at top of scenegraph.cs lasy to find better place for now) this can be extended for other things clients changes and need undo/redo. SOG process acording to what is changed. Changed UNDO/redo to use this also (warning is only storing what is changed, previus stored all, this must be checked for side efects. to save all PRS change commented line in scenegraph). Still have excessive calls to ScheduleGroupForTerseUpdate. **** UNTESTED **** --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 156 +++++++++++++++++++-- 1 file changed, 143 insertions(+), 13 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 051c4fa..7d51323 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -125,6 +125,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP public event RequestObjectPropertiesFamily OnRequestObjectPropertiesFamily; public event UpdatePrimFlags OnUpdatePrimFlags; public event UpdatePrimTexture OnUpdatePrimTexture; + public event ClientChangeObject onClientChangeObject; public event UpdateVector OnUpdatePrimGroupPosition; public event UpdateVector OnUpdatePrimSinglePosition; public event UpdatePrimRotation OnUpdatePrimGroupRotation; @@ -11517,22 +11518,151 @@ namespace OpenSim.Region.ClientStack.LindenUDP // parts[j].IgnoreUndoUpdate = true; // } - UpdatePrimGroupRotation handlerUpdatePrimGroupRotation; - UpdateVector handlerUpdatePrimGroupScale; +// UpdatePrimGroupRotation handlerUpdatePrimGroupRotation; +// UpdateVector handlerUpdatePrimGroupScale; - Quaternion arot; - Vector3 ascale; - Vector3 apos; -/*ubit from ll JIRA: - * 0x01 position - * 0x02 rotation - * 0x04 scale + ClientChangeObject updatehandler = onClientChangeObject; + + if (updatehandler != null) + { + ObjectChangeData udata = new ObjectChangeData(); + + /*ubit from ll JIRA: + * 0x01 position + * 0x02 rotation + * 0x04 scale - * 0x08 LINK_SET - * 0x10 UNIFORM for scale - */ + * 0x08 LINK_SET + * 0x10 UNIFORM for scale + */ + + // translate to internal changes + // not all cases .. just the ones older code did + + switch (block.Type) + { + case 1: //change position sp + udata.position = new Vector3(block.Data, 0); + + udata.what = ObjectChangeWhat.primP; + updatehandler(localId, udata, this); + break; + + case 2: // rotation sp + udata.rotation = new Quaternion(block.Data, 0, true); + + udata.what = ObjectChangeWhat.primR; + updatehandler(localId, udata, this); + break; + + case 3: // position plus rotation + udata.position = new Vector3(block.Data, 0); + udata.rotation = new Quaternion(block.Data, 12, true); + + udata.what = ObjectChangeWhat.primPR; + updatehandler(localId, udata, this); + + break; + + case 4: // scale sp + udata.scale = new Vector3(block.Data, 0); + udata.what = ObjectChangeWhat.primS; + + updatehandler(localId, udata, this); + break; + + case 0x14: // uniform scale sp + udata.scale = new Vector3(block.Data, 0); + + udata.what = ObjectChangeWhat.primUS; + updatehandler(localId, udata, this); + break; + + case 5: // scale and position sp + udata.position = new Vector3(block.Data, 0); + udata.scale = new Vector3(block.Data, 12); + + udata.what = ObjectChangeWhat.primPS; + updatehandler(localId, udata, this); + break; + + case 0x15: //uniform scale and position + udata.position = new Vector3(block.Data, 0); + udata.scale = new Vector3(block.Data, 12); + + udata.what = ObjectChangeWhat.primPUS; + updatehandler(localId, udata, this); + break; + // now group related (bit 4) + case 9: //( 8 + 1 )group position + udata.position = new Vector3(block.Data, 0); + udata.what = ObjectChangeWhat.groupP; + updatehandler(localId, udata, this); + break; + + case 0x0A: // (8 + 2) group rotation + udata.rotation = new Quaternion(block.Data, 0, true); + + udata.what = ObjectChangeWhat.groupR; + updatehandler(localId, udata, this); + break; + + case 0x0B: //( 8 + 2 + 1) group rotation and position + udata.position = new Vector3(block.Data, 0); + udata.rotation = new Quaternion(block.Data, 12, true); + + udata.what = ObjectChangeWhat.groupPR; + updatehandler(localId, udata, this); + break; + + case 0x0C: // (8 + 4) group scale + // only afects root prim and only sent by viewer editor object tab scaling + // mouse edition only allows uniform scaling + // SL MAY CHANGE THIS in viewers + + udata.scale = new Vector3(block.Data, 0); + + // udata.what = ObjectChangeWhat.groupS; + udata.what = ObjectChangeWhat.primS; // to conform to current SL + updatehandler(localId, udata, this); + + break; + + case 0x0D: //(8 + 4 + 1) group scale and position + // exception as above + + udata.position = new Vector3(block.Data, 0); + udata.scale = new Vector3(block.Data, 12); + + // udata.what = ObjectChangeWhat.groupPS; + udata.what = ObjectChangeWhat.primPS; // to conform to current SL + updatehandler(localId, udata, this); + break; + + case 0x1C: // (0x10 + 8 + 4 ) group scale UNIFORM + udata.scale = new Vector3(block.Data, 0); + + udata.what = ObjectChangeWhat.groupUS; + updatehandler(localId, udata, this); + break; + + case 0x1D: // (UNIFORM + GROUP + SCALE + POS) + udata.position = new Vector3(block.Data, 0); + udata.scale = new Vector3(block.Data, 12); + + udata.what = ObjectChangeWhat.groupPUS; + updatehandler(localId, udata, this); + break; + + default: + m_log.Debug("[CLIENT]: MultipleObjUpdate recieved an unknown packet type: " + (block.Type)); + break; + } + } + +/* switch (block.Type) { case 1: //change position sp @@ -11788,7 +11918,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_log.Debug("[CLIENT]: MultipleObjUpdate recieved an unknown packet type: " + (block.Type)); break; } - +*/ // for (int j = 0; j < parts.Length; j++) // parts[j].IgnoreUndoUpdate = false; -- cgit v1.1 From 1f7c0c2ea00154366964c0e75fb05a92d4b8f764 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 11 Mar 2012 03:28:17 +0000 Subject: cleanup + comments --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 277 --------------------- 1 file changed, 277 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 7d51323..7935222 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -11506,21 +11506,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP } else { -// m_log.DebugFormat( -// "[CLIENT]: Processing block {0} type {1} for {2} {3}", -// i, block.Type, part.Name, part.LocalId); - -// // Do this once since fetch parts creates a new array. -// SceneObjectPart[] parts = part.ParentGroup.Parts; -// for (int j = 0; j < parts.Length; j++) -// { -// part.StoreUndoState(); -// parts[j].IgnoreUndoUpdate = true; -// } - -// UpdatePrimGroupRotation handlerUpdatePrimGroupRotation; -// UpdateVector handlerUpdatePrimGroupScale; - ClientChangeObject updatehandler = onClientChangeObject; if (updatehandler != null) @@ -11561,7 +11546,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP udata.what = ObjectChangeWhat.primPR; updatehandler(localId, udata, this); - break; case 4: // scale sp @@ -11662,270 +11646,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } -/* - switch (block.Type) - { - case 1: //change position sp - apos = new Vector3(block.Data, 0); - - UpdateVector handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition; - if (handlerUpdatePrimSinglePosition != null) - { - part.StoreUndoState(); - part.IgnoreUndoUpdate = true; - - // m_log.Debug("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z); - handlerUpdatePrimSinglePosition(localId, apos, this); - - part.IgnoreUndoUpdate = false; - } - break; - - case 2: // rotation sp - arot = new Quaternion(block.Data, 0, true); - - UpdatePrimSingleRotation handlerUpdatePrimSingleRotation = OnUpdatePrimSingleRotation; - if (handlerUpdatePrimSingleRotation != null) - { - part.StoreUndoState(); - part.IgnoreUndoUpdate = true; - - handlerUpdatePrimSingleRotation(localId, arot, this); - - part.IgnoreUndoUpdate = false; - } - break; - - case 3: // position plus rotation - apos = new Vector3(block.Data, 0); - arot = new Quaternion(block.Data, 12, true); - - UpdatePrimSingleRotationPosition handlerUpdatePrimSingleRotationPosition = OnUpdatePrimSingleRotationPosition; - if (handlerUpdatePrimSingleRotationPosition != null) - { - part.StoreUndoState(); - part.IgnoreUndoUpdate = true; - - handlerUpdatePrimSingleRotationPosition(localId, arot, apos, this); - - part.IgnoreUndoUpdate = false; - } - break; - - case 4: // scale sp - case 0x14: // uniform scale sp - ascale = new Vector3(block.Data, 0); - - UpdateVector handlerUpdatePrimScale = OnUpdatePrimScale; - if (handlerUpdatePrimScale != null) - { - part.StoreUndoState(); - part.IgnoreUndoUpdate = true; - - handlerUpdatePrimScale(localId, ascale, this); - - part.IgnoreUndoUpdate = false; - } - break; - - case 5: // scale and position sp - apos = new Vector3(block.Data, 0); - ascale = new Vector3(block.Data, 12); - - - handlerUpdatePrimScale = OnUpdatePrimScale; - if (handlerUpdatePrimScale != null) - { - part.StoreUndoState(); - part.IgnoreUndoUpdate = true; - - handlerUpdatePrimScale(localId, ascale, this); - - handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition; - - if (handlerUpdatePrimSinglePosition != null) - { - handlerUpdatePrimSinglePosition(localId, apos, this); - } - part.IgnoreUndoUpdate = false; - } - break; - - case 0x15: //uniform scale and position - apos = new Vector3(block.Data, 0); - ascale = new Vector3(block.Data, 12); - - - handlerUpdatePrimScale = OnUpdatePrimScale; - if (handlerUpdatePrimScale != null) - { - part.StoreUndoState(false); - part.IgnoreUndoUpdate = true; - - // m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); - handlerUpdatePrimScale(localId, ascale, this); - handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition; - if (handlerUpdatePrimSinglePosition != null) - { - handlerUpdatePrimSinglePosition(localId, apos, this); - } - - part.IgnoreUndoUpdate = false; - } - break; - -// now group related (bit 4) - case 9: //( 8 + 1 )group position - apos = new Vector3(block.Data, 0); - - UpdateVector handlerUpdateVector = OnUpdatePrimGroupPosition; - - if (handlerUpdateVector != null) - { - part.StoreUndoState(true); - part.IgnoreUndoUpdate = true; - - handlerUpdateVector(localId, apos, this); - - part.IgnoreUndoUpdate = false; - } - break; - - case 0x0A: // (8 + 2) group rotation - arot = new Quaternion(block.Data, 0, true); - - UpdatePrimRotation handlerUpdatePrimRotation = OnUpdatePrimGroupRotation; - if (handlerUpdatePrimRotation != null) - { - // Console.WriteLine("new rotation is " + rot3.X + " , " + rot3.Y + " , " + rot3.Z + " , " + rot3.W); - part.StoreUndoState(true); - part.IgnoreUndoUpdate = true; - - handlerUpdatePrimRotation(localId, arot, this); - - part.IgnoreUndoUpdate = false; - } - break; - - case 0x0B: //( 8 + 2 + 1) group rotation and position - apos = new Vector3(block.Data, 0); - arot = new Quaternion(block.Data, 12, true); - - handlerUpdatePrimGroupRotation = OnUpdatePrimGroupMouseRotation; - if (handlerUpdatePrimGroupRotation != null) - { - // m_log.Debug("new rotation position is " + pos.X + " , " + pos.Y + " , " + pos.Z); - // m_log.Debug("new group mouse rotation is " + rot4.X + " , " + rot4.Y + " , " + rot4.Z + " , " + rot4.W); - part.StoreUndoState(true); - part.IgnoreUndoUpdate = true; - - handlerUpdatePrimGroupRotation(localId, apos, arot, this); - - part.IgnoreUndoUpdate = false; - } - break; - - case 0x0C: // (8 + 4) group scale - // only afects root prim and only sent by viewer editor object tab scaling - // mouse edition only allows uniform scaling - // SL MAY CHANGE THIS in viewers - - ascale = new Vector3(block.Data, 0); - - handlerUpdatePrimScale = OnUpdatePrimScale; - if (handlerUpdatePrimScale != null) - { - // m_log.Debug("new scale is " + scale7.X + " , " + scale7.Y + " , " + scale7.Z); - part.StoreUndoState(false); // <- SL Exception make it apply to root prim and not group - part.IgnoreUndoUpdate = true; - - handlerUpdatePrimScale(localId, ascale, this); - - part.IgnoreUndoUpdate = false; - } - break; - - case 0x0D: //(8 + 4 + 1) group scale and position - // exception as above - - apos = new Vector3(block.Data, 0); - ascale = new Vector3(block.Data, 12); - - handlerUpdatePrimScale = OnUpdatePrimScale; - if (handlerUpdatePrimScale != null) - { - //m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); - part.StoreUndoState(false); // <- make it apply to root prim and not group - part.IgnoreUndoUpdate = true; - - handlerUpdatePrimScale(localId, ascale, this); - - // Change the position based on scale (for bug number 246) - handlerUpdatePrimSinglePosition = OnUpdatePrimSinglePosition; - // m_log.Debug("new movement position is " + pos.X + " , " + pos.Y + " , " + pos.Z); - if (handlerUpdatePrimSinglePosition != null) - { - handlerUpdatePrimSinglePosition(localId, apos, this); - } - - part.IgnoreUndoUpdate = false; - } - break; - - case 0x1C: // (0x10 + 8 + 4 ) group scale UNIFORM - ascale = new Vector3(block.Data, 0); - - handlerUpdatePrimGroupScale = OnUpdatePrimGroupScale; - if (handlerUpdatePrimGroupScale != null) - { - // m_log.Debug("new scale is " + scale7.X + " , " + scale7.Y + " , " + scale7.Z); - part.StoreUndoState(true); - part.IgnoreUndoUpdate = true; - - handlerUpdatePrimGroupScale(localId, ascale, this); - - part.IgnoreUndoUpdate = false; - } - break; - - case 0x1D: // (UNIFORM + GROUP + SCALE + POS) - apos = new Vector3(block.Data, 0); - ascale = new Vector3(block.Data, 12); - - - handlerUpdatePrimGroupScale = OnUpdatePrimGroupScale; - if (handlerUpdatePrimGroupScale != null) - { - // m_log.Debug("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z); - part.StoreUndoState(true); - part.IgnoreUndoUpdate = true; - - handlerUpdatePrimGroupScale(localId, ascale, this); - - handlerUpdateVector = OnUpdatePrimGroupPosition; - - if (handlerUpdateVector != null) - { - handlerUpdateVector(localId, apos, this); - } - - part.IgnoreUndoUpdate = false; - } - - break; - - default: - m_log.Debug("[CLIENT]: MultipleObjUpdate recieved an unknown packet type: " + (block.Type)); - break; - } -*/ -// for (int j = 0; j < parts.Length; j++) -// parts[j].IgnoreUndoUpdate = false; - } } } - return true; } -- cgit v1.1 From ebcd4910a21726c830796cfe14c0792007b766b7 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 13 Mar 2012 13:08:32 +0100 Subject: Refactor, move OjectChangeData into it's own file and rename ObjectChnageWhat what into ObjectChangeType change. What is no name for a variable or type! --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 32 +++++++++++----------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 4c43c10..18af623 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -11504,14 +11504,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP case 1: //change position sp udata.position = new Vector3(block.Data, 0); - udata.what = ObjectChangeWhat.primP; + udata.change = ObjectChangeType.primP; updatehandler(localId, udata, this); break; case 2: // rotation sp udata.rotation = new Quaternion(block.Data, 0, true); - udata.what = ObjectChangeWhat.primR; + udata.change = ObjectChangeType.primR; updatehandler(localId, udata, this); break; @@ -11519,13 +11519,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP udata.position = new Vector3(block.Data, 0); udata.rotation = new Quaternion(block.Data, 12, true); - udata.what = ObjectChangeWhat.primPR; + udata.change = ObjectChangeType.primPR; updatehandler(localId, udata, this); break; case 4: // scale sp udata.scale = new Vector3(block.Data, 0); - udata.what = ObjectChangeWhat.primS; + udata.change = ObjectChangeType.primS; updatehandler(localId, udata, this); break; @@ -11533,7 +11533,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP case 0x14: // uniform scale sp udata.scale = new Vector3(block.Data, 0); - udata.what = ObjectChangeWhat.primUS; + udata.change = ObjectChangeType.primUS; updatehandler(localId, udata, this); break; @@ -11541,7 +11541,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP udata.position = new Vector3(block.Data, 0); udata.scale = new Vector3(block.Data, 12); - udata.what = ObjectChangeWhat.primPS; + udata.change = ObjectChangeType.primPS; updatehandler(localId, udata, this); break; @@ -11549,7 +11549,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP udata.position = new Vector3(block.Data, 0); udata.scale = new Vector3(block.Data, 12); - udata.what = ObjectChangeWhat.primPUS; + udata.change = ObjectChangeType.primPUS; updatehandler(localId, udata, this); break; @@ -11557,14 +11557,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP case 9: //( 8 + 1 )group position udata.position = new Vector3(block.Data, 0); - udata.what = ObjectChangeWhat.groupP; + udata.change = ObjectChangeType.groupP; updatehandler(localId, udata, this); break; case 0x0A: // (8 + 2) group rotation udata.rotation = new Quaternion(block.Data, 0, true); - udata.what = ObjectChangeWhat.groupR; + udata.change = ObjectChangeType.groupR; updatehandler(localId, udata, this); break; @@ -11572,7 +11572,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP udata.position = new Vector3(block.Data, 0); udata.rotation = new Quaternion(block.Data, 12, true); - udata.what = ObjectChangeWhat.groupPR; + udata.change = ObjectChangeType.groupPR; updatehandler(localId, udata, this); break; @@ -11583,8 +11583,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP udata.scale = new Vector3(block.Data, 0); - // udata.what = ObjectChangeWhat.groupS; - udata.what = ObjectChangeWhat.primS; // to conform to current SL + // udata.change = ObjectChangeType.groupS; + udata.change = ObjectChangeType.primS; // to conform to current SL updatehandler(localId, udata, this); break; @@ -11595,15 +11595,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP udata.position = new Vector3(block.Data, 0); udata.scale = new Vector3(block.Data, 12); - // udata.what = ObjectChangeWhat.groupPS; - udata.what = ObjectChangeWhat.primPS; // to conform to current SL + // udata.change = ObjectChangeType.groupPS; + udata.change = ObjectChangeType.primPS; // to conform to current SL updatehandler(localId, udata, this); break; case 0x1C: // (0x10 + 8 + 4 ) group scale UNIFORM udata.scale = new Vector3(block.Data, 0); - udata.what = ObjectChangeWhat.groupUS; + udata.change = ObjectChangeType.groupUS; updatehandler(localId, udata, this); break; @@ -11611,7 +11611,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP udata.position = new Vector3(block.Data, 0); udata.scale = new Vector3(block.Data, 12); - udata.what = ObjectChangeWhat.groupPUS; + udata.change = ObjectChangeType.groupPUS; updatehandler(localId, udata, this); break; -- cgit v1.1 From 3de3b9e63c07bc4b8e6c76d60167f9ead8a07f49 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 13 Mar 2012 17:56:32 +0000 Subject: initial suport for ExtraPhysical parts parameters. Reading from llclientView to SOP including SOPserialization (not to databases). No action on physics still. No send to viewer, etc --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 29 +++++++++++++++++++--- 1 file changed, 25 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 18af623..23beaec 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -7006,10 +7006,31 @@ namespace OpenSim.Region.ClientStack.LindenUDP // 46,47,48 are special positions within the packet // This may change so perhaps we need a better way // of storing this (OMV.FlagUpdatePacket.UsePhysics,etc?) - bool UsePhysics = (data[46] != 0) ? true : false; - bool IsTemporary = (data[47] != 0) ? true : false; - bool IsPhantom = (data[48] != 0) ? true : false; - handlerUpdatePrimFlags(flags.AgentData.ObjectLocalID, UsePhysics, IsTemporary, IsPhantom, this); + /* + bool UsePhysics = (data[46] != 0) ? true : false; + bool IsTemporary = (data[47] != 0) ? true : false; + bool IsPhantom = (data[48] != 0) ? true : false; + handlerUpdatePrimFlags(flags.AgentData.ObjectLocalID, UsePhysics, IsTemporary, IsPhantom, this); + */ + bool UsePhysics = flags.AgentData.UsePhysics; + bool IsPhantom = flags.AgentData.IsPhantom; + bool IsTemporary = flags.AgentData.IsTemporary; + ObjectFlagUpdatePacket.ExtraPhysicsBlock[] blocks = flags.ExtraPhysics; + ExtraPhysicsData physdata = new ExtraPhysicsData(); + + if (blocks == null || blocks.Length == 0) + { + physdata.PhysShapeType = PhysShapeType.invalid; + } + else + { + ObjectFlagUpdatePacket.ExtraPhysicsBlock phsblock = blocks[0]; + physdata.PhysShapeType = (PhysShapeType)phsblock.PhysicsShapeType; + physdata.Bounce = phsblock.Restitution; + physdata.Density = phsblock.Density; + physdata.Friction = phsblock.Friction; + } + handlerUpdatePrimFlags(flags.AgentData.ObjectLocalID, UsePhysics, IsTemporary, IsPhantom, physdata, this); } return true; } -- cgit v1.1 From cf9ebd301c32fa7cd991e78647ce011b0aefc796 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 14 Mar 2012 18:24:04 +0000 Subject: bug fixs, added a default physics shape estimator based on being a mesh or not and use it on unlink if new root part as type none. Viewer doesn't get updated even with fullupdates we are missing something still --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 23beaec..160a5d1 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -7029,7 +7029,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP physdata.Bounce = phsblock.Restitution; physdata.Density = phsblock.Density; physdata.Friction = phsblock.Friction; + physdata.GravitationModifier = phsblock.GravityMultiplier; } + handlerUpdatePrimFlags(flags.AgentData.ObjectLocalID, UsePhysics, IsTemporary, IsPhantom, physdata, this); } return true; -- cgit v1.1 From 84ca09f7c5cec051014181853083e52691bb7e07 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 15 Mar 2012 02:24:13 +0000 Subject: added ObjectPhysicsProperties http event message to send viewer that data. For now on caps/EventQueue, and still only used on a material change... --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 160a5d1..dd3b8aa 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -2609,6 +2609,34 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } + public void SendPartPhysicsProprieties(ISceneEntity entity) + { + SceneObjectPart part = (SceneObjectPart)entity; + if (part != null && AgentId != UUID.Zero) + { + try + { + IEventQueue eq = Scene.RequestModuleInterface(); + if (eq != null) + { + uint localid = part.LocalId; + byte physshapetype = part.PhysicsShapeType; + float density = part.Density; + float friction = part.Friction; + float bounce = part.Bounciness; + float gravmod = part.GravityModifier; + + eq.partPhysicsProperties(localid, physshapetype, density, friction, bounce, gravmod,AgentId); + } + } + catch (Exception ex) + { + m_log.Error("Unable to send part Physics Proprieties - exception: " + ex.ToString()); + } + } + } + + public void SendGroupNameReply(UUID groupLLUID, string GroupName) { -- cgit v1.1 From efd7ff31468755c7066c68fb6b5910f7b18aa3f0 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 20 Mar 2012 16:46:16 +0000 Subject: add some more notifications about changes on physical parameters ( still incomple and there should be a better away ) --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index dd3b8aa..ba5f4d5 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -2633,6 +2633,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { m_log.Error("Unable to send part Physics Proprieties - exception: " + ex.ToString()); } + part.UpdatePhysRequired = false; } } -- cgit v1.1 From 2a8b9a47b2bcb7ca1c4f96ee81c8d2ae0b4930eb Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 28 Mar 2012 01:15:56 +0200 Subject: Add SendRemoveInventoryFolders which allows to remove one or more folders from the viewer's inventory view. For HG v2.0. More to come --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 41 +++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index c40c0ec..557ab30 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -59,7 +59,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// Handles new client connections /// Constructor takes a single Packet and authenticates everything /// - public class LLClientView : IClientAPI, IClientCore, IClientIM, IClientChat, IClientIPEndpoint, IStatsCollector + public class LLClientView : IClientAPI, IClientCore, IClientIM, IClientChat, IClientInventory, IClientIPEndpoint, IStatsCollector { /// /// Debug packet level. See OpenSim.RegisterConsoleCommands() for more details. @@ -460,6 +460,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // DebugPacketLevel = 1; RegisterInterface(this); + RegisterInterface(this); RegisterInterface(this); RegisterInterface(this); @@ -12421,5 +12422,43 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (reply != null) OutPacket(reply, ThrottleOutPacketType.Task); } + + public void SendRemoveInventoryFolders(UUID[] folders) + { + IEventQueue eq = Scene.RequestModuleInterface(); + + if (eq == null) + { + m_log.DebugFormat("[LLCLIENT]: Null event queue"); + return; + } + + OSDMap llsd = new OSDMap(3); + + OSDMap AgentDataMap = new OSDMap(1); + AgentDataMap.Add("AgentID", OSD.FromUUID(AgentId)); + AgentDataMap.Add("SessionID", OSD.FromUUID(SessionId)); + + OSDArray AgentData = new OSDArray(1); + AgentData.Add(AgentDataMap); + + llsd.Add("AgentData", AgentData); + + OSDArray FolderData = new OSDArray(); + + foreach (UUID folder in folders) + { + OSDMap FolderDataMap = new OSDMap(2); + FolderDataMap.Add("FolderID", OSD.FromUUID(folder)); + FolderDataMap.Add("AgentID", OSD.FromUUID(AgentId)); + + FolderData.Add(FolderDataMap); + } + + llsd.Add("FolderData", FolderData); + + eq.Enqueue(BuildEvent("RemoveInventoryFolder", + llsd), AgentId); + } } } -- cgit v1.1 From 4ab63bfe978ce24c7a5621c9be568a0ec7254d58 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 28 Mar 2012 02:33:15 +0200 Subject: Typo fix --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 400757f..d0920d2 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -12541,7 +12541,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP foreach (InventoryItemBase item in items) { OSDMap ItemDataMap = new OSDMap(); - ItemData.Add(DataMap); + ItemData.Add(ItemDataMap); } llsd.Add("ItemData", ItemData); -- cgit v1.1 From 8728b9ea8164e9bdb8da384facff84c8f269df45 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 31 Mar 2012 01:34:39 +0200 Subject: Implement bulk inventory update over CAPS (not recursive by design, do NOT CHANGE THIS, needed for HG 2.0) --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 48 +++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 54fc7f4..1be282a 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -12455,7 +12455,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP ItemData.Add(ItemDataMap); } - llsd.Add("ItemData", ItemData); + llsd.Add("InventoryData", ItemData); eq.Enqueue(BuildEvent("RemoveInventoryItem", llsd), AgentId); @@ -12499,6 +12499,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP llsd), AgentId); } + private byte[] EncodeU32(uint val) + { + byte[] ret = BitConverter.GetBytes(val); + if (BitConverter.IsLittleEndian) + Array.Reverse(ret); + return ret; + } + public void SendBulkUpdateInventory(InventoryFolderBase[] folders, InventoryItemBase[] items) { IEventQueue eq = Scene.RequestModuleInterface(); @@ -12514,6 +12522,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP OSDMap AgentDataMap = new OSDMap(1); AgentDataMap.Add("AgentID", OSD.FromUUID(AgentId)); AgentDataMap.Add("SessionID", OSD.FromUUID(SessionId)); + AgentDataMap.Add("TransactionID", OSD.FromUUID(UUID.Random())); OSDArray AgentData = new OSDArray(1); AgentData.Add(AgentDataMap); @@ -12541,10 +12550,47 @@ namespace OpenSim.Region.ClientStack.LindenUDP foreach (InventoryItemBase item in items) { OSDMap ItemDataMap = new OSDMap(); + + ItemDataMap.Add("ItemID", OSD.FromUUID(item.ID)); + ItemDataMap.Add("FolderID", OSD.FromUUID(item.Folder)); + + ItemDataMap.Add("CreatorID", OSD.FromUUID(item.CreatorIdAsUuid)); + ItemDataMap.Add("OwnerID", OSD.FromUUID(item.Owner)); + ItemDataMap.Add("GroupID", OSD.FromUUID(item.GroupID)); + ItemDataMap.Add("BaseMask", OSD.FromBinary(EncodeU32((uint)item.BasePermissions))); + ItemDataMap.Add("OwnerMask", OSD.FromBinary(EncodeU32((uint)item.CurrentPermissions))); + ItemDataMap.Add("GroupMask", OSD.FromBinary(EncodeU32((uint)item.GroupPermissions))); + ItemDataMap.Add("EveryoneMask", OSD.FromBinary(EncodeU32((uint)item.EveryOnePermissions))); + ItemDataMap.Add("NextOwnerMask", OSD.FromBinary(EncodeU32((uint)item.NextPermissions))); + ItemDataMap.Add("GroupOwned", OSD.FromBoolean(item.GroupOwned)); + ItemDataMap.Add("AssetID", OSD.FromUUID(item.AssetID)); + ItemDataMap.Add("Type", OSD.FromInteger(item.AssetType)); + ItemDataMap.Add("InvType", OSD.FromInteger(item.InvType)); + ItemDataMap.Add("Flags", OSD.FromBinary(EncodeU32((uint)item.Flags))); + ItemDataMap.Add("SaleType", OSD.FromInteger((byte)item.SaleType)); + ItemDataMap.Add("SalePrice", OSD.FromInteger(item.SalePrice)); + ItemDataMap.Add("Name", OSD.FromString(item.Name)); + ItemDataMap.Add("Description", OSD.FromString(item.Description)); + ItemDataMap.Add("CreationDate", OSD.FromInteger(item.CreationDate)); + + ItemDataMap.Add("CRC", OSD.FromBinary(EncodeU32( + Helpers.InventoryCRC(1000, 0, (sbyte)item.InvType, + (sbyte)item.AssetType, item.AssetID, + item.GroupID, 100, + item.Owner, item.CreatorIdAsUuid, + item.ID, item.Folder, + (uint)PermissionMask.All, 1, (uint)PermissionMask.All, (uint)PermissionMask.All, + (uint)PermissionMask.All) + ))); + ItemDataMap.Add("CallbackID", 0); + ItemData.Add(ItemDataMap); } llsd.Add("ItemData", ItemData); + + eq.Enqueue(BuildEvent("BulkUpdateInventory", + llsd), AgentId); } } } -- cgit v1.1 From fd19601c6ba3b474201e2dde514c7d7c94e74e82 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 26 Apr 2012 16:17:46 +0100 Subject: Help big boobies to dance (avatar visualParams). May not persist and need more lobe ? --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 1004be6..40ebed1 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -3533,7 +3533,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP AvatarAppearancePacket avp = (AvatarAppearancePacket)PacketPool.Instance.GetPacket(PacketType.AvatarAppearance); // TODO: don't create new blocks if recycling an old packet - avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[218]; + avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[visualParams.Length]; avp.ObjectData.TextureEntry = textureEntry; AvatarAppearancePacket.VisualParamBlock avblock = null; -- cgit v1.1 From 74eafb78ebe854c5c36f489b92c8c68328e2a80d Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 7 May 2012 23:03:07 +0200 Subject: Fix moving no-mod objects. Fixes a regression introduced with the undo fix --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 40ebed1..bb76717 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -11631,8 +11631,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP udata.scale = new Vector3(block.Data, 0); - // udata.change = ObjectChangeType.groupS; - udata.change = ObjectChangeType.primS; // to conform to current SL + udata.change = ObjectChangeType.groupS; updatehandler(localId, udata, this); break; @@ -11643,8 +11642,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP udata.position = new Vector3(block.Data, 0); udata.scale = new Vector3(block.Data, 12); - // udata.change = ObjectChangeType.groupPS; - udata.change = ObjectChangeType.primPS; // to conform to current SL + udata.change = ObjectChangeType.groupPS; updatehandler(localId, udata, this); break; -- cgit v1.1 From 7461fe4554f8104212071e3e01b07786f8eb546f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 12 May 2012 15:27:37 +0100 Subject: ªTEST MESS* reduce animation packets send. Added onchangeanim event with parameters to define if to add or remove, and if to send anims pack on that evocation, etc --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index bb76717..7db6014 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -98,6 +98,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP public event AvatarPickerRequest OnAvatarPickerRequest; public event StartAnim OnStartAnim; public event StopAnim OnStopAnim; + public event ChangeAnim OnChangeAnim; public event Action OnRequestAvatarsData; public event LinkObjects OnLinkObjects; public event DelinkObjects OnDelinkObjects; @@ -6386,7 +6387,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP return true; } #endregion - +/* StartAnim handlerStartAnim = null; StopAnim handlerStopAnim = null; @@ -6410,6 +6411,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } return true; +*/ + ChangeAnim handlerChangeAnim = null; + + for (int i = 0; i < AgentAni.AnimationList.Length; i++) + { + handlerChangeAnim = OnChangeAnim; + if (handlerChangeAnim != null) + { + handlerChangeAnim(AgentAni.AnimationList[i].AnimID, AgentAni.AnimationList[i].StartAnim, false); + } + } + + handlerChangeAnim = OnChangeAnim; + if (handlerChangeAnim != null) + { + handlerChangeAnim(UUID.Zero, false, true); + } + + return true; } private bool HandleAgentRequestSit(IClientAPI sender, Packet Pack) -- cgit v1.1 From 7652b3a957f4e124c5142a3480fcc09a97e08be9 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 17 May 2012 13:13:31 +0100 Subject: udp transfer: make number packets estimation coerent with number actually sent. Use the safer lower max packet size defined in os source (600) and not OMV one (1100). --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 7db6014..2d46a5b 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -329,6 +329,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP private Prioritizer m_prioritizer; private bool m_disableFacelights = false; + private const uint MaxTransferBytesPerPacket = 600; + + /// /// List used in construction of data blocks for an object update packet. This is to stop us having to /// continually recreate it. @@ -2738,7 +2741,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP else { int processedLength = 0; - int maxChunkSize = Settings.MAX_PACKET_SIZE - 100; +// int maxChunkSize = Settings.MAX_PACKET_SIZE - 100; + + int maxChunkSize = (int) MaxTransferBytesPerPacket; int packetNumber = 0; while (processedLength < req.AssetInf.Data.Length) @@ -12202,7 +12207,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// private static int CalculateNumPackets(byte[] data) { - const uint m_maxPacketSize = 600; +// const uint m_maxPacketSize = 600; + uint m_maxPacketSize = MaxTransferBytesPerPacket; int numPackets = 1; if (data == null) -- cgit v1.1 From 4358bb8f850863aec8a519c6f533c298630dc1af Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 30 May 2012 00:50:47 +0200 Subject: Fix the log standing attach-from-world bug. --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 50 ++++++++++++++-------- 1 file changed, 32 insertions(+), 18 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 2d46a5b..5912a15 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -3761,24 +3761,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP { SceneObjectPart part = (SceneObjectPart)update.Entity; - // Please do not remove this unless you can demonstrate on the OpenSim mailing list that a client - // will never receive an update after a prim kill. Even then, keeping the kill record may be a good - // safety measure. - // - // If a Linden Lab 1.23.5 client (and possibly later and earlier) receives an object update - // after a kill, it will keep displaying the deleted object until relog. OpenSim currently performs - // updates and kills on different threads with different scheduling strategies, hence this protection. - // - // This doesn't appear to apply to child prims - a client will happily ignore these updates - // after the root prim has been deleted. - lock (m_killRecord) - { - if (m_killRecord.Contains(part.LocalId)) - continue; - if (m_killRecord.Contains(part.ParentGroup.RootPart.LocalId)) - continue; - } - if (part.ParentGroup.IsDeleted) continue; @@ -3816,7 +3798,39 @@ namespace OpenSim.Region.ClientStack.LindenUDP // attachments until the avatar becomes root. if (sp.IsChildAgent) continue; + + // If the object is an attachment we don't want it to be in the kill + // record. Else attaching from inworld and subsequently dropping + // it will no longer work. + lock (m_killRecord) + { + m_killRecord.Remove(part.LocalId); + m_killRecord.Remove(part.ParentGroup.RootPart.LocalId); + } } + else + { + // Please do not remove this unless you can demonstrate on the OpenSim mailing list that a client + // will never receive an update after a prim kill. Even then, keeping the kill record may be a good + // safety measure. + // + // If a Linden Lab 1.23.5 client (and possibly later and earlier) receives an object update + // after a kill, it will keep displaying the deleted object until relog. OpenSim currently performs + // updates and kills on different threads with different scheduling strategies, hence this protection. + // + // This doesn't appear to apply to child prims - a client will happily ignore these updates + // after the root prim has been deleted. + // + // We ignore this for attachments because attaching something from inworld breaks unless we do. + lock (m_killRecord) + { + if (m_killRecord.Contains(part.LocalId)) + continue; + if (m_killRecord.Contains(part.ParentGroup.RootPart.LocalId)) + continue; + } + } + if (part.ParentGroup.IsAttachment && m_disableFacelights) { if (part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.LeftHand && -- cgit v1.1 From 4b3cb91ce8e0250a22ae60bed738bc95414d1076 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 1 Jun 2012 00:12:04 +0200 Subject: Remove the kill record. Core has removed it long ago and it really does more harm than good these days --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 38 +++++++++++----------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 5912a15..77dbca7 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -346,7 +346,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// All manipulation of this set has to occur under an m_entityUpdates.SyncRoot lock /// /// - protected HashSet m_killRecord; +// protected HashSet m_killRecord; // protected HashSet m_attachmentsSent; @@ -472,7 +472,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_entityUpdates = new PriorityQueue(m_scene.Entities.Count); m_entityProps = new PriorityQueue(m_scene.Entities.Count); m_fullUpdateDataBlocksBuilder = new List(); - m_killRecord = new HashSet(); +// m_killRecord = new HashSet(); // m_attachmentsSent = new HashSet(); m_assetService = m_scene.RequestModuleInterface(); @@ -1574,17 +1574,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP // We MUST lock for both manipulating the kill record and sending the packet, in order to avoid a race // condition where a kill can be processed before an out-of-date update for the same object. // ProcessEntityUpdates() also takes the m_killRecord lock. - lock (m_killRecord) - { - foreach (uint localID in localIDs) - m_killRecord.Add(localID); +// lock (m_killRecord) +// { +// foreach (uint localID in localIDs) +// m_killRecord.Add(localID); // The throttle queue used here must match that being used for updates. Otherwise, there is a // chance that a kill packet put on a separate queue will be sent to the client before an existing // update packet on another queue. Receiving updates after kills results in unowned and undeletable // scene objects in a viewer until that viewer is relogged in. OutPacket(kill, ThrottleOutPacketType.Task); - } +// } } } @@ -3802,11 +3802,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP // If the object is an attachment we don't want it to be in the kill // record. Else attaching from inworld and subsequently dropping // it will no longer work. - lock (m_killRecord) - { - m_killRecord.Remove(part.LocalId); - m_killRecord.Remove(part.ParentGroup.RootPart.LocalId); - } +// lock (m_killRecord) +// { +// m_killRecord.Remove(part.LocalId); +// m_killRecord.Remove(part.ParentGroup.RootPart.LocalId); +// } } else { @@ -3822,13 +3822,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP // after the root prim has been deleted. // // We ignore this for attachments because attaching something from inworld breaks unless we do. - lock (m_killRecord) - { - if (m_killRecord.Contains(part.LocalId)) - continue; - if (m_killRecord.Contains(part.ParentGroup.RootPart.LocalId)) - continue; - } +// lock (m_killRecord) +// { +// if (m_killRecord.Contains(part.LocalId)) +// continue; +// if (m_killRecord.Contains(part.ParentGroup.RootPart.LocalId)) +// continue; +// } } if (part.ParentGroup.IsAttachment && m_disableFacelights) -- cgit v1.1 From 34cb8a2ab3189952cb74a16cf5246a2da3847b7c Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 6 Jun 2012 20:35:00 +0200 Subject: Fix not sending TransferInfo when an asset is not found. This clogs up the sound pipeline in the viewer. --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 33 +++++++++++++++++++--- 1 file changed, 29 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 9895402..18d8045 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -2777,6 +2777,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } + public void SendAssetNotFound(AssetRequestToClient req) + { + TransferInfoPacket Transfer = new TransferInfoPacket(); + Transfer.TransferInfo.ChannelType = 2; + Transfer.TransferInfo.Status = -2; + Transfer.TransferInfo.TargetType = 0; + Transfer.TransferInfo.Params = req.Params; + Transfer.TransferInfo.Size = 0; + Transfer.TransferInfo.TransferID = req.TransferRequestID; + Transfer.Header.Zerocoded = true; + OutPacket(Transfer, ThrottleOutPacketType.Asset); + } + public void SendTexture(AssetBase TextureAsset) { @@ -12181,14 +12194,27 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// protected void AssetReceived(string id, Object sender, AssetBase asset) { - if (asset == null) - return; - TransferRequestPacket transferRequest = (TransferRequestPacket)sender; UUID requestID = UUID.Zero; byte source = (byte)SourceType.Asset; + AssetRequestToClient req = new AssetRequestToClient(); + + if (asset == null) + { + req.AssetInf = null; + req.AssetRequestSource = source; + req.IsTextureRequest = false; + req.NumPackets = 0; + req.Params = transferRequest.TransferInfo.Params; + req.RequestAssetID = requestID; + req.TransferRequestID = transferRequest.TransferInfo.TransferID; + + SendAssetNotFound(req); + return; + } + if (transferRequest.TransferInfo.SourceType == (int)SourceType.Asset) { requestID = new UUID(transferRequest.TransferInfo.Params, 0); @@ -12205,7 +12231,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP return; // The asset is known to exist and is in our cache, so add it to the AssetRequests list - AssetRequestToClient req = new AssetRequestToClient(); req.AssetInf = asset; req.AssetRequestSource = source; req.IsTextureRequest = false; -- cgit v1.1 From 095dbf0ece0aab1812d04695a17bff86720ab6ac Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 6 Jun 2012 20:35:00 +0200 Subject: Fix not sending TransferInfo when an asset is not found. This clogs up the sound pipeline in the viewer. --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 33 +++++++++++++++++++--- 1 file changed, 29 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 77dbca7..5a87958 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -2777,6 +2777,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } + public void SendAssetNotFound(AssetRequestToClient req) + { + TransferInfoPacket Transfer = new TransferInfoPacket(); + Transfer.TransferInfo.ChannelType = 2; + Transfer.TransferInfo.Status = -2; + Transfer.TransferInfo.TargetType = 0; + Transfer.TransferInfo.Params = req.Params; + Transfer.TransferInfo.Size = 0; + Transfer.TransferInfo.TransferID = req.TransferRequestID; + Transfer.Header.Zerocoded = true; + OutPacket(Transfer, ThrottleOutPacketType.Asset); + } + public void SendTexture(AssetBase TextureAsset) { @@ -12178,14 +12191,27 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// protected void AssetReceived(string id, Object sender, AssetBase asset) { - if (asset == null) - return; - TransferRequestPacket transferRequest = (TransferRequestPacket)sender; UUID requestID = UUID.Zero; byte source = (byte)SourceType.Asset; + AssetRequestToClient req = new AssetRequestToClient(); + + if (asset == null) + { + req.AssetInf = null; + req.AssetRequestSource = source; + req.IsTextureRequest = false; + req.NumPackets = 0; + req.Params = transferRequest.TransferInfo.Params; + req.RequestAssetID = requestID; + req.TransferRequestID = transferRequest.TransferInfo.TransferID; + + SendAssetNotFound(req); + return; + } + if (transferRequest.TransferInfo.SourceType == (int)SourceType.Asset) { requestID = new UUID(transferRequest.TransferInfo.Params, 0); @@ -12202,7 +12228,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP return; // The asset is known to exist and is in our cache, so add it to the AssetRequests list - AssetRequestToClient req = new AssetRequestToClient(); req.AssetInf = asset; req.AssetRequestSource = source; req.IsTextureRequest = false; -- cgit v1.1 From ba58d7a9b2dc1233e46006a20b8924788cbb53db Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 22 Jun 2012 18:04:12 +0100 Subject: add a temp debug message --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 75f783b..3d3fb8e 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -717,7 +717,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP udpClient = ((LLClientView)client).UDPClient; if (!udpClient.IsConnected) + { + m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet for a unConnected client in " + m_scene.RegionInfo.RegionName); return; + } #endregion Packet to Client Mapping -- cgit v1.1 From 646b7fb8f2e285945b70a657674e5c3dac84b931 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 22 Jun 2012 18:10:53 +0100 Subject: i more debug --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 3d3fb8e..c64b5f2 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -710,7 +710,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP IClientAPI client; if (!m_scene.TryGetClient(address, out client) || !(client is LLClientView)) { - //m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName); + m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName); return; } -- cgit v1.1 From 0de3ad530713324d23ac513e7a317a2acd539a22 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 22 Jun 2012 18:18:12 +0100 Subject: more debug --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 5a87958..80b6f64 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -6402,6 +6402,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP { handlerCompleteMovementToRegion(sender, true); } + else + m_log.Debug("HandleCompleteAgentMovement NULL handler"); + handlerCompleteMovementToRegion = null; return true; -- cgit v1.1 From 1468b01afc9defab4cde690293bd368cb73cd437 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 22 Jun 2012 18:29:46 +0100 Subject: coment out some of previus debug messaged before forgetting about them... --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index c64b5f2..bd8273d 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -710,7 +710,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP IClientAPI client; if (!m_scene.TryGetClient(address, out client) || !(client is LLClientView)) { - m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName); +// m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName); return; } @@ -718,7 +718,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (!udpClient.IsConnected) { - m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet for a unConnected client in " + m_scene.RegionInfo.RegionName); +// m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet for a unConnected client in " + m_scene.RegionInfo.RegionName); return; } -- cgit v1.1 From 38cdf77cef4964bb9eac9ccefb30334cd6737e9d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 29 Jun 2012 03:41:04 +0100 Subject: in CreateAvatarUpdateBlock() change updateflags to 0. Original flags seem prim related only. This does fix the wrong viewer side move of a avatar in prim edition mode (anv mantis 854), with no apparent side effects .. may need more testing --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 80b6f64..9c96b52 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -5078,10 +5078,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP update.TextureEntry = Utils.EmptyBytes; // update.TextureEntry = (data.Appearance.Texture != null) ? data.Appearance.Texture.GetBytes() : Utils.EmptyBytes; +/* all this flags seem related to prims and not avatars. This allow for wrong viewer side move of a avatar in prim edition mode (anv mantis 854) update.UpdateFlags = (uint)( PrimFlags.Physics | PrimFlags.ObjectModify | PrimFlags.ObjectCopy | PrimFlags.ObjectAnyOwner | PrimFlags.ObjectYouOwner | PrimFlags.ObjectMove | PrimFlags.InventoryEmpty | PrimFlags.ObjectTransfer | PrimFlags.ObjectOwnerModify); +*/ + update.UpdateFlags = 0; return update; } -- cgit v1.1 From e3fa73da96f5612da52d140425f1633494d6edef Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 15 Jul 2012 17:17:59 +0200 Subject: Experimentally handle UseCircuitCode synchrnonously --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index bd8273d..56c0992 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -701,7 +701,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP { object[] array = new object[] { buffer, packet }; - Util.FireAndForget(HandleUseCircuitCode, array); + //Util.FireAndForget(HandleUseCircuitCode, array); + HandleUseCircuitCode(array); return; } -- cgit v1.1 From 8b4f7604e618ed409cd4dcb44dcf14ce22b72be7 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 15 Jul 2012 19:45:08 +0200 Subject: Revert "Experimentally handle UseCircuitCode synchrnonously" This reverts commit e3fa73da96f5612da52d140425f1633494d6edef. --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 56c0992..bd8273d 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -701,8 +701,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { object[] array = new object[] { buffer, packet }; - //Util.FireAndForget(HandleUseCircuitCode, array); - HandleUseCircuitCode(array); + Util.FireAndForget(HandleUseCircuitCode, array); return; } -- cgit v1.1 From 283df0610de50f77460f980ba15e4cbb23f5b657 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 15 Jul 2012 21:45:06 +0200 Subject: Save packets received while the client is added and replay them later. --- .../Region/ClientStack/Linden/UDP/LLUDPServer.cs | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index bd8273d..34923be 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -153,6 +153,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// Flag to signal when clients should send pings private bool m_sendPing; + private ExpiringCache> m_pendingCache = new ExpiringCache>(); + private int m_defaultRTO = 0; private int m_maxRTO = 0; @@ -701,6 +703,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP { object[] array = new object[] { buffer, packet }; + lock (m_pendingCache) + m_pendingCache.AddOrUpdate(address, new Queue(), 60); Util.FireAndForget(HandleUseCircuitCode, array); return; @@ -710,6 +714,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP IClientAPI client; if (!m_scene.TryGetClient(address, out client) || !(client is LLClientView)) { + lock (m_pendingCache) + { + Queue queue; + if (m_pendingCache.TryGetValue(address, out queue)) + queue.Enqueue(buffer); + } + // m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName); return; } @@ -943,6 +954,27 @@ namespace OpenSim.Region.ClientStack.LindenUDP // We only want to send initial data to new clients, not ones which are being converted from child to root. if (client != null) client.SceneAgent.SendInitialDataToMe(); + + // Now we know we can handle more data + Thread.Sleep(200); + + // Obtain the queue and remove it from the cache + Queue queue = null; + + lock (m_pendingCache) + { + if (!m_pendingCache.TryGetValue(remoteEndPoint, out queue)) + return; + m_pendingCache.Remove(remoteEndPoint); + } + + // Reinject queued packets + while(queue.Count > 0) + { + UDPPacketBuffer buf = queue.Dequeue(); + PacketReceived(buf); + } + queue = null; } else { @@ -950,6 +982,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_log.WarnFormat( "[LLUDPSERVER]: Connection request for client {0} connecting with unnotified circuit code {1} from {2}", uccp.CircuitCode.ID, uccp.CircuitCode.Code, remoteEndPoint); + lock (m_pendingCache) + m_pendingCache.Remove(remoteEndPoint); } // m_log.DebugFormat( -- cgit v1.1 From b130dcea21130b65a3dbe400b0c50e1f5e461972 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 15 Jul 2012 22:28:47 +0200 Subject: Testing changes and instrumentation --- .../Region/ClientStack/Linden/UDP/LLUDPServer.cs | 23 +++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 34923be..c807260 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -701,10 +701,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP // UseCircuitCode handling if (packet.Type == PacketType.UseCircuitCode) { - object[] array = new object[] { buffer, packet }; - lock (m_pendingCache) + { + if (m_pendingCache.Contains(address)) + return; + m_pendingCache.AddOrUpdate(address, new Queue(), 60); + } + + object[] array = new object[] { buffer, packet }; + Util.FireAndForget(HandleUseCircuitCode, array); return; @@ -718,10 +724,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP { Queue queue; if (m_pendingCache.TryGetValue(address, out queue)) + { + m_log.DebugFormat("[LLUDPSERVER]: Enqueued a {0} packet into the pending queue", packet.Type); queue.Enqueue(buffer); + } + else + { + m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName); + } } -// m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName); return; } @@ -964,10 +976,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP lock (m_pendingCache) { if (!m_pendingCache.TryGetValue(remoteEndPoint, out queue)) + { + m_log.DebugFormat("[LLUDPSERVER]: Client created but no pending queue present"); return; + } m_pendingCache.Remove(remoteEndPoint); } + m_log.DebugFormat("[LLUDPSERVER]: Client created, processing pending queue, {0} entries", queue.Count); + // Reinject queued packets while(queue.Count > 0) { -- cgit v1.1 From 668723fab31976895ceb42a372cfff7ed5689a9d Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 15 Jul 2012 23:01:58 +0200 Subject: Remove instrumentation and fix the message delivery issue --- .../Region/ClientStack/Linden/UDP/LLUDPServer.cs | 52 ++++++++++++---------- 1 file changed, 28 insertions(+), 24 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index c807260..46337b3 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -698,42 +698,46 @@ namespace OpenSim.Region.ClientStack.LindenUDP #region Packet to Client Mapping - // UseCircuitCode handling - if (packet.Type == PacketType.UseCircuitCode) + // If there is already a client for this endpoint, don't process UseCircuitCode + IClientAPI client = null; + if (!m_scene.TryGetClient(address, out client)) { - lock (m_pendingCache) + // UseCircuitCode handling + if (packet.Type == PacketType.UseCircuitCode) { - if (m_pendingCache.Contains(address)) - return; + // And if there is a UseCircuitCode pending, also drop it + lock (m_pendingCache) + { + if (m_pendingCache.Contains(address)) + return; - m_pendingCache.AddOrUpdate(address, new Queue(), 60); - } + m_pendingCache.AddOrUpdate(address, new Queue(), 60); + } - object[] array = new object[] { buffer, packet }; + object[] array = new object[] { buffer, packet }; - Util.FireAndForget(HandleUseCircuitCode, array); + Util.FireAndForget(HandleUseCircuitCode, array); - return; + return; + } } - // Determine which agent this packet came from - IClientAPI client; - if (!m_scene.TryGetClient(address, out client) || !(client is LLClientView)) + // If this is a pending connection, enqueue, don't process yet + lock (m_pendingCache) { - lock (m_pendingCache) + Queue queue; + if (m_pendingCache.TryGetValue(address, out queue)) { - Queue queue; - if (m_pendingCache.TryGetValue(address, out queue)) - { - m_log.DebugFormat("[LLUDPSERVER]: Enqueued a {0} packet into the pending queue", packet.Type); - queue.Enqueue(buffer); - } - else - { - m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName); - } + //m_log.DebugFormat("[LLUDPSERVER]: Enqueued a {0} packet into the pending queue", packet.Type); + queue.Enqueue(buffer); + return; } + } + // Determine which agent this packet came from + if (client == null || !(client is LLClientView)) + { + //m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName); return; } -- cgit v1.1 From 1b81a2bd49beda587e805281e9e0b28dce033310 Mon Sep 17 00:00:00 2001 From: ubit Date: Sun, 15 Jul 2012 23:54:24 +0200 Subject: to stash --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index bd8273d..c64b5f2 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -710,7 +710,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP IClientAPI client; if (!m_scene.TryGetClient(address, out client) || !(client is LLClientView)) { -// m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName); + m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName); return; } @@ -718,7 +718,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (!udpClient.IsConnected) { -// m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet for a unConnected client in " + m_scene.RegionInfo.RegionName); + m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet for a unConnected client in " + m_scene.RegionInfo.RegionName); return; } -- cgit v1.1 From cdd03acffa930ad9d23dc5a6c3af778c0f79567b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 15 Jul 2012 23:37:31 +0100 Subject: just a kick git --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 46337b3..ddfad82 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -25,6 +25,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ + using System; using System.Collections.Generic; using System.Diagnostics; -- cgit v1.1 From 5c145aa539b8190be994873a1bb9f32bfacdaa77 Mon Sep 17 00:00:00 2001 From: ubit Date: Mon, 16 Jul 2012 00:43:35 +0200 Subject: merge fix --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 15 --------------- 1 file changed, 15 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 9b9ccba..a7740b9 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -726,15 +726,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP // If this is a pending connection, enqueue, don't process yet lock (m_pendingCache) { -<<<<<<< HEAD -<<<<<<< HEAD - m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName); -======= - lock (m_pendingCache) -======= Queue queue; if (m_pendingCache.TryGetValue(address, out queue)) ->>>>>>> 15a1ad393c3748c5c911beac981945a9bd8b200d { //m_log.DebugFormat("[LLUDPSERVER]: Enqueued a {0} packet into the pending queue", packet.Type); queue.Enqueue(buffer); @@ -742,18 +735,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } -<<<<<<< HEAD -<<<<<<< HEAD -// m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName); ->>>>>>> 2606484e45138adef289386509b1e27552a32aee -======= ->>>>>>> 0baa1b557af20af3590737dc04294a9bdc8e8728 -======= // Determine which agent this packet came from if (client == null || !(client is LLClientView)) { //m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName); ->>>>>>> 15a1ad393c3748c5c911beac981945a9bd8b200d return; } -- cgit v1.1 From 3149eca68fce6f9662fa8b84e80f2b880f537414 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 15 Jul 2012 23:45:47 +0100 Subject: backkick git --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 1 - 1 file changed, 1 deletion(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index ddfad82..46337b3 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -25,7 +25,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - using System; using System.Collections.Generic; using System.Diagnostics; -- cgit v1.1 From ce8b9e6c570f73a5c70dfc2b52bbb595637b717d Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 19 Jul 2012 12:27:36 +0200 Subject: Fix slow loading of task inventory --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index e6289bd..ad9074c 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -2122,16 +2122,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP replytask.InventoryData.TaskID = taskID; replytask.InventoryData.Serial = serial; replytask.InventoryData.Filename = fileName; - OutPacket(replytask, ThrottleOutPacketType.Asset); + OutPacket(replytask, ThrottleOutPacketType.Task); } - public void SendXferPacket(ulong xferID, uint packet, byte[] data) + public void SendXferPacket(ulong xferID, uint packet, byte[] data, bool isTaskInventory) { + ThrottleOutPacketType type = ThrottleOutPacketType.Asset; + if (isTaskInventory) + type = ThrottleOutPacketType.Task; + SendXferPacketPacket sendXfer = (SendXferPacketPacket)PacketPool.Instance.GetPacket(PacketType.SendXferPacket); sendXfer.XferID.ID = xferID; sendXfer.XferID.Packet = packet; sendXfer.DataPacket.Data = data; - OutPacket(sendXfer, ThrottleOutPacketType.Asset); + OutPacket(sendXfer, type); } public void SendAbortXferPacket(ulong xferID) -- cgit v1.1 From b1b3057adcc4f4acdf8207ea2733e6400cf7143a Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 21 Jul 2012 20:56:19 +0200 Subject: Fix double-ping on logout by not sending a stop packet to the client if the client told us it wants to log out in the first place. --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 79e35f4..f5f9c02 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -1516,7 +1516,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (!client.IsLoggingOut) { client.IsLoggingOut = true; - client.Close(); + client.Close(false); } } } -- cgit v1.1 From d677db338d8cfe8de5db5f279cd3638510b360c9 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 3 Aug 2012 15:22:53 +0200 Subject: Remove a merge artefaci in IsActive handling and restore commented out correct one --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 1304e16..1410cf6 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -517,7 +517,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// public void Close(bool sendStop) { -// IsActive = false; // We lock here to prevent race conditions between two threads calling close simultaneously (e.g. // a simultaneous relog just as a client is being closed out due to no packet ack from the old connection. lock (CloseSyncLock) @@ -525,7 +524,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (!IsActive) return; -// IsActive = false; + IsActive = false; CloseWithoutChecks(sendStop); } } -- cgit v1.1 From b8ba224b4f920a1c5f89acb13100d6568cbc3d1c Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 3 Aug 2012 15:33:30 +0200 Subject: Remove another superflouous IsActive set --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 2 -- 1 file changed, 2 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 1410cf6..8cac731 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -551,8 +551,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP OutPacket(disable, ThrottleOutPacketType.Unknown); } -// IsActive = false; - // Shutdown the image manager ImageManager.Close(); -- cgit v1.1 From 879d1cefb8c18a899d76b2e63843166d4710378c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 3 Aug 2012 15:19:31 +0100 Subject: clientview IsActive use is broken. Suspend it's use keeping it true ( to review later) --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index f7bb817..1304e16 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -517,7 +517,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// public void Close(bool sendStop) { - IsActive = false; +// IsActive = false; // We lock here to prevent race conditions between two threads calling close simultaneously (e.g. // a simultaneous relog just as a client is being closed out due to no packet ack from the old connection. lock (CloseSyncLock) @@ -525,7 +525,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (!IsActive) return; - IsActive = false; +// IsActive = false; CloseWithoutChecks(sendStop); } } @@ -552,7 +552,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP OutPacket(disable, ThrottleOutPacketType.Unknown); } - IsActive = false; +// IsActive = false; // Shutdown the image manager ImageManager.Close(); -- cgit v1.1 From 5273b6880a9682a57798c5808e04b7dc6dca8c0f Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 21 Aug 2012 21:20:20 +0200 Subject: Allow updates sent for right pec to go to the client --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 8cac731..ddd8f18 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -3809,7 +3809,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 > 30) continue; ScenePresence sp; // Owner is not in the sim, don't update it to -- cgit v1.1 From 378a79e7cc6be3191dea41b617c05febd7ee5cbe Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 28 Aug 2012 22:17:17 +0200 Subject: Add a queue with two priority levels. This is a drop in replacement for the BlockingQueue from OMV, but allows two priorities. --- .../Region/ClientStack/Linden/UDP/LLUDPServer.cs | 113 ++++++++++++++++++++- 1 file changed, 111 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 7042c9a..f9ba14c 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -110,7 +110,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// Handlers for incoming packets //PacketEventDictionary packetEvents = new PacketEventDictionary(); /// Incoming packets that are awaiting handling - private OpenMetaverse.BlockingQueue packetInbox = new OpenMetaverse.BlockingQueue(); + //private OpenMetaverse.BlockingQueue packetInbox = new OpenMetaverse.BlockingQueue(); + + private DoubleQueue packetInbox = new DoubleQueue(); + /// //private UDPClientCollection m_clients = new UDPClientCollection(); /// Bandwidth throttle for this UDP server @@ -919,7 +922,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP #endregion Ping Check Handling // Inbox insertion - packetInbox.Enqueue(new IncomingPacket((LLClientView)client, packet)); + if (packet.Type == PacketType.AgentUpdate || + packet.Type == PacketType.ChatFromViewer) + packetInbox.EnqueueHigh(new IncomingPacket((LLClientView)client, packet)); + else + packetInbox.EnqueueLow(new IncomingPacket((LLClientView)client, packet)); } #region BinaryStats @@ -1519,4 +1526,106 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } } + + internal class DoubleQueue where T:class + { + private Queue m_lowQueue = new Queue(); + private Queue m_highQueue = new Queue(); + + private object m_syncRoot = new object(); + private Semaphore m_s = new Semaphore(0, 1); + + public DoubleQueue() + { + } + + public virtual int Count + { + get { return m_highQueue.Count + m_lowQueue.Count; } + } + + public virtual void Enqueue(T data) + { + Enqueue(m_lowQueue, data); + } + + public virtual void EnqueueLow(T data) + { + Enqueue(m_lowQueue, data); + } + + public virtual void EnqueueHigh(T data) + { + Enqueue(m_highQueue, data); + } + + private void Enqueue(Queue q, T data) + { + lock (m_syncRoot) + { + m_lowQueue.Enqueue(data); + m_s.WaitOne(0); + m_s.Release(); + } + } + + public virtual T Dequeue() + { + return Dequeue(Timeout.Infinite); + } + + public virtual T Dequeue(int tmo) + { + return Dequeue(TimeSpan.FromMilliseconds(tmo)); + } + + public virtual T Dequeue(TimeSpan wait) + { + T res = null; + + if (!Dequeue(wait, ref res)) + return null; + + return res; + } + + public bool Dequeue(int timeout, ref T res) + { + return Dequeue(TimeSpan.FromMilliseconds(timeout), ref res); + } + + public bool Dequeue(TimeSpan wait, ref T res) + { + if (!m_s.WaitOne(wait)) + return false; + + lock (m_syncRoot) + { + if (m_highQueue.Count > 0) + res = m_highQueue.Dequeue(); + else + res = m_lowQueue.Dequeue(); + + if (m_highQueue.Count == 0 || m_lowQueue.Count == 0) + return true; + + m_s.Release(); + + return true; + } + } + + public virtual void Clear() + { + + lock (m_syncRoot) + { + // Make sure sem count is 0 + m_s.WaitOne(0); + + m_lowQueue.Clear(); + m_highQueue.Clear(); + } + } + } } -- cgit v1.1 From 34f069493894654d23c18550182561a93ec023b0 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 29 Aug 2012 11:35:21 +0200 Subject: Remove Justin's addition to avoid sending incoming packets to inactive clients This also causes the initial AgentUpdate to be rejected because our processing is asynchronous. --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index f9ba14c..c817e44 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -1478,8 +1478,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP Packet packet = incomingPacket.Packet; LLClientView client = incomingPacket.Client; - if (client.IsActive) - { +// if (client.IsActive) +// { m_currentIncomingClient = client; try @@ -1506,13 +1506,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP { m_currentIncomingClient = null; } - } - else - { - m_log.DebugFormat( - "[LLUDPSERVER]: Dropped incoming {0} for dead client {1} in {2}", - packet.Type, client.Name, m_scene.RegionInfo.RegionName); - } +// } +// else +// { +// m_log.DebugFormat( +// "[LLUDPSERVER]: Dropped incoming {0} for dead client {1} in {2}", +// packet.Type, client.Name, m_scene.RegionInfo.RegionName); +// } } protected void LogoutHandler(IClientAPI client) -- cgit v1.1 From 74465df43f7ee92f44ba65c19c01e02fa1f13e98 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 29 Aug 2012 11:45:28 +0200 Subject: Fix issue with the quit packet being stuck int he queue and a one packet delay. Also fix semaphore excetion caused by enqueueing while dequque is taking place. --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index c817e44..75a47d5 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -1606,10 +1606,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP else res = m_lowQueue.Dequeue(); - if (m_highQueue.Count == 0 || m_lowQueue.Count == 0) + if (m_highQueue.Count == 0 && m_lowQueue.Count == 0) return true; - m_s.Release(); + try + { + m_s.Release(); + } + catch + { + } return true; } -- cgit v1.1 From 211f4fb4114b2b26abe9c056bca9f6159ccbd125 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 30 Aug 2012 00:34:12 +0200 Subject: Sequence inventory descendents requests to reduce inventory server load and movement lag. --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 75a47d5..d6513c5 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -927,6 +927,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP packetInbox.EnqueueHigh(new IncomingPacket((LLClientView)client, packet)); else packetInbox.EnqueueLow(new IncomingPacket((LLClientView)client, packet)); +// packetInbox.Enqueue(new IncomingPacket((LLClientView)client, packet)); } #region BinaryStats -- cgit v1.1 From d4fad2ba42445f72b8a04378b21818ec82ab1089 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 4 Sep 2012 07:32:03 +0100 Subject: a forgotten file plus minor changes. Imp and SL viewer seem to preserve flight. FS 4.2.2 does not. --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index ddd8f18..e78ebed 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -808,7 +808,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP handshake.RegionInfo3.ProductName = Util.StringToBytes256(regionInfo.RegionType); handshake.RegionInfo3.ProductSKU = Utils.EmptyBytes; - OutPacket(handshake, ThrottleOutPacketType.Task); +// OutPacket(handshake, ThrottleOutPacketType.Task); + // use same as MoveAgentIntoRegion (both should be task ) + OutPacket(handshake, ThrottleOutPacketType.Unknown); } public void MoveAgentIntoRegion(RegionInfo regInfo, Vector3 pos, Vector3 look) -- cgit v1.1 From a91ca984d57a4177ff31898e384ee85948d4eff1 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 8 Sep 2012 12:22:40 +0100 Subject: llClientView: try to have only one thread per client processing RegionHandleRequests. (code assumes packet handle is called async as it is not) --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 53 ++++++++++++++++++++-- 1 file changed, 49 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index e78ebed..7749ef3 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -8751,16 +8751,61 @@ namespace OpenSim.Region.ClientStack.LindenUDP #region Parcel related packets + // acumulate several HandleRegionHandleRequest consecutive overlaping requests + // to be done with minimal resources as possible + // variables temporary here while in test + + Queue RegionHandleRequests = new Queue(); + bool RegionHandleRequestsInService = false; + private bool HandleRegionHandleRequest(IClientAPI sender, Packet Pack) { - RegionHandleRequestPacket rhrPack = (RegionHandleRequestPacket)Pack; + UUID currentUUID; RegionHandleRequest handlerRegionHandleRequest = OnRegionHandleRequest; - if (handlerRegionHandleRequest != null) + + if (handlerRegionHandleRequest == null) + return true; + + RegionHandleRequestPacket rhrPack = (RegionHandleRequestPacket)Pack; + + lock (RegionHandleRequests) + { + if (RegionHandleRequestsInService) + { + // we are already busy doing a previus request + // so enqueue it + RegionHandleRequests.Enqueue(rhrPack.RequestBlock.RegionID); + return true; + } + + // else do it + currentUUID = rhrPack.RequestBlock.RegionID; + RegionHandleRequestsInService = true; + } + + while (true) { - handlerRegionHandleRequest(this, rhrPack.RequestBlock.RegionID); + handlerRegionHandleRequest(this, currentUUID); + + lock (RegionHandleRequests) + { + // exit condition, nothing to do or closed + // current code seems to assume we may loose the handler at anytime, + // so keep checking it + handlerRegionHandleRequest = OnRegionHandleRequest; + + if (RegionHandleRequests.Count == 0 || !IsActive || handlerRegionHandleRequest == null) + { + RegionHandleRequests.Clear(); + RegionHandleRequestsInService = false; + return true; + } + currentUUID = RegionHandleRequests.Dequeue(); + } } - return true; + + return true; // actually unreached } private bool HandleParcelInfoRequest(IClientAPI sender, Packet Pack) -- cgit v1.1 From ca67ee60ac0e0c26d6d32fc68d48ef63570f034d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 24 Sep 2012 21:22:08 +0100 Subject: add missing transactionID in SendInventoryItemCreateUpdate. and make use of it on inventoryAccessModule, etc. Most likelly it's needs where there is a transactionID not zero --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 7749ef3..ee28914 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -2067,9 +2067,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP OutPacket(bulkUpdate, ThrottleOutPacketType.Asset); } - /// IClientAPI.SendInventoryItemCreateUpdate(InventoryItemBase) public void SendInventoryItemCreateUpdate(InventoryItemBase Item, uint callbackId) { + SendInventoryItemCreateUpdate(Item, UUID.Zero, callbackId); + } + + /// IClientAPI.SendInventoryItemCreateUpdate(InventoryItemBase) + public void SendInventoryItemCreateUpdate(InventoryItemBase Item, UUID transactionID, uint callbackId) + { const uint FULL_MASK_PERMISSIONS = (uint)PermissionMask.All; UpdateCreateInventoryItemPacket InventoryReply @@ -2079,6 +2084,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // TODO: don't create new blocks if recycling an old packet InventoryReply.AgentData.AgentID = AgentId; InventoryReply.AgentData.SimApproved = true; + InventoryReply.AgentData.TransactionID = transactionID; InventoryReply.InventoryData = new UpdateCreateInventoryItemPacket.InventoryDataBlock[1]; InventoryReply.InventoryData[0] = new UpdateCreateInventoryItemPacket.InventoryDataBlock(); InventoryReply.InventoryData[0].ItemID = Item.ID; -- cgit v1.1 From 4fa088bafb4c78ad3177b0e944a4312bd6abdea7 Mon Sep 17 00:00:00 2001 From: teravus Date: Sun, 4 Nov 2012 22:57:24 -0500 Subject: Pipe Throttle Update Event to EventManager, client --> ScenePresence --> EventManager, so that modules can know when throttles are updated. The event contains no client specific data to preserve the possibility of 'multiple clients' and you must still call ControllingClient.GetThrottlesPacked(f) to see what the throttles actually are once the event fires. Hook EventManager.OnUpdateThrottle to GetTextureModule. --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index ee28914..ae9ed7f 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -295,6 +295,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP public event MuteListEntryRemove OnRemoveMuteListEntry; public event GodlikeMessage onGodlikeMessage; public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate; + public event GenericCall2 OnUpdateThrottles; #endregion Events @@ -6729,6 +6730,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP #endregion m_udpClient.SetThrottles(atpack.Throttle.Throttles); + GenericCall2 handler = OnUpdateThrottles; + if (handler != null) + { + handler(); + } return true; } @@ -11870,6 +11876,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP public void SetChildAgentThrottle(byte[] throttles) { m_udpClient.SetThrottles(throttles); + GenericCall2 handler = OnUpdateThrottles; + if (handler != null) + { + handler(); + } } /// -- cgit v1.1 From e9153e1d1aae50024d8cd05fe14a9bce34343a0e Mon Sep 17 00:00:00 2001 From: teravus Date: Thu, 15 Nov 2012 10:05:16 -0500 Subject: Revert "Merge master into teravuswork", it should have been avination, not master. This reverts commit dfac269032300872c4d0dc507f4f9062d102b0f4, reversing changes made to 619c39e5144f15aca129d6d999bcc5c34133ee64. --- .../ClientStack/Linden/UDP/IncomingPacket.cs | 7 +- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 169 ++++------- .../Region/ClientStack/Linden/UDP/LLUDPServer.cs | 338 +++------------------ .../ClientStack/Linden/UDP/OpenSimUDPBase.cs | 116 ++----- .../Region/ClientStack/Linden/UDP/PacketPool.cs | 316 ------------------- .../Linden/UDP/Tests/BasicCircuitTests.cs | 7 +- 6 files changed, 143 insertions(+), 810 deletions(-) delete mode 100644 OpenSim/Region/ClientStack/Linden/UDP/PacketPool.cs (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/IncomingPacket.cs b/OpenSim/Region/ClientStack/Linden/UDP/IncomingPacket.cs index e22670b..1b8535c 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/IncomingPacket.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/IncomingPacket.cs @@ -45,12 +45,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP public Packet Packet; /// - /// No arg constructor. - /// - public IncomingPacket() {} - - /// - /// Constructor + /// Default constructor /// /// Reference to the client this packet came from /// Packet data diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index c9aa4ca..ae9ed7f 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -47,7 +47,6 @@ using OpenSim.Region.Framework.Scenes; using OpenSim.Services.Interfaces; using Timer = System.Timers.Timer; using AssetLandmark = OpenSim.Framework.AssetLandmark; -using RegionFlags = OpenMetaverse.RegionFlags; using Nini.Config; using System.IO; @@ -356,17 +355,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP private bool m_deliverPackets = true; private int m_animationSequenceNumber = 1; private bool m_SendLogoutPacketWhenClosing = true; - - /// - /// We retain a single AgentUpdateArgs so that we can constantly reuse it rather than construct a new one for - /// every single incoming AgentUpdate. Every client sends 10 AgentUpdate UDP messages per second, even if it - /// is doing absolutely nothing. - /// - /// - /// This does mean that agent updates must be processed synchronously, at least for each client, and called methods - /// cannot retain a reference to it outside of that method. - /// - private AgentUpdateArgs m_lastAgentUpdateArgs; + private AgentUpdateArgs lastarg; protected Dictionary m_packetHandlers = new Dictionary(); protected Dictionary m_genericPacketHandlers = new Dictionary(); //PauPaw:Local Generic Message handlers @@ -521,18 +510,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// public void Close() { - Close(true, false); + Close(true); } - public void Close(bool sendStop, bool force) + /// + /// Shut down the client view + /// + public void Close(bool sendStop) { // We lock here to prevent race conditions between two threads calling close simultaneously (e.g. // a simultaneous relog just as a client is being closed out due to no packet ack from the old connection. lock (CloseSyncLock) { - // We still perform a force close inside the sync lock since this is intended to attempt close where - // there is some unidentified connection problem, not where we have issues due to deadlock - if (!IsActive && !force) + if (!IsActive) return; IsActive = false; @@ -847,9 +837,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP OutPacket(mov, ThrottleOutPacketType.Unknown); } - public void SendChatMessage( - string message, byte type, Vector3 fromPos, string fromName, - UUID fromAgentID, UUID ownerID, byte source, byte audible) + public void SendChatMessage(string message, byte type, Vector3 fromPos, string fromName, + UUID fromAgentID, byte source, byte audible) { ChatFromSimulatorPacket reply = (ChatFromSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.ChatFromSimulator); reply.ChatData.Audible = audible; @@ -858,7 +847,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP reply.ChatData.SourceType = source; reply.ChatData.Position = fromPos; reply.ChatData.FromName = Util.StringToBytes256(fromName); - reply.ChatData.OwnerID = ownerID; + reply.ChatData.OwnerID = fromAgentID; reply.ChatData.SourceID = fromAgentID; OutPacket(reply, ThrottleOutPacketType.Unknown); @@ -3996,8 +3985,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { List blocks = terseAgentUpdateBlocks.Value; - ImprovedTerseObjectUpdatePacket packet - = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate); + ImprovedTerseObjectUpdatePacket packet = new ImprovedTerseObjectUpdatePacket(); packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; packet.RegionData.TimeDilation = timeDilation; packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count]; @@ -4042,9 +4030,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { List blocks = terseUpdateBlocks.Value; - ImprovedTerseObjectUpdatePacket packet - = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket( - PacketType.ImprovedTerseObjectUpdate); + ImprovedTerseObjectUpdatePacket packet = new ImprovedTerseObjectUpdatePacket(); packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; packet.RegionData.TimeDilation = timeDilation; packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[blocks.Count]; @@ -4052,7 +4038,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP for (int i = 0; i < blocks.Count; i++) packet.ObjectData[i] = blocks[i]; - OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseUpdates.Value, oPacket); }); + OutPacket(packet, ThrottleOutPacketType.Task, true); } #endregion Packet Sending @@ -4549,7 +4535,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { returnblock[j] = new EstateOwnerMessagePacket.ParamListBlock(); } - j = 0; + j = 0; returnblock[j].Parameter = Utils.StringToBytes(estateID.ToString()); j++; returnblock[j].Parameter = Utils.StringToBytes(((int)Constants.EstateAccessCodex.EstateBans).ToString()); j++; @@ -5053,9 +5039,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP Utils.UInt16ToBytes(Utils.FloatToUInt16(angularVelocity.Y, -64.0f, 64.0f), data, pos); pos += 2; Utils.UInt16ToBytes(Utils.FloatToUInt16(angularVelocity.Z, -64.0f, 64.0f), data, pos); pos += 2; - ImprovedTerseObjectUpdatePacket.ObjectDataBlock block - = PacketPool.Instance.GetDataBlock(); - + ImprovedTerseObjectUpdatePacket.ObjectDataBlock block = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock(); block.Data = data; if (textureEntry != null && textureEntry.Length > 0) @@ -5305,18 +5289,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP protected virtual void RegisterLocalPacketHandlers() { AddLocalPacketHandler(PacketType.LogoutRequest, HandleLogout); - - // If AgentUpdate is ever handled asynchronously, then we will also need to construct a new AgentUpdateArgs - // for each AgentUpdate packet. AddLocalPacketHandler(PacketType.AgentUpdate, HandleAgentUpdate, false); - AddLocalPacketHandler(PacketType.ViewerEffect, HandleViewerEffect, false); AddLocalPacketHandler(PacketType.AgentCachedTexture, HandleAgentTextureCached, false); AddLocalPacketHandler(PacketType.MultipleObjectUpdate, HandleMultipleObjUpdate, false); AddLocalPacketHandler(PacketType.MoneyTransferRequest, HandleMoneyTransferRequest, false); AddLocalPacketHandler(PacketType.ParcelBuy, HandleParcelBuyRequest, false); - AddLocalPacketHandler(PacketType.UUIDGroupNameRequest, HandleUUIDGroupNameRequest); - AddLocalPacketHandler(PacketType.ObjectGroup, HandleObjectGroupRequest); + AddLocalPacketHandler(PacketType.UUIDGroupNameRequest, HandleUUIDGroupNameRequest, false); + AddLocalPacketHandler(PacketType.ObjectGroup, HandleObjectGroupRequest, false); AddLocalPacketHandler(PacketType.GenericMessage, HandleGenericMessage); AddLocalPacketHandler(PacketType.AvatarPropertiesRequest, HandleAvatarPropertiesRequest); AddLocalPacketHandler(PacketType.ChatFromViewer, HandleChatFromViewer); @@ -5538,84 +5518,81 @@ namespace OpenSim.Region.ClientStack.LindenUDP #region Scene/Avatar - private bool HandleAgentUpdate(IClientAPI sener, Packet packet) + private bool HandleAgentUpdate(IClientAPI sener, Packet Pack) { if (OnAgentUpdate != null) { - AgentUpdatePacket agentUpdate = (AgentUpdatePacket)packet; + bool update = false; + AgentUpdatePacket agenUpdate = (AgentUpdatePacket)Pack; #region Packet Session and User Check - if (agentUpdate.AgentData.SessionID != SessionId || agentUpdate.AgentData.AgentID != AgentId) - { - PacketPool.Instance.ReturnPacket(packet); + if (agenUpdate.AgentData.SessionID != SessionId || agenUpdate.AgentData.AgentID != AgentId) return false; - } #endregion - bool update = false; - AgentUpdatePacket.AgentDataBlock x = agentUpdate.AgentData; + AgentUpdatePacket.AgentDataBlock x = agenUpdate.AgentData; + + // We can only check when we have something to check + // against. - if (m_lastAgentUpdateArgs != null) + if (lastarg != null) { - // These should be ordered from most-likely to - // least likely to change. I've made an initial - // guess at that. update = ( - (x.BodyRotation != m_lastAgentUpdateArgs.BodyRotation) || - (x.CameraAtAxis != m_lastAgentUpdateArgs.CameraAtAxis) || - (x.CameraCenter != m_lastAgentUpdateArgs.CameraCenter) || - (x.CameraLeftAxis != m_lastAgentUpdateArgs.CameraLeftAxis) || - (x.CameraUpAxis != m_lastAgentUpdateArgs.CameraUpAxis) || - (x.ControlFlags != m_lastAgentUpdateArgs.ControlFlags) || + (x.BodyRotation != lastarg.BodyRotation) || + (x.CameraAtAxis != lastarg.CameraAtAxis) || + (x.CameraCenter != lastarg.CameraCenter) || + (x.CameraLeftAxis != lastarg.CameraLeftAxis) || + (x.CameraUpAxis != lastarg.CameraUpAxis) || + (x.ControlFlags != lastarg.ControlFlags) || (x.ControlFlags != 0) || - (x.Far != m_lastAgentUpdateArgs.Far) || - (x.Flags != m_lastAgentUpdateArgs.Flags) || - (x.State != m_lastAgentUpdateArgs.State) || - (x.HeadRotation != m_lastAgentUpdateArgs.HeadRotation) || - (x.SessionID != m_lastAgentUpdateArgs.SessionID) || - (x.AgentID != m_lastAgentUpdateArgs.AgentID) + (x.Far != lastarg.Far) || + (x.Flags != lastarg.Flags) || + (x.State != lastarg.State) || + (x.HeadRotation != lastarg.HeadRotation) || + (x.SessionID != lastarg.SessionID) || + (x.AgentID != lastarg.AgentID) ); } else { - m_lastAgentUpdateArgs = new AgentUpdateArgs(); update = true; } + // These should be ordered from most-likely to + // least likely to change. I've made an initial + // guess at that. + if (update) { // m_log.DebugFormat("[LLCLIENTVIEW]: Triggered AgentUpdate for {0}", sener.Name); - m_lastAgentUpdateArgs.AgentID = x.AgentID; - m_lastAgentUpdateArgs.BodyRotation = x.BodyRotation; - m_lastAgentUpdateArgs.CameraAtAxis = x.CameraAtAxis; - m_lastAgentUpdateArgs.CameraCenter = x.CameraCenter; - m_lastAgentUpdateArgs.CameraLeftAxis = x.CameraLeftAxis; - m_lastAgentUpdateArgs.CameraUpAxis = x.CameraUpAxis; - m_lastAgentUpdateArgs.ControlFlags = x.ControlFlags; - m_lastAgentUpdateArgs.Far = x.Far; - m_lastAgentUpdateArgs.Flags = x.Flags; - m_lastAgentUpdateArgs.HeadRotation = x.HeadRotation; - m_lastAgentUpdateArgs.SessionID = x.SessionID; - m_lastAgentUpdateArgs.State = x.State; - + AgentUpdateArgs arg = new AgentUpdateArgs(); + arg.AgentID = x.AgentID; + arg.BodyRotation = x.BodyRotation; + arg.CameraAtAxis = x.CameraAtAxis; + arg.CameraCenter = x.CameraCenter; + arg.CameraLeftAxis = x.CameraLeftAxis; + arg.CameraUpAxis = x.CameraUpAxis; + arg.ControlFlags = x.ControlFlags; + arg.Far = x.Far; + arg.Flags = x.Flags; + arg.HeadRotation = x.HeadRotation; + arg.SessionID = x.SessionID; + arg.State = x.State; UpdateAgent handlerAgentUpdate = OnAgentUpdate; UpdateAgent handlerPreAgentUpdate = OnPreAgentUpdate; - + lastarg = arg; // save this set of arguments for nexttime if (handlerPreAgentUpdate != null) - OnPreAgentUpdate(this, m_lastAgentUpdateArgs); - + OnPreAgentUpdate(this, arg); if (handlerAgentUpdate != null) - OnAgentUpdate(this, m_lastAgentUpdateArgs); + OnAgentUpdate(this, arg); handlerAgentUpdate = null; handlerPreAgentUpdate = null; } } - PacketPool.Instance.ReturnPacket(packet); - return true; } @@ -5987,8 +5964,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP msgpack.MessageBlock.ID, msgpack.MessageBlock.Offline != 0 ? true : false, msgpack.MessageBlock.Position, - msgpack.MessageBlock.BinaryBucket, - true); + msgpack.MessageBlock.BinaryBucket); handlerInstantMessage(this, im); } @@ -9275,9 +9251,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } #endregion - string method = Utils.BytesToString(messagePacket.MethodData.Method); - - switch (method) + switch (Utils.BytesToString(messagePacket.MethodData.Method)) { case "getinfo": if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false)) @@ -9593,17 +9567,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP return true; default: - m_log.WarnFormat( - "[LLCLIENTVIEW]: EstateOwnerMessage: Unknown method {0} requested for {1} in {2}", - method, Name, Scene.Name); - - for (int i = 0; i < messagePacket.ParamList.Length; i++) - { - EstateOwnerMessagePacket.ParamListBlock block = messagePacket.ParamList[i]; - string data = (string)Utils.BytesToString(block.Parameter); - m_log.DebugFormat("[LLCLIENTVIEW]: Param {0}={1}", i, data); - } - + m_log.Error("EstateOwnerMessage: Unknown method requested\n" + messagePacket); return true; } @@ -11996,7 +11960,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP logPacket = false; if (DebugPacketLevel <= 50 - && (packet.Type == PacketType.ImprovedTerseObjectUpdate || packet.Type == PacketType.ObjectUpdate)) + & (packet.Type == PacketType.ImprovedTerseObjectUpdate || packet.Type == PacketType.ObjectUpdate)) logPacket = false; if (DebugPacketLevel <= 25 && packet.Type == PacketType.ObjectPropertiesFamily) @@ -12070,6 +12034,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (!ProcessPacketMethod(packet)) m_log.Warn("[CLIENT]: unhandled packet " + packet.Type); + + PacketPool.Instance.ReturnPacket(packet); } private static PrimitiveBaseShape GetShapeFromAddPacket(ObjectAddPacket addPacket) @@ -12238,7 +12204,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { Kick(reason); Thread.Sleep(1000); - Disconnect(); + Close(); } public void Disconnect() @@ -12526,10 +12492,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP ushort timeDilation = Utils.FloatToUInt16(TIME_DILATION, 0.0f, 1.0f); - ImprovedTerseObjectUpdatePacket packet - = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket( - PacketType.ImprovedTerseObjectUpdate); - + ImprovedTerseObjectUpdatePacket packet = new ImprovedTerseObjectUpdatePacket(); packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; packet.RegionData.TimeDilation = timeDilation; packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index b8951d9..d6513c5 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -37,7 +37,6 @@ using log4net; using Nini.Config; using OpenMetaverse.Packets; using OpenSim.Framework; -using OpenSim.Framework.Console; using OpenSim.Framework.Monitoring; using OpenSim.Region.Framework.Scenes; using OpenMetaverse; @@ -101,11 +100,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// The measured resolution of Environment.TickCount public readonly float TickCountResolution; - /// Number of prim updates to put on the queue each time the /// OnQueueEmpty event is triggered for updates public readonly int PrimUpdatesPerCallback; - /// Number of texture packets to put on the queue each time the /// OnQueueEmpty event is triggered for textures public readonly int TextureSendLimit; @@ -127,37 +124,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// Manages authentication for agent circuits private AgentCircuitManager m_circuitManager; - /// Reference to the scene this UDP server is attached to protected Scene m_scene; - /// The X/Y coordinates of the scene this UDP server is attached to private Location m_location; - /// The size of the receive buffer for the UDP socket. This value /// is passed up to the operating system and used in the system networking /// stack. Use zero to leave this value as the default private int m_recvBufferSize; - /// Flag to process packets asynchronously or synchronously private bool m_asyncPacketHandling; - /// Tracks whether or not a packet was sent each round so we know /// whether or not to sleep private bool m_packetSent; /// Environment.TickCount of the last time that packet stats were reported to the scene private int m_elapsedMSSinceLastStatReport = 0; - /// Environment.TickCount of the last time the outgoing packet handler executed private int m_tickLastOutgoingPacketHandler; - /// Keeps track of the number of elapsed milliseconds since the last time the outgoing packet handler looped private int m_elapsedMSOutgoingPacketHandler; - /// Keeps track of the number of 100 millisecond periods elapsed in the outgoing packet handler executed private int m_elapsed100MSOutgoingPacketHandler; - /// Keeps track of the number of 500 millisecond periods elapsed in the outgoing packet handler executed private int m_elapsed500MSOutgoingPacketHandler; @@ -171,9 +159,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP protected bool m_sendPing; private ExpiringCache> m_pendingCache = new ExpiringCache>(); - private Pool m_incomingPacketPool; - - private Stat m_incomingPacketPoolStat; private int m_defaultRTO = 0; private int m_maxRTO = 0; @@ -195,9 +180,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// private IClientAPI m_currentIncomingClient; - public LLUDPServer( - IPAddress listenIP, ref uint port, int proxyPortOffsetParm, bool allow_alternate_port, - IConfigSource configSource, AgentCircuitManager circuitManager) + public LLUDPServer(IPAddress listenIP, ref uint port, int proxyPortOffsetParm, bool allow_alternate_port, IConfigSource configSource, AgentCircuitManager circuitManager) : base(listenIP, (int)port) { #region Environment.TickCount Measurement @@ -219,7 +202,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_circuitManager = circuitManager; int sceneThrottleBps = 0; - bool usePools = false; IConfig config = configSource.Configs["ClientStack.LindenUDP"]; if (config != null) @@ -245,16 +227,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_pausedAckTimeout = 1000 * 300; // 5 minutes } - // FIXME: This actually only needs to be done once since the PacketPool is shared across all servers. - // However, there is no harm in temporarily doing it multiple times. - IConfig packetConfig = configSource.Configs["PacketPool"]; - if (packetConfig != null) - { - PacketPool.Instance.RecyclePackets = packetConfig.GetBoolean("RecyclePackets", true); - PacketPool.Instance.RecycleDataBlocks = packetConfig.GetBoolean("RecycleDataBlocks", true); - usePools = packetConfig.GetBoolean("RecycleBaseUDPPackets", usePools); - } - #region BinaryStats config = configSource.Configs["Statistics.Binary"]; m_shouldCollectStats = false; @@ -282,28 +254,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_throttle = new TokenBucket(null, sceneThrottleBps); ThrottleRates = new ThrottleRates(configSource); - - if (usePools) - EnablePools(); } public void Start() { - StartInbound(); - StartOutbound(); + if (m_scene == null) + throw new InvalidOperationException("[LLUDPSERVER]: Cannot LLUDPServer.Start() without an IScene reference"); - m_elapsedMSSinceLastStatReport = Environment.TickCount; - } - - private void StartInbound() - { m_log.InfoFormat( - "[LLUDPSERVER]: Starting inbound packet processing for the LLUDP server in {0} mode with UsePools = {1}", - m_asyncPacketHandling ? "asynchronous" : "synchronous", UsePools); + "[LLUDPSERVER]: Starting the LLUDP server in {0} mode", + m_asyncPacketHandling ? "asynchronous" : "synchronous"); - base.StartInbound(m_recvBufferSize, m_asyncPacketHandling); + base.Start(m_recvBufferSize, m_asyncPacketHandling); - // This thread will process the packets received that are placed on the packetInbox + // Start the packet processing threads Watchdog.StartThread( IncomingPacketHandler, string.Format("Incoming Packets ({0})", m_scene.RegionInfo.RegionName), @@ -312,13 +276,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP true, GetWatchdogIncomingAlarmData, Watchdog.DEFAULT_WATCHDOG_TIMEOUT_MS); - } - - private new void StartOutbound() - { - m_log.Info("[LLUDPSERVER]: Starting outbound packet processing for the LLUDP server"); - - base.StartOutbound(); Watchdog.StartThread( OutgoingPacketHandler, @@ -328,57 +285,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP true, GetWatchdogOutgoingAlarmData, Watchdog.DEFAULT_WATCHDOG_TIMEOUT_MS); - } - - public void Stop() - { - m_log.Info("[LLUDPSERVER]: Shutting down the LLUDP server for " + m_scene.RegionInfo.RegionName); - base.StopOutbound(); - base.StopInbound(); - } - protected override bool EnablePools() - { - if (!UsePools) - { - base.EnablePools(); - - m_incomingPacketPool = new Pool(() => new IncomingPacket(), 500); - - m_incomingPacketPoolStat - = new Stat( - "IncomingPacketPoolCount", - "Objects within incoming packet pool", - "The number of objects currently stored within the incoming packet pool", - "", - "clientstack", - "packetpool", - StatType.Pull, - stat => stat.Value = m_incomingPacketPool.Count, - StatVerbosity.Debug); - - StatsManager.RegisterStat(m_incomingPacketPoolStat); - - return true; - } - - return false; - } - - protected override bool DisablePools() - { - if (UsePools) - { - base.DisablePools(); - - StatsManager.DeregisterStat(m_incomingPacketPoolStat); - - // We won't null out the pool to avoid a race condition with code that may be in the middle of using it. - - return true; - } - - return false; + m_elapsedMSSinceLastStatReport = Environment.TickCount; } /// @@ -403,6 +311,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_currentOutgoingClient != null ? m_currentOutgoingClient.Name : "none"); } + public new void Stop() + { + m_log.Info("[LLUDPSERVER]: Shutting down the LLUDP server for " + m_scene.RegionInfo.RegionName); + base.Stop(); + } + public void AddScene(IScene scene) { if (m_scene != null) @@ -419,117 +333,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_scene = (Scene)scene; m_location = new Location(m_scene.RegionInfo.RegionHandle); - - MainConsole.Instance.Commands.AddCommand( - "Debug", - false, - "debug lludp start", - "debug lludp start ", - "Control LLUDP packet processing.", - "No effect if packet processing has already started.\n" - + "in - start inbound processing.\n" - + "out - start outbound processing.\n" - + "all - start in and outbound processing.\n", - HandleStartCommand); - - MainConsole.Instance.Commands.AddCommand( - "Debug", - false, - "debug lludp stop", - "debug lludp stop ", - "Stop LLUDP packet processing.", - "No effect if packet processing has already stopped.\n" - + "in - stop inbound processing.\n" - + "out - stop outbound processing.\n" - + "all - stop in and outbound processing.\n", - HandleStopCommand); - - MainConsole.Instance.Commands.AddCommand( - "Debug", - false, - "debug lludp pool", - "debug lludp pool ", - "Turn object pooling within the lludp component on or off.", - HandlePoolCommand); - - MainConsole.Instance.Commands.AddCommand( - "Debug", - false, - "debug lludp status", - "debug lludp status", - "Return status of LLUDP packet processing.", - HandleStatusCommand); - } - - private void HandleStartCommand(string module, string[] args) - { - if (args.Length != 4) - { - MainConsole.Instance.Output("Usage: debug lludp start "); - return; - } - - string subCommand = args[3]; - - if (subCommand == "in" || subCommand == "all") - StartInbound(); - - if (subCommand == "out" || subCommand == "all") - StartOutbound(); - } - - private void HandleStopCommand(string module, string[] args) - { - if (args.Length != 4) - { - MainConsole.Instance.Output("Usage: debug lludp stop "); - return; - } - - string subCommand = args[3]; - - if (subCommand == "in" || subCommand == "all") - StopInbound(); - - if (subCommand == "out" || subCommand == "all") - StopOutbound(); - } - - private void HandlePoolCommand(string module, string[] args) - { - if (args.Length != 4) - { - MainConsole.Instance.Output("Usage: debug lludp pool "); - return; - } - - string enabled = args[3]; - - if (enabled == "on") - { - if (EnablePools()) - MainConsole.Instance.OutputFormat("Packet pools enabled on {0}", m_scene.Name); - } - else if (enabled == "off") - { - if (DisablePools()) - MainConsole.Instance.OutputFormat("Packet pools disabled on {0}", m_scene.Name); - } - else - { - MainConsole.Instance.Output("Usage: debug lludp pool "); - } - } - - private void HandleStatusCommand(string module, string[] args) - { - MainConsole.Instance.OutputFormat( - "IN LLUDP packet processing for {0} is {1}", m_scene.Name, IsRunningInbound ? "enabled" : "disabled"); - - MainConsole.Instance.OutputFormat( - "OUT LLUDP packet processing for {0} is {1}", m_scene.Name, IsRunningOutbound ? "enabled" : "disabled"); - - MainConsole.Instance.OutputFormat("LLUDP pools in {0} are {1}", m_scene.Name, UsePools ? "on" : "off"); } public bool HandlesRegion(Location x) @@ -613,8 +416,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP byte[] data = packet.ToBytes(); SendPacketData(udpClient, data, packet.Type, category, method); } - - PacketPool.Instance.ReturnPacket(packet); } /// @@ -899,7 +700,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP LLUDPClient udpClient = null; Packet packet = null; int packetEnd = buffer.DataLength - 1; - IPEndPoint endPoint = (IPEndPoint)buffer.RemoteEndPoint; + IPEndPoint address = (IPEndPoint)buffer.RemoteEndPoint; #region Decoding @@ -909,7 +710,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // "[LLUDPSERVER]: Dropping undersized packet with {0} bytes received from {1} in {2}", // buffer.DataLength, buffer.RemoteEndPoint, m_scene.RegionInfo.RegionName); - return; // Drop undersized packet + return; // Drop undersizd packet } int headerLen = 7; @@ -932,13 +733,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP try { -// packet = Packet.BuildPacket(buffer.Data, ref packetEnd, -// // Only allocate a buffer for zerodecoding if the packet is zerocoded -// ((buffer.Data[0] & Helpers.MSG_ZEROCODED) != 0) ? new byte[4096] : null); - // If OpenSimUDPBase.UsePool == true (which is currently separate from the PacketPool) then we - // assume that packet construction does not retain a reference to byte[] buffer.Data (instead, all - // bytes are copied out). - packet = PacketPool.Instance.GetPacket(buffer.Data, ref packetEnd, + packet = Packet.BuildPacket(buffer.Data, ref packetEnd, // Only allocate a buffer for zerodecoding if the packet is zerocoded ((buffer.Data[0] & Helpers.MSG_ZEROCODED) != 0) ? new byte[4096] : null); } @@ -953,13 +748,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP return; // Drop short packet } - catch (Exception e) + catch(Exception e) { if (m_malformedCount < 100) m_log.DebugFormat("[LLUDPSERVER]: Dropped malformed packet: " + e.ToString()); - m_malformedCount++; - if ((m_malformedCount % 100000) == 0) m_log.DebugFormat("[LLUDPSERVER]: Received {0} malformed packets so far, probable network attack.", m_malformedCount); } @@ -979,7 +772,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // If there is already a client for this endpoint, don't process UseCircuitCode IClientAPI client = null; - if (!m_scene.TryGetClient(endPoint, out client) || !(client is LLClientView)) + if (!m_scene.TryGetClient(address, out client)) { // UseCircuitCode handling if (packet.Type == PacketType.UseCircuitCode) @@ -987,15 +780,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP // And if there is a UseCircuitCode pending, also drop it lock (m_pendingCache) { - if (m_pendingCache.Contains(endPoint)) + if (m_pendingCache.Contains(address)) return; - m_pendingCache.AddOrUpdate(endPoint, new Queue(), 60); + m_pendingCache.AddOrUpdate(address, new Queue(), 60); } - // We need to copy the endpoint so that it doesn't get changed when another thread reuses the - // buffer. - object[] array = new object[] { new IPEndPoint(endPoint.Address, endPoint.Port), packet }; + object[] array = new object[] { buffer, packet }; Util.FireAndForget(HandleUseCircuitCode, array); @@ -1007,7 +798,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP lock (m_pendingCache) { Queue queue; - if (m_pendingCache.TryGetValue(endPoint, out queue)) + if (m_pendingCache.TryGetValue(address, out queue)) { //m_log.DebugFormat("[LLUDPSERVER]: Enqueued a {0} packet into the pending queue", packet.Type); queue.Enqueue(buffer); @@ -1043,10 +834,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Handle appended ACKs if (packet.Header.AppendedAcks && packet.Header.AckList != null) { -// m_log.DebugFormat( -// "[LLUDPSERVER]: Handling {0} appended acks from {1} in {2}", -// packet.Header.AckList.Length, client.Name, m_scene.Name); - for (int i = 0; i < packet.Header.AckList.Length; i++) udpClient.NeedAcks.Acknowledge(packet.Header.AckList[i], now, packet.Header.Resent); } @@ -1056,10 +843,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP { PacketAckPacket ackPacket = (PacketAckPacket)packet; -// m_log.DebugFormat( -// "[LLUDPSERVER]: Handling {0} packet acks for {1} in {2}", -// ackPacket.Packets.Length, client.Name, m_scene.Name); - for (int i = 0; i < ackPacket.Packets.Length; i++) udpClient.NeedAcks.Acknowledge(ackPacket.Packets[i].ID, now, packet.Header.Resent); @@ -1073,10 +856,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (packet.Header.Reliable) { -// m_log.DebugFormat( -// "[LLUDPSERVER]: Adding ack request for {0} {1} from {2} in {3}", -// packet.Type, packet.Header.Sequence, client.Name, m_scene.Name); - udpClient.PendingAcks.Enqueue(packet.Header.Sequence); // This is a somewhat odd sequence of steps to pull the client.BytesSinceLastACK value out, @@ -1123,8 +902,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (packet.Type == PacketType.StartPingCheck) { -// m_log.DebugFormat("[LLUDPSERVER]: Handling ping from {0} in {1}", client.Name, m_scene.Name); - // We don't need to do anything else with ping checks StartPingCheckPacket startPing = (StartPingCheckPacket)packet; CompletePing(udpClient, startPing.PingID.PingID); @@ -1144,25 +921,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP #endregion Ping Check Handling - IncomingPacket incomingPacket; - // Inbox insertion - if (UsePools) - { - incomingPacket = m_incomingPacketPool.GetObject(); - incomingPacket.Client = (LLClientView)client; - incomingPacket.Packet = packet; - } - else - { - incomingPacket = new IncomingPacket((LLClientView)client, packet); - } - - if (incomingPacket.Packet.Type == PacketType.AgentUpdate || - incomingPacket.Packet.Type == PacketType.ChatFromViewer) - packetInbox.EnqueueHigh(incomingPacket); + if (packet.Type == PacketType.AgentUpdate || + packet.Type == PacketType.ChatFromViewer) + packetInbox.EnqueueHigh(new IncomingPacket((LLClientView)client, packet)); else - packetInbox.EnqueueLow(incomingPacket); + packetInbox.EnqueueLow(new IncomingPacket((LLClientView)client, packet)); +// packetInbox.Enqueue(new IncomingPacket((LLClientView)client, packet)); } #region BinaryStats @@ -1248,19 +1013,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP private void HandleUseCircuitCode(object o) { - IPEndPoint endPoint = null; + IPEndPoint remoteEndPoint = null; IClientAPI client = null; try { // DateTime startTime = DateTime.Now; object[] array = (object[])o; - endPoint = (IPEndPoint)array[0]; + UDPPacketBuffer buffer = (UDPPacketBuffer)array[0]; UseCircuitCodePacket uccp = (UseCircuitCodePacket)array[1]; m_log.DebugFormat( "[LLUDPSERVER]: Handling UseCircuitCode request for circuit {0} to {1} from IP {2}", - uccp.CircuitCode.Code, m_scene.RegionInfo.RegionName, endPoint); + uccp.CircuitCode.Code, m_scene.RegionInfo.RegionName, buffer.RemoteEndPoint); + + remoteEndPoint = (IPEndPoint)buffer.RemoteEndPoint; AuthenticateResponse sessionInfo; if (IsClientAuthorized(uccp, out sessionInfo)) @@ -1271,13 +1038,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP uccp.CircuitCode.Code, uccp.CircuitCode.ID, uccp.CircuitCode.SessionID, - endPoint, + remoteEndPoint, sessionInfo); // Send ack straight away to let the viewer know that the connection is active. // The client will be null if it already exists (e.g. if on a region crossing the client sends a use // circuit code to the existing child agent. This is not particularly obvious. - SendAckImmediate(endPoint, uccp.Header.Sequence); + SendAckImmediate(remoteEndPoint, uccp.Header.Sequence); // We only want to send initial data to new clients, not ones which are being converted from child to root. if (client != null) @@ -1291,12 +1058,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP lock (m_pendingCache) { - if (!m_pendingCache.TryGetValue(endPoint, out queue)) + if (!m_pendingCache.TryGetValue(remoteEndPoint, out queue)) { m_log.DebugFormat("[LLUDPSERVER]: Client created but no pending queue present"); return; } - m_pendingCache.Remove(endPoint); + m_pendingCache.Remove(remoteEndPoint); } m_log.DebugFormat("[LLUDPSERVER]: Client created, processing pending queue, {0} entries", queue.Count); @@ -1314,9 +1081,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Don't create clients for unauthorized requesters. m_log.WarnFormat( "[LLUDPSERVER]: Ignoring connection request for {0} to {1} with unknown circuit code {2} from IP {3}", - uccp.CircuitCode.ID, m_scene.RegionInfo.RegionName, uccp.CircuitCode.Code, endPoint); + uccp.CircuitCode.ID, m_scene.RegionInfo.RegionName, uccp.CircuitCode.Code, remoteEndPoint); lock (m_pendingCache) - m_pendingCache.Remove(endPoint); + m_pendingCache.Remove(remoteEndPoint); } // m_log.DebugFormat( @@ -1328,7 +1095,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { m_log.ErrorFormat( "[LLUDPSERVER]: UseCircuitCode handling from endpoint {0}, client {1} {2} failed. Exception {3}{4}", - endPoint != null ? endPoint.ToString() : "n/a", + remoteEndPoint != null ? remoteEndPoint.ToString() : "n/a", client != null ? client.Name : "unknown", client != null ? client.AgentId.ToString() : "unknown", e.Message, @@ -1393,20 +1160,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP { IClientAPI client = null; - // We currently synchronize this code across the whole scene to avoid issues such as - // http://opensimulator.org/mantis/view.php?id=5365 However, once locking per agent circuit can be done - // consistently, this lock could probably be removed. - lock (this) + // In priciple there shouldn't be more than one thread here, ever. + // But in case that happens, we need to synchronize this piece of code + // because it's too important + lock (this) { if (!m_scene.TryGetClient(agentID, out client)) { LLUDPClient udpClient = new LLUDPClient(this, ThrottleRates, m_throttle, circuitCode, agentID, remoteEndPoint, m_defaultRTO, m_maxRTO); - + client = new LLClientView(m_scene, this, udpClient, sessionInfo, agentID, sessionID, circuitCode); client.OnLogout += LogoutHandler; - + ((LLClientView)client).DisableFacelights = m_disableFacelights; - + client.Start(); } } @@ -1445,7 +1212,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // on to en-US to avoid number parsing issues Culture.SetCurrentCulture(); - while (IsRunningInbound) + while (base.IsRunning) { m_scene.ThreadAlive(1); try @@ -1461,12 +1228,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } if (packetInbox.Dequeue(100, ref incomingPacket)) - { ProcessInPacket(incomingPacket);//, incomingPacket); Util.FireAndForget(ProcessInPacket, incomingPacket); - - if (UsePools) - m_incomingPacketPool.ReturnObject(incomingPacket); - } } catch (Exception ex) { @@ -1493,7 +1255,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Action generic every round Action clientPacketHandler = ClientOutgoingPacketHandler; - while (base.IsRunningOutbound) + while (base.IsRunning) { m_scene.ThreadAlive(2); try @@ -1761,7 +1523,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (!client.IsLoggingOut) { client.IsLoggingOut = true; - client.Close(false, false); + client.Close(false); } } } diff --git a/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs index 8bd3461..cfe7c9d 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs @@ -30,8 +30,6 @@ using System.Net; using System.Net.Sockets; using System.Threading; using log4net; -using OpenSim.Framework; -using OpenSim.Framework.Monitoring; namespace OpenMetaverse { @@ -60,31 +58,17 @@ namespace OpenMetaverse /// Flag to process packets asynchronously or synchronously private bool m_asyncPacketHandling; - /// - /// Pool to use for handling data. May be null if UsePools = false; - /// - protected OpenSim.Framework.Pool m_pool; - - /// - /// Are we to use object pool(s) to reduce memory churn when receiving data? - /// - public bool UsePools { get; protected set; } - - /// Returns true if the server is currently listening for inbound packets, otherwise false - public bool IsRunningInbound { get; private set; } + /// The all important shutdown flag + private volatile bool m_shutdownFlag = true; - /// Returns true if the server is currently sending outbound packets, otherwise false - /// If IsRunningOut = false, then any request to send a packet is simply dropped. - public bool IsRunningOutbound { get; private set; } - - private Stat m_poolCountStat; + /// Returns true if the server is currently listening, otherwise false + public bool IsRunning { get { return !m_shutdownFlag; } } /// /// Default constructor /// /// Local IP address to bind the server to /// Port to listening for incoming UDP packets on - /// /// Are we to use an object pool to get objects for handing inbound data? public OpenSimUDPBase(IPAddress bindAddress, int port) { m_localBindAddress = bindAddress; @@ -92,7 +76,7 @@ namespace OpenMetaverse } /// - /// Start inbound UDP packet handling. + /// Start the UDP server /// /// The size of the receive buffer for /// the UDP socket. This value is passed up to the operating system @@ -107,11 +91,11 @@ namespace OpenMetaverse /// manner (not throwing an exception when the remote side resets the /// connection). This call is ignored on Mono where the flag is not /// necessary - public void StartInbound(int recvBufferSize, bool asyncPacketHandling) + public void Start(int recvBufferSize, bool asyncPacketHandling) { m_asyncPacketHandling = asyncPacketHandling; - if (!IsRunningInbound) + if (m_shutdownFlag) { const int SIO_UDP_CONNRESET = -1744830452; @@ -139,7 +123,8 @@ namespace OpenMetaverse m_udpSocket.Bind(ipep); - IsRunningInbound = true; + // we're not shutting down, we're starting up + m_shutdownFlag = false; // kick off an async receive. The Start() method will return, the // actual receives will occur asynchronously and will be caught in @@ -149,84 +134,28 @@ namespace OpenMetaverse } /// - /// Start outbound UDP packet handling. + /// Stops the UDP server /// - public void StartOutbound() - { - IsRunningOutbound = true; - } - - public void StopInbound() + public void Stop() { - if (IsRunningInbound) + if (!m_shutdownFlag) { // wait indefinitely for a writer lock. Once this is called, the .NET runtime // will deny any more reader locks, in effect blocking all other send/receive - // threads. Once we have the lock, we set IsRunningInbound = false to inform the other + // threads. Once we have the lock, we set shutdownFlag to inform the other // threads that the socket is closed. - IsRunningInbound = false; + m_shutdownFlag = true; m_udpSocket.Close(); } } - public void StopOutbound() - { - IsRunningOutbound = false; - } - - protected virtual bool EnablePools() - { - if (!UsePools) - { - m_pool = new Pool(() => new UDPPacketBuffer(), 500); - - m_poolCountStat - = new Stat( - "UDPPacketBufferPoolCount", - "Objects within the UDPPacketBuffer pool", - "The number of objects currently stored within the UDPPacketBuffer pool", - "", - "clientstack", - "packetpool", - StatType.Pull, - stat => stat.Value = m_pool.Count, - StatVerbosity.Debug); - - StatsManager.RegisterStat(m_poolCountStat); - - UsePools = true; - - return true; - } - - return false; - } - - protected virtual bool DisablePools() - { - if (UsePools) - { - UsePools = false; - StatsManager.DeregisterStat(m_poolCountStat); - - // We won't null out the pool to avoid a race condition with code that may be in the middle of using it. - - return true; - } - - return false; - } - private void AsyncBeginReceive() { - UDPPacketBuffer buf; - - if (UsePools) - buf = m_pool.GetObject(); - else - buf = new UDPPacketBuffer(); + // allocate a packet buffer + //WrappedObject wrappedBuffer = Pool.CheckOut(); + UDPPacketBuffer buf = new UDPPacketBuffer(); - if (IsRunningInbound) + if (!m_shutdownFlag) { try { @@ -279,7 +208,7 @@ namespace OpenMetaverse { // Asynchronous receive operations will complete here through the call // to AsyncBeginReceive - if (IsRunningInbound) + if (!m_shutdownFlag) { // Asynchronous mode will start another receive before the // callback for this packet is even fired. Very parallel :-) @@ -288,6 +217,8 @@ namespace OpenMetaverse // get the buffer that was created in AsyncBeginReceive // this is the received data + //WrappedObject wrappedBuffer = (WrappedObject)iar.AsyncState; + //UDPPacketBuffer buffer = wrappedBuffer.Instance; UDPPacketBuffer buffer = (UDPPacketBuffer)iar.AsyncState; try @@ -304,8 +235,7 @@ namespace OpenMetaverse catch (ObjectDisposedException) { } finally { - if (UsePools) - m_pool.ReturnObject(buffer); + //wrappedBuffer.Dispose(); // Synchronous mode waits until the packet callback completes // before starting the receive to fetch another packet @@ -318,7 +248,7 @@ namespace OpenMetaverse public void AsyncBeginSend(UDPPacketBuffer buf) { - if (IsRunningOutbound) + if (!m_shutdownFlag) { try { diff --git a/OpenSim/Region/ClientStack/Linden/UDP/PacketPool.cs b/OpenSim/Region/ClientStack/Linden/UDP/PacketPool.cs deleted file mode 100644 index 9f22fb4..0000000 --- a/OpenSim/Region/ClientStack/Linden/UDP/PacketPool.cs +++ /dev/null @@ -1,316 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using System.Reflection; -using OpenMetaverse; -using OpenMetaverse.Packets; -using log4net; -using OpenSim.Framework.Monitoring; - -namespace OpenSim.Region.ClientStack.LindenUDP -{ - public sealed class PacketPool - { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - private static readonly PacketPool instance = new PacketPool(); - - private bool packetPoolEnabled = true; - private bool dataBlockPoolEnabled = true; - - private PercentageStat m_packetsReusedStat = new PercentageStat( - "PacketsReused", - "Packets reused", - "Number of packets reused out of all requests to the packet pool", - "clientstack", - "packetpool", - StatType.Push, - null, - StatVerbosity.Debug); - - private PercentageStat m_blocksReusedStat = new PercentageStat( - "PacketDataBlocksReused", - "Packet data blocks reused", - "Number of data blocks reused out of all requests to the packet pool", - "clientstack", - "packetpool", - StatType.Push, - null, - StatVerbosity.Debug); - - /// - /// Pool of packets available for reuse. - /// - private readonly Dictionary> pool = new Dictionary>(); - - private static Dictionary> DataBlocks = new Dictionary>(); - - public static PacketPool Instance - { - get { return instance; } - } - - public bool RecyclePackets - { - set { packetPoolEnabled = value; } - get { return packetPoolEnabled; } - } - - public bool RecycleDataBlocks - { - set { dataBlockPoolEnabled = value; } - get { return dataBlockPoolEnabled; } - } - - private PacketPool() - { - StatsManager.RegisterStat(m_packetsReusedStat); - StatsManager.RegisterStat(m_blocksReusedStat); - - StatsManager.RegisterStat( - new Stat( - "PacketsPoolCount", - "Objects within the packet pool", - "The number of objects currently stored within the packet pool", - "", - "clientstack", - "packetpool", - StatType.Pull, - stat => { lock (pool) { stat.Value = pool.Count; } }, - StatVerbosity.Debug)); - - StatsManager.RegisterStat( - new Stat( - "PacketDataBlocksPoolCount", - "Objects within the packet data block pool", - "The number of objects currently stored within the packet data block pool", - "", - "clientstack", - "packetpool", - StatType.Pull, - stat => { lock (DataBlocks) { stat.Value = DataBlocks.Count; } }, - StatVerbosity.Debug)); - } - - /// - /// Gets a packet of the given type. - /// - /// - /// Guaranteed to always return a packet, whether from the pool or newly constructed. - public Packet GetPacket(PacketType type) - { - m_packetsReusedStat.Consequent++; - - Packet packet; - - if (!packetPoolEnabled) - return Packet.BuildPacket(type); - - lock (pool) - { - if (!pool.ContainsKey(type) || pool[type] == null || (pool[type]).Count == 0) - { -// m_log.DebugFormat("[PACKETPOOL]: Building {0} packet", type); - - // Creating a new packet if we cannot reuse an old package - packet = Packet.BuildPacket(type); - } - else - { -// m_log.DebugFormat("[PACKETPOOL]: Pulling {0} packet", type); - - // Recycle old packages - m_packetsReusedStat.Antecedent++; - - packet = pool[type].Pop(); - } - } - - return packet; - } - - // private byte[] decoded_header = new byte[10]; - private static PacketType GetType(byte[] bytes) - { - byte[] decoded_header = new byte[10 + 8]; - ushort id; - PacketFrequency freq; - - if ((bytes[0] & Helpers.MSG_ZEROCODED) != 0) - { - Helpers.ZeroDecode(bytes, 16, decoded_header); - } - else - { - Buffer.BlockCopy(bytes, 0, decoded_header, 0, 10); - } - - if (decoded_header[6] == 0xFF) - { - if (decoded_header[7] == 0xFF) - { - id = (ushort) ((decoded_header[8] << 8) + decoded_header[9]); - freq = PacketFrequency.Low; - } - else - { - id = decoded_header[7]; - freq = PacketFrequency.Medium; - } - } - else - { - id = decoded_header[6]; - freq = PacketFrequency.High; - } - - return Packet.GetType(id, freq); - } - - public Packet GetPacket(byte[] bytes, ref int packetEnd, byte[] zeroBuffer) - { - PacketType type = GetType(bytes); - -// Array.Clear(zeroBuffer, 0, zeroBuffer.Length); - - int i = 0; - Packet packet = GetPacket(type); - if (packet == null) - m_log.WarnFormat("[PACKETPOOL]: Failed to get packet of type {0}", type); - else - packet.FromBytes(bytes, ref i, ref packetEnd, zeroBuffer); - - return packet; - } - - /// - /// Return a packet to the packet pool - /// - /// - public void ReturnPacket(Packet packet) - { - if (dataBlockPoolEnabled) - { - switch (packet.Type) - { - case PacketType.ObjectUpdate: - ObjectUpdatePacket oup = (ObjectUpdatePacket)packet; - - foreach (ObjectUpdatePacket.ObjectDataBlock oupod in oup.ObjectData) - ReturnDataBlock(oupod); - - oup.ObjectData = null; - break; - - case PacketType.ImprovedTerseObjectUpdate: - ImprovedTerseObjectUpdatePacket itoup = (ImprovedTerseObjectUpdatePacket)packet; - - foreach (ImprovedTerseObjectUpdatePacket.ObjectDataBlock itoupod in itoup.ObjectData) - ReturnDataBlock(itoupod); - - itoup.ObjectData = null; - break; - } - } - - if (packetPoolEnabled) - { - switch (packet.Type) - { - // List pooling packets here - case PacketType.AgentUpdate: - case PacketType.PacketAck: - case PacketType.ObjectUpdate: - case PacketType.ImprovedTerseObjectUpdate: - lock (pool) - { - PacketType type = packet.Type; - - if (!pool.ContainsKey(type)) - { - pool[type] = new Stack(); - } - - if ((pool[type]).Count < 50) - { -// m_log.DebugFormat("[PACKETPOOL]: Pushing {0} packet", type); - - pool[type].Push(packet); - } - } - break; - - // Other packets wont pool - default: - return; - } - } - } - - public T GetDataBlock() where T: new() - { - lock (DataBlocks) - { - m_blocksReusedStat.Consequent++; - - Stack s; - - if (DataBlocks.TryGetValue(typeof(T), out s)) - { - if (s.Count > 0) - { - m_blocksReusedStat.Antecedent++; - return (T)s.Pop(); - } - } - else - { - DataBlocks[typeof(T)] = new Stack(); - } - - return new T(); - } - } - - public void ReturnDataBlock(T block) where T: new() - { - if (block == null) - return; - - lock (DataBlocks) - { - if (!DataBlocks.ContainsKey(typeof(T))) - DataBlocks[typeof(T)] = new Stack(); - - if (DataBlocks[typeof(T)].Count < 50) - DataBlocks[typeof(T)].Push(block); - } - } - } -} \ No newline at end of file diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/BasicCircuitTests.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/BasicCircuitTests.cs index 556df30..109a8e1 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/Tests/BasicCircuitTests.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/BasicCircuitTests.cs @@ -43,7 +43,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests /// This will contain basic tests for the LindenUDP client stack /// [TestFixture] - public class BasicCircuitTests : OpenSimTestCase + public class BasicCircuitTests { private Scene m_scene; private TestLLUDPServer m_udpServer; @@ -65,9 +65,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests } [SetUp] - public override void SetUp() + public void SetUp() { - base.SetUp(); m_scene = new SceneHelpers().SetupScene(); } @@ -144,7 +143,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests public void TestAddClient() { TestHelpers.InMethod(); -// TestHelpers.EnableLogging(); +// XmlConfigurator.Configure(); AddUdpServer(); -- cgit v1.1 From 5e0294815f7e3ec83b7e568e1468948ac0ff7331 Mon Sep 17 00:00:00 2001 From: teravus Date: Sat, 17 Nov 2012 03:47:09 -0500 Subject: * Plumbing and basic setting of the GetMesh Cap Throttler. * Last step is to flip the throttle distribution. --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 12 ++++++++++++ OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs | 4 ++++ 2 files changed, 16 insertions(+) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index ae9ed7f..533a1a8 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -11884,6 +11884,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP } /// + /// Sets the throttles from values supplied by the client + /// + /// + public void SetAgentThrottleSilent(int throttle, int setting) + { + m_udpClient.ForceThrottleSetting(throttle,setting); + //m_udpClient.SetThrottles(throttles); + + } + + + /// /// Get the current throttles for this client as a packed byte array /// /// Unused diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index c472176..f675377 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs @@ -682,6 +682,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (m_nextOnQueueEmpty == 0) m_nextOnQueueEmpty = 1; } + internal void ForceThrottleSetting(int throttle, int setting) + { + m_throttleCategories[throttle].RequestedDripRate = Math.Max(setting, LLUDPServer.MTU); ; + } /// /// Converts a integer to a -- cgit v1.1 From 93bede4e6aa0838e14f39f5e641b028267d2683c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 7 Dec 2012 21:26:58 +0000 Subject: revert the use of avatar skeleton and use avatar size provided by viewers, since at least for now seems good enought --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 8e0b72f..2efaa79 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -6248,6 +6248,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Temporarily protect ourselves from the mantis #951 failure. // However, we could do this for several other handlers where a failure isn't terminal // for the client session anyway, in order to protect ourselves against bad code in plugins + Vector3 avSize = appear.AgentData.Size; try { byte[] visualparams = new byte[appear.VisualParam.Length]; @@ -6258,7 +6259,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (appear.ObjectData.TextureEntry.Length > 1) te = new Primitive.TextureEntry(appear.ObjectData.TextureEntry, 0, appear.ObjectData.TextureEntry.Length); - handlerSetAppearance(sender, te, visualparams); + handlerSetAppearance(sender, te, visualparams,avSize); } catch (Exception e) { -- cgit v1.1 From 0e2b717b4d262363995b2b351b4afe7c84889342 Mon Sep 17 00:00:00 2001 From: teravus Date: Fri, 7 Dec 2012 20:15:32 -0500 Subject: * Should promote faster self appearance. --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 52 ++++++++++++++-------- 1 file changed, 33 insertions(+), 19 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 8e0b72f..c261f32 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -459,6 +459,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } public bool SendLogoutPacketWhenClosing { set { m_SendLogoutPacketWhenClosing = value; } } + private Dictionary agentWearables = new Dictionary(); #endregion Properties @@ -2749,8 +2750,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP req.AssetInf.ID, req.AssetInf.Metadata.ContentType); return; } - - //m_log.Debug("sending asset " + req.RequestAssetID); + UUID WearableOut = UUID.Zero; + bool isWearable = false; + isWearable = agentWearables.TryGetValue(req.RequestAssetID, out WearableOut); + // m_log.Debug("sending asset " + req.RequestAssetID + ", iswearable: " + isWearable); TransferInfoPacket Transfer = new TransferInfoPacket(); Transfer.TransferInfo.ChannelType = 2; Transfer.TransferInfo.Status = 0; @@ -2772,7 +2775,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP Transfer.TransferInfo.Size = req.AssetInf.Data.Length; Transfer.TransferInfo.TransferID = req.TransferRequestID; Transfer.Header.Zerocoded = true; - OutPacket(Transfer, ThrottleOutPacketType.Asset); + OutPacket(Transfer, isWearable ? ThrottleOutPacketType.State : ThrottleOutPacketType.Asset); if (req.NumPackets == 1) { @@ -2783,7 +2786,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP TransferPacket.TransferData.Data = req.AssetInf.Data; TransferPacket.TransferData.Status = 1; TransferPacket.Header.Zerocoded = true; - OutPacket(TransferPacket, ThrottleOutPacketType.Asset); + OutPacket(TransferPacket, isWearable ? ThrottleOutPacketType.State : ThrottleOutPacketType.Asset); } else { @@ -2816,7 +2819,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP TransferPacket.TransferData.Status = 1; } TransferPacket.Header.Zerocoded = true; - OutPacket(TransferPacket, ThrottleOutPacketType.Asset); + OutPacket(TransferPacket, isWearable ? ThrottleOutPacketType.State : ThrottleOutPacketType.Asset); processedLength += chunkSize; packetNumber++; @@ -3571,24 +3574,29 @@ namespace OpenSim.Region.ClientStack.LindenUDP aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[count]; AgentWearablesUpdatePacket.WearableDataBlock awb; int idx = 0; - for (int i = 0; i < wearables.Length; i++) + lock (agentWearables) { - for (int j = 0; j < wearables[i].Count; j++) + agentWearables.Clear(); + for (int i = 0; i < wearables.Length; i++) { - awb = new AgentWearablesUpdatePacket.WearableDataBlock(); - awb.WearableType = (byte)i; - awb.AssetID = wearables[i][j].AssetID; - awb.ItemID = wearables[i][j].ItemID; - aw.WearableData[idx] = awb; - idx++; - -// m_log.DebugFormat( -// "[APPEARANCE]: Sending wearable item/asset {0} {1} (index {2}) for {3}", -// awb.ItemID, awb.AssetID, i, Name); + for (int j = 0; j < wearables[i].Count; j++) + { + awb = new AgentWearablesUpdatePacket.WearableDataBlock(); + awb.WearableType = (byte) i; + awb.AssetID = wearables[i][j].AssetID; + awb.ItemID = wearables[i][j].ItemID; + agentWearables.Add(awb.AssetID, awb.ItemID); + aw.WearableData[idx] = awb; + idx++; + + // m_log.DebugFormat( + // "[APPEARANCE]: Sending wearable item/asset {0} {1} (index {2}) for {3}", + // awb.ItemID, awb.AssetID, i, Name); + } } } - OutPacket(aw, ThrottleOutPacketType.Task); + OutPacket(aw, ThrottleOutPacketType.State); } public void SendAppearance(UUID agentID, byte[] visualParams, byte[] textureEntry) @@ -3613,7 +3621,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP avp.Sender.IsTrial = false; avp.Sender.ID = agentID; //m_log.DebugFormat("[CLIENT]: Sending appearance for {0} to {1}", agentID.ToString(), AgentId.ToString()); - OutPacket(avp, ThrottleOutPacketType.Task); + OutPacket(avp, ThrottleOutPacketType.State); } public void SendAnimations(UUID[] animations, int[] seqs, UUID sourceAgentId, UUID[] objectIDs) @@ -7770,6 +7778,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP if ((ImageType)block.Type == ImageType.Baked) args.Priority *= 2.0f; + UUID wearableout = UUID.Zero; + if (agentWearables.TryGetValue(block.Image, out wearableout)) + { + args.Priority *= 2.0f; + } + ImageManager.EnqueueReq(args); } -- cgit v1.1 From 6c1a852137e3a66db5befa4c6ec50b3a93268304 Mon Sep 17 00:00:00 2001 From: teravus Date: Sat, 8 Dec 2012 00:05:12 -0500 Subject: * This is a better way to do the last commit. --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 63 +++++++++++----------- 1 file changed, 33 insertions(+), 30 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index c261f32..7cf6cf1 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -459,7 +459,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } public bool SendLogoutPacketWhenClosing { set { m_SendLogoutPacketWhenClosing = value; } } - private Dictionary agentWearables = new Dictionary(); + #endregion Properties @@ -585,6 +585,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Disable UDP handling for this client m_udpClient.Shutdown(); + //m_log.InfoFormat("[CLIENTVIEW] Memory pre GC {0}", System.GC.GetTotalMemory(false)); //GC.Collect(); //m_log.InfoFormat("[CLIENTVIEW] Memory post GC {0}", System.GC.GetTotalMemory(true)); @@ -2750,10 +2751,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP req.AssetInf.ID, req.AssetInf.Metadata.ContentType); return; } - UUID WearableOut = UUID.Zero; + int WearableOut = 0; bool isWearable = false; - isWearable = agentWearables.TryGetValue(req.RequestAssetID, out WearableOut); - // m_log.Debug("sending asset " + req.RequestAssetID + ", iswearable: " + isWearable); + + if (req.AssetInf != null) + isWearable = + ((AssetType) req.AssetInf.Type == + AssetType.Bodypart || (AssetType) req.AssetInf.Type == AssetType.Clothing); + + + //m_log.Debug("sending asset " + req.RequestAssetID + ", iswearable: " + isWearable); + + + //if (isWearable) + // m_log.Debug((AssetType)req.AssetInf.Type); + TransferInfoPacket Transfer = new TransferInfoPacket(); Transfer.TransferInfo.ChannelType = 2; Transfer.TransferInfo.Status = 0; @@ -3574,27 +3586,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[count]; AgentWearablesUpdatePacket.WearableDataBlock awb; int idx = 0; - lock (agentWearables) - { - agentWearables.Clear(); - for (int i = 0; i < wearables.Length; i++) - { - for (int j = 0; j < wearables[i].Count; j++) + + for (int i = 0; i < wearables.Length; i++) { - awb = new AgentWearablesUpdatePacket.WearableDataBlock(); - awb.WearableType = (byte) i; - awb.AssetID = wearables[i][j].AssetID; - awb.ItemID = wearables[i][j].ItemID; - agentWearables.Add(awb.AssetID, awb.ItemID); - aw.WearableData[idx] = awb; - idx++; - - // m_log.DebugFormat( - // "[APPEARANCE]: Sending wearable item/asset {0} {1} (index {2}) for {3}", - // awb.ItemID, awb.AssetID, i, Name); - } - } - } + for (int j = 0; j < wearables[i].Count; j++) + { + awb = new AgentWearablesUpdatePacket.WearableDataBlock(); + awb.WearableType = (byte) i; + awb.AssetID = wearables[i][j].AssetID; + awb.ItemID = wearables[i][j].ItemID; + aw.WearableData[idx] = awb; + idx++; + + // m_log.DebugFormat( + // "[APPEARANCE]: Sending wearable item/asset {0} {1} (index {2}) for {3}", + // awb.ItemID, awb.AssetID, i, Name); + } + } OutPacket(aw, ThrottleOutPacketType.State); } @@ -7777,12 +7785,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // surrounding scene if ((ImageType)block.Type == ImageType.Baked) args.Priority *= 2.0f; - - UUID wearableout = UUID.Zero; - if (agentWearables.TryGetValue(block.Image, out wearableout)) - { - args.Priority *= 2.0f; - } + int wearableout = 0; ImageManager.EnqueueReq(args); } -- cgit v1.1 From ecdd0e225f088ad1311a26f5934cd9e08aa697bd Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 9 Dec 2012 00:55:09 +0000 Subject: add velocityinterpolator packets handling but actually do nothing, since they don't do what i was looking for. --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 28 +++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 2efaa79..4ed9a0a 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -331,6 +331,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP private Prioritizer m_prioritizer; private bool m_disableFacelights = false; + private bool m_VelocityInterpolate = false; private const uint MaxTransferBytesPerPacket = 600; @@ -5309,8 +5310,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP // If AgentUpdate is ever handled asynchronously, then we will also need to construct a new AgentUpdateArgs // for each AgentUpdate packet. AddLocalPacketHandler(PacketType.AgentUpdate, HandleAgentUpdate, false); - + AddLocalPacketHandler(PacketType.ViewerEffect, HandleViewerEffect, false); + AddLocalPacketHandler(PacketType.VelocityInterpolateOff, HandleVelocityInterpolateOff, false); + AddLocalPacketHandler(PacketType.VelocityInterpolateOn, HandleVelocityInterpolateOn, false); AddLocalPacketHandler(PacketType.AgentCachedTexture, HandleAgentTextureCached, false); AddLocalPacketHandler(PacketType.MultipleObjectUpdate, HandleMultipleObjUpdate, false); AddLocalPacketHandler(PacketType.MoneyTransferRequest, HandleMoneyTransferRequest, false); @@ -5828,6 +5831,29 @@ namespace OpenSim.Region.ClientStack.LindenUDP return true; } + private bool HandleVelocityInterpolateOff(IClientAPI sender, Packet Pack) + { + VelocityInterpolateOffPacket p = (VelocityInterpolateOffPacket)Pack; + if (p.AgentData.SessionID != SessionId || + p.AgentData.AgentID != AgentId) + return true; + + m_VelocityInterpolate = false; + return true; + } + + private bool HandleVelocityInterpolateOn(IClientAPI sender, Packet Pack) + { + VelocityInterpolateOffPacket p = (VelocityInterpolateOffPacket)Pack; + if (p.AgentData.SessionID != SessionId || + p.AgentData.AgentID != AgentId) + return true; + + m_VelocityInterpolate = true; + return true; + } + + private bool HandleAvatarPropertiesRequest(IClientAPI sender, Packet Pack) { AvatarPropertiesRequestPacket avatarProperties = (AvatarPropertiesRequestPacket)Pack; -- cgit v1.1 From c6430b14dbc9d39b9c9b79ead1c1ebaaff833745 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 10 Dec 2012 11:25:30 +0000 Subject: typo fix --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 4ed9a0a..ea3c6a4 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -3992,6 +3992,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP const float TIME_DILATION = 1.0f; ushort timeDilation = Utils.FloatToUInt16(avgTimeDilation, 0.0f, 1.0f); + if (terseAgentUpdateBlocks.IsValueCreated) { @@ -4972,7 +4973,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // in that direction, even though we don't model this on the server. Implementing this in the future // may improve movement smoothness. // acceleration = new Vector3(1, 0, 0); - + angularVelocity = Vector3.Zero; if (sendTexture) @@ -5844,7 +5845,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP private bool HandleVelocityInterpolateOn(IClientAPI sender, Packet Pack) { - VelocityInterpolateOffPacket p = (VelocityInterpolateOffPacket)Pack; + VelocityInterpolateOnPacket p = (VelocityInterpolateOnPacket)Pack; if (p.AgentData.SessionID != SessionId || p.AgentData.AgentID != AgentId) return true; -- cgit v1.1 From 20773dcfccc04d8af14e27f87746711bfaba07b1 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 13 Dec 2012 02:55:36 +0000 Subject: add a Check method to flotsamAssetCache, so to check if a asset is in cache without actually loading it. Make use limited use of it in avatarfactory textures check. Also on llclientview HandleAgentTextureCached that now should work. Other asset cache modules for now will return false, so are broken. baked textures logic still unchanged. *UNTESTED* --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 29 ++++++++++++++++------ 1 file changed, 22 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index ea3c6a4..edb1a9d 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -3992,7 +3992,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP const float TIME_DILATION = 1.0f; ushort timeDilation = Utils.FloatToUInt16(avgTimeDilation, 0.0f, 1.0f); - if (terseAgentUpdateBlocks.IsValueCreated) { @@ -11695,14 +11694,30 @@ namespace OpenSim.Region.ClientStack.LindenUDP cachedresp.WearableData = new AgentCachedTextureResponsePacket.WearableDataBlock[cachedtex.WearableData.Length]; - for (int i = 0; i < cachedtex.WearableData.Length; i++) + IImprovedAssetCache cache = m_scene.RequestModuleInterface(); + if (cache == null) { - cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); - cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; - cachedresp.WearableData[i].TextureID = UUID.Zero; - cachedresp.WearableData[i].HostName = new byte[0]; + for (int i = 0; i < cachedtex.WearableData.Length; i++) + { + cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); + cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; + cachedresp.WearableData[i].TextureID = UUID.Zero; + cachedresp.WearableData[i].HostName = new byte[0]; + } + } + else + { + for (int i = 0; i < cachedtex.WearableData.Length; i++) + { + cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); + cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; + if(cache.Check(cachedtex.WearableData[i].ID.ToString())) + cachedresp.WearableData[i].TextureID = UUID.Zero; + else + cachedresp.WearableData[i].TextureID = UUID.Zero; + cachedresp.WearableData[i].HostName = new byte[0]; + } } - cachedresp.Header.Zerocoded = true; OutPacket(cachedresp, ThrottleOutPacketType.Task); -- cgit v1.1 From b3a77c16bd2ad83076ddf19275b2f104210bba07 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 13 Dec 2012 07:34:27 +0000 Subject: FIX small avatars movement on terrain. (avatar appearance getting even more messy) --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index edb1a9d..4860da0 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -5122,7 +5122,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP update.PCode = (byte)PCode.Avatar; update.ProfileCurve = 1; update.PSBlock = Utils.EmptyBytes; - update.Scale = new Vector3(0.45f, 0.6f, 1.9f); + update.Scale = data.Appearance.AvatarSize; +// update.Scale.Z -= 0.2f; + update.Text = Utils.EmptyBytes; update.TextColor = new byte[4]; -- cgit v1.1 From 77cc7ce399d1b1a710f3b3f4337932febdef66c8 Mon Sep 17 00:00:00 2001 From: teravus Date: Fri, 21 Dec 2012 19:12:30 -0500 Subject: * Partial Commit for Avatar Appearance to include the functionality of Cached Bakes. --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 26 +++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 363ee54..d18b026 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -6298,12 +6298,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP byte[] visualparams = new byte[appear.VisualParam.Length]; for (int i = 0; i < appear.VisualParam.Length; i++) visualparams[i] = appear.VisualParam[i].ParamValue; - + //var b = appear.WearableData[0]; + Primitive.TextureEntry te = null; if (appear.ObjectData.TextureEntry.Length > 1) te = new Primitive.TextureEntry(appear.ObjectData.TextureEntry, 0, appear.ObjectData.TextureEntry.Length); + + WearableCacheItem[] cacheitems = new WearableCacheItem[appear.WearableData.Length]; + for (int i=0; i(); + // var item = fac.GetBakedTextureFaces(AgentId); + //WearableCacheItem[] items = fac.GetCachedItems(AgentId); + IImprovedAssetCache cache = m_scene.RequestModuleInterface(); if (cache == null) { @@ -11720,7 +11732,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; - cachedresp.WearableData[i].TextureID = UUID.Zero; + cachedresp.WearableData[i].TextureID = UUID.Zero; //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); cachedresp.WearableData[i].HostName = new byte[0]; } } @@ -11730,10 +11742,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP { cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; - if(cache.Check(cachedtex.WearableData[i].ID.ToString())) + + + + if (cache.Check(cachedtex.WearableData[i].ID.ToString())) cachedresp.WearableData[i].TextureID = UUID.Zero; + //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); else - cachedresp.WearableData[i].TextureID = UUID.Zero; + cachedresp.WearableData[i].TextureID = UUID.Zero; // UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); cachedresp.WearableData[i].HostName = new byte[0]; } } -- cgit v1.1 From 6797ac14741851efa5ba60a00891e18cf7755c80 Mon Sep 17 00:00:00 2001 From: teravus Date: Sat, 29 Dec 2012 08:53:58 -0500 Subject: * This finishes the implementation of AgentCachedTexture. Requires the XBakes Module and service for full functionality. Previous no-cache functionality works without the service and module. In some ways, I would have been happier not putting an AssetBase in WearableCacheItem.. but turns out it was probably unavoidable. No additional locks, yay. --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 110 ++++++++++++++++++--- 1 file changed, 94 insertions(+), 16 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index d18b026..9e39699 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -3629,7 +3629,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP avp.Sender.IsTrial = false; avp.Sender.ID = agentID; - //m_log.DebugFormat("[CLIENT]: Sending appearance for {0} to {1}", agentID.ToString(), AgentId.ToString()); + m_log.DebugFormat("[CLIENT]: Sending appearance for {0} to {1}", agentID.ToString(), AgentId.ToString()); OutPacket(avp, ThrottleOutPacketType.State); } @@ -11725,32 +11725,110 @@ namespace OpenSim.Region.ClientStack.LindenUDP // var item = fac.GetBakedTextureFaces(AgentId); //WearableCacheItem[] items = fac.GetCachedItems(AgentId); - IImprovedAssetCache cache = m_scene.RequestModuleInterface(); - if (cache == null) + IAssetService cache = m_scene.AssetService; + IBakedTextureModule bakedTextureModule = m_scene.RequestModuleInterface(); + if (bakedTextureModule != null && cache != null) { - for (int i = 0; i < cachedtex.WearableData.Length; i++) + // We need to make sure the asset stored in the bake is available on this server also by it's assetid before we map it to a Cacheid + + WearableCacheItem[] cacheItems = null; + ScenePresence p = m_scene.GetScenePresence(AgentId); + if (p.Appearance != null) + if (p.Appearance.WearableCacheItems == null || p.Appearance.WearableCacheItemsDirty) + { + try + { + cacheItems = bakedTextureModule.Get(AgentId); + p.Appearance.WearableCacheItems = cacheItems; + p.Appearance.WearableCacheItemsDirty = false; + } + catch (InvalidOperationException) + { + cacheItems = null; + } + } + else if (p.Appearance.WearableCacheItems != null) + { + cacheItems = p.Appearance.WearableCacheItems; + } + + if (cache != null && cacheItems != null) + { + foreach (WearableCacheItem item in cacheItems) + { + + if (cache.GetCached(item.TextureID.ToString()) == null) + { + item.TextureAsset.Temporary = true; + cache.Store(item.TextureAsset); + } + + + } + } + if (cacheItems != null) + { + + for (int i = 0; i < cachedtex.WearableData.Length; i++) + { + WearableCacheItem item = + WearableCacheItem.SearchTextureIndex(cachedtex.WearableData[i].TextureIndex,cacheItems); + + cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); + cachedresp.WearableData[i].TextureIndex= cachedtex.WearableData[i].TextureIndex; + cachedresp.WearableData[i].HostName = new byte[0]; + if (item != null) + { + cachedresp.WearableData[i].TextureID = item.TextureID; + } + else + { + cachedresp.WearableData[i].TextureID = UUID.Zero; + } + } + } + else { - cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); - cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; - cachedresp.WearableData[i].TextureID = UUID.Zero; //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); - cachedresp.WearableData[i].HostName = new byte[0]; + for (int i = 0; i < cachedtex.WearableData.Length; i++) + { + cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); + cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; + cachedresp.WearableData[i].TextureID = UUID.Zero; + //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); + cachedresp.WearableData[i].HostName = new byte[0]; + } } } else { - for (int i = 0; i < cachedtex.WearableData.Length; i++) + if (cache == null) + { + for (int i = 0; i < cachedtex.WearableData.Length; i++) + { + cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); + cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; + cachedresp.WearableData[i].TextureID = UUID.Zero; + //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); + cachedresp.WearableData[i].HostName = new byte[0]; + } + } + else { - cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); - cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; + for (int i = 0; i < cachedtex.WearableData.Length; i++) + { + cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); + cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; - if (cache.Check(cachedtex.WearableData[i].ID.ToString())) - cachedresp.WearableData[i].TextureID = UUID.Zero; + if (cache.GetCached(cachedresp.WearableData[i].TextureID.ToString()) == null) + cachedresp.WearableData[i].TextureID = UUID.Zero; //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); - else - cachedresp.WearableData[i].TextureID = UUID.Zero; // UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); - cachedresp.WearableData[i].HostName = new byte[0]; + else + cachedresp.WearableData[i].TextureID = UUID.Zero; + // UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); + cachedresp.WearableData[i].HostName = new byte[0]; + } } } cachedresp.Header.Zerocoded = true; -- cgit v1.1 From 2805ec64662494d680925c6034e59b823e051a9d Mon Sep 17 00:00:00 2001 From: teravus Date: Mon, 31 Dec 2012 23:04:28 -0500 Subject: * Fixed a bug that replayed old cached appearance when changing outfits * Added suser(bad client) DOS protection by limiting the max cacheitems to the maximum sane amount. * Prevents potential numerous loops from running amok and index errors if the client purposely provides bad cache info. * If the XBakes service wasn't running, the SetAvatarAppearance routine would crash when contacting the XBakes service even though it was in a Try/Catch for the appropriate error type. It only properly error handles with the type Exception :(. (commented on that because it's unusual) --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 34 ++++++++++++++++++---- 1 file changed, 29 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 9e39699..d46adb8 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -11727,6 +11727,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP IAssetService cache = m_scene.AssetService; IBakedTextureModule bakedTextureModule = m_scene.RequestModuleInterface(); + //bakedTextureModule = null; + int maxWearablesLoop = cachedtex.WearableData.Length; + if (maxWearablesLoop > AvatarWearable.MAX_WEARABLES) + maxWearablesLoop = AvatarWearable.MAX_WEARABLES; + if (bakedTextureModule != null && cache != null) { // We need to make sure the asset stored in the bake is available on this server also by it's assetid before we map it to a Cacheid @@ -11742,10 +11747,27 @@ namespace OpenSim.Region.ClientStack.LindenUDP p.Appearance.WearableCacheItems = cacheItems; p.Appearance.WearableCacheItemsDirty = false; } + + /* + * The following Catch types DO NOT WORK, it jumps to the General Packet Exception Handler if you don't catch Exception! + * + catch (System.Net.Sockets.SocketException) + { + cacheItems = null; + } + catch (WebException) + { + cacheItems = null; + } catch (InvalidOperationException) { cacheItems = null; + } */ + catch (Exception) + { + cacheItems = null; } + } else if (p.Appearance.WearableCacheItems != null) { @@ -11766,10 +11788,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } + if (cacheItems != null) { - for (int i = 0; i < cachedtex.WearableData.Length; i++) + for (int i = 0; i < maxWearablesLoop; i++) { WearableCacheItem item = WearableCacheItem.SearchTextureIndex(cachedtex.WearableData[i].TextureIndex,cacheItems); @@ -11777,8 +11800,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); cachedresp.WearableData[i].TextureIndex= cachedtex.WearableData[i].TextureIndex; cachedresp.WearableData[i].HostName = new byte[0]; - if (item != null) + if (item != null && cachedtex.WearableData[i].ID == item.CacheId) { + cachedresp.WearableData[i].TextureID = item.TextureID; } else @@ -11789,7 +11813,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } else { - for (int i = 0; i < cachedtex.WearableData.Length; i++) + for (int i = 0; i < maxWearablesLoop; i++) { cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; @@ -11803,7 +11827,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { if (cache == null) { - for (int i = 0; i < cachedtex.WearableData.Length; i++) + for (int i = 0; i < maxWearablesLoop; i++) { cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; @@ -11814,7 +11838,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } else { - for (int i = 0; i < cachedtex.WearableData.Length; i++) + for (int i = 0; i < maxWearablesLoop; i++) { cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; -- cgit v1.1 From 2eb0d8b6176c223e915a2d22b1c9540156283943 Mon Sep 17 00:00:00 2001 From: dahlia Date: Thu, 10 Jan 2013 20:21:18 -0800 Subject: add some sanity checking to HandleAgentRequestSit handler --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index d46adb8..0a865ab 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -6601,8 +6601,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP AgentRequestSit handlerAgentRequestSit = OnAgentRequestSit; if (handlerAgentRequestSit != null) - handlerAgentRequestSit(this, agentRequestSit.AgentData.AgentID, - agentRequestSit.TargetObject.TargetID, agentRequestSit.TargetObject.Offset); + if (!(agentRequestSit.AgentData == null + || agentRequestSit.TargetObject == null + || agentRequestSit.TargetObject.TargetID == null + || agentRequestSit.TargetObject.Offset == null)) + { + var sp = m_scene.GetScenePresence(agentRequestSit.AgentData.AgentID); + if (sp == null || sp.ParentID != 0) // ignore packet if agent is already sitting + return true; + + handlerAgentRequestSit(this, agentRequestSit.AgentData.AgentID, + agentRequestSit.TargetObject.TargetID, agentRequestSit.TargetObject.Offset); + } } return true; } -- cgit v1.1 From 4d92c6b39f3ebb7a27517493b66d097d9d9d23dd Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 16 Jan 2013 15:30:58 +0000 Subject: fix STATE udp queue data rate since it is in use again, after being removed by intel folks (?)( should it be used or removed ??) --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index f675377..6485c1a 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs @@ -339,7 +339,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); // State is a subcategory of task that we allocate a percentage to - int state = 0; +// int state = 0; + int state = (int)((1.0f - STATE_TASK_PERCENTAGE) * (float)task); + task = (int)(STATE_TASK_PERCENTAGE * (float)task); // Make sure none of the throttles are set below our packet MTU, // otherwise a throttle could become permanently clogged @@ -350,6 +352,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP task = Math.Max(task, LLUDPServer.MTU); texture = Math.Max(texture, LLUDPServer.MTU); asset = Math.Max(asset, LLUDPServer.MTU); + state = Math.Max(state, LLUDPServer.MTU); //int total = resend + land + wind + cloud + task + texture + asset; //m_log.DebugFormat("[LLUDPCLIENT]: {0} is setting throttles. Resend={1}, Land={2}, Wind={3}, Cloud={4}, Task={5}, Texture={6}, Asset={7}, Total={8}", -- cgit v1.1 From 85aa1804dfc9edbf41f16c312d06746eecd59bc9 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 16 Jan 2013 16:45:18 +0000 Subject: Complete removal of the now unused state queue --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 2 +- OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs | 15 ++------------- 2 files changed, 3 insertions(+), 14 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 0a865ab..3ae9daf 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -1607,7 +1607,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (localIDs.Count == 1 && m_scene.GetScenePresence(localIDs[0]) != null) { - OutPacket(kill, ThrottleOutPacketType.State); + OutPacket(kill, ThrottleOutPacketType.Task); } else { diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index f675377..f1a1812 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs @@ -279,7 +279,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP public string GetStats() { return string.Format( - "{0,7} {1,7} {2,7} {3,9} {4,7} {5,7} {6,7} {7,7} {8,7} {9,8} {10,7} {11,7} {12,7}", + "{0,7} {1,7} {2,7} {3,9} {4,7} {5,7} {6,7} {7,7} {8,7} {9,8} {10,7} {11,7}", Util.EnvironmentTickCountSubtract(TickLastPacketReceived), PacketsReceived, PacketsSent, @@ -291,8 +291,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_packetOutboxes[(int)ThrottleOutPacketType.Cloud].Count, m_packetOutboxes[(int)ThrottleOutPacketType.Task].Count, m_packetOutboxes[(int)ThrottleOutPacketType.Texture].Count, - m_packetOutboxes[(int)ThrottleOutPacketType.Asset].Count, - m_packetOutboxes[(int)ThrottleOutPacketType.State].Count); + m_packetOutboxes[(int)ThrottleOutPacketType.Asset].Count); } public void SendPacketStats() @@ -338,8 +337,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP int task = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; int texture = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; int asset = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); - // State is a subcategory of task that we allocate a percentage to - int state = 0; // Make sure none of the throttles are set below our packet MTU, // otherwise a throttle could become permanently clogged @@ -376,9 +373,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP bucket = m_throttleCategories[(int)ThrottleOutPacketType.Task]; bucket.RequestedDripRate = task; - bucket = m_throttleCategories[(int)ThrottleOutPacketType.State]; - bucket.RequestedDripRate = state; - bucket = m_throttleCategories[(int)ThrottleOutPacketType.Texture]; bucket.RequestedDripRate = texture; @@ -709,9 +703,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP Texture = 5, /// Non-texture assets Asset = 6, - /// Avatar and primitive data - /// This is a sub-category of Task - State = 7, */ switch (category) @@ -728,8 +719,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP return ThrottleOutPacketTypeFlags.Texture; case ThrottleOutPacketType.Asset: return ThrottleOutPacketTypeFlags.Asset; - case ThrottleOutPacketType.State: - return ThrottleOutPacketTypeFlags.State; default: return 0; } -- cgit v1.1 From 91138014e21e19a3c02ee1640caab7f748472038 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 16 Jan 2013 17:12:56 +0000 Subject: Change all uses of the removed state queue to the task queue for now. --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 3ae9daf..956c2c9 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -2788,7 +2788,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP Transfer.TransferInfo.Size = req.AssetInf.Data.Length; Transfer.TransferInfo.TransferID = req.TransferRequestID; Transfer.Header.Zerocoded = true; - OutPacket(Transfer, isWearable ? ThrottleOutPacketType.State : ThrottleOutPacketType.Asset); + OutPacket(Transfer, isWearable ? ThrottleOutPacketType.Task : ThrottleOutPacketType.Asset); if (req.NumPackets == 1) { @@ -2799,7 +2799,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP TransferPacket.TransferData.Data = req.AssetInf.Data; TransferPacket.TransferData.Status = 1; TransferPacket.Header.Zerocoded = true; - OutPacket(TransferPacket, isWearable ? ThrottleOutPacketType.State : ThrottleOutPacketType.Asset); + OutPacket(TransferPacket, isWearable ? ThrottleOutPacketType.Task : ThrottleOutPacketType.Asset); } else { @@ -2832,7 +2832,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP TransferPacket.TransferData.Status = 1; } TransferPacket.Header.Zerocoded = true; - OutPacket(TransferPacket, isWearable ? ThrottleOutPacketType.State : ThrottleOutPacketType.Asset); + OutPacket(TransferPacket, isWearable ? ThrottleOutPacketType.Task : ThrottleOutPacketType.Asset); processedLength += chunkSize; packetNumber++; @@ -3605,7 +3605,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } - OutPacket(aw, ThrottleOutPacketType.State); + OutPacket(aw, ThrottleOutPacketType.Task); } public void SendAppearance(UUID agentID, byte[] visualParams, byte[] textureEntry) @@ -3630,7 +3630,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP avp.Sender.IsTrial = false; avp.Sender.ID = agentID; m_log.DebugFormat("[CLIENT]: Sending appearance for {0} to {1}", agentID.ToString(), AgentId.ToString()); - OutPacket(avp, ThrottleOutPacketType.State); + OutPacket(avp, ThrottleOutPacketType.Task); } public void SendAnimations(UUID[] animations, int[] seqs, UUID sourceAgentId, UUID[] objectIDs) -- cgit v1.1 From 582cb89beb597247ceb6d82cdfc8fc983ffe8496 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 16 Jan 2013 19:29:27 +0100 Subject: Add a way to put things at the front of the queue for any throttle group. Adds a DoubleLocklessQueue and uses it for the outgoing buckets. Added a flag value to the Throttle Type (again) because although it's hacky, it's the best of a bad bunch to get the message through the UDP stack to where it's needed. --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 8 ++-- .../Region/ClientStack/Linden/UDP/LLUDPClient.cs | 54 ++++++++++++++++++---- .../Region/ClientStack/Linden/UDP/LLUDPServer.cs | 10 +++- 3 files changed, 57 insertions(+), 15 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 956c2c9..9550b5a 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -2788,7 +2788,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP Transfer.TransferInfo.Size = req.AssetInf.Data.Length; Transfer.TransferInfo.TransferID = req.TransferRequestID; Transfer.Header.Zerocoded = true; - OutPacket(Transfer, isWearable ? ThrottleOutPacketType.Task : ThrottleOutPacketType.Asset); + OutPacket(Transfer, isWearable ? ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority : ThrottleOutPacketType.Asset); if (req.NumPackets == 1) { @@ -2799,7 +2799,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP TransferPacket.TransferData.Data = req.AssetInf.Data; TransferPacket.TransferData.Status = 1; TransferPacket.Header.Zerocoded = true; - OutPacket(TransferPacket, isWearable ? ThrottleOutPacketType.Task : ThrottleOutPacketType.Asset); + OutPacket(TransferPacket, isWearable ? ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority : ThrottleOutPacketType.Asset); } else { @@ -2832,7 +2832,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP TransferPacket.TransferData.Status = 1; } TransferPacket.Header.Zerocoded = true; - OutPacket(TransferPacket, isWearable ? ThrottleOutPacketType.Task : ThrottleOutPacketType.Asset); + OutPacket(TransferPacket, isWearable ? ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority : ThrottleOutPacketType.Asset); processedLength += chunkSize; packetNumber++; @@ -3605,7 +3605,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } - OutPacket(aw, ThrottleOutPacketType.Task); + OutPacket(aw, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority); } public void SendAppearance(UUID agentID, byte[] visualParams, byte[] textureEntry) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index f1a1812..e52ac37 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs @@ -92,7 +92,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// Packets we have sent that need to be ACKed by the client public readonly UnackedPacketCollection NeedAcks = new UnackedPacketCollection(); /// ACKs that are queued up, waiting to be sent to the client - public readonly OpenSim.Framework.LocklessQueue PendingAcks = new OpenSim.Framework.LocklessQueue(); + public readonly DoubleLocklessQueue PendingAcks = new DoubleLocklessQueue(); /// Current packet sequence number public int CurrentSequence; @@ -146,7 +146,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// Throttle buckets for each packet category private readonly TokenBucket[] m_throttleCategories; /// Outgoing queues for throttled packets - private readonly OpenSim.Framework.LocklessQueue[] m_packetOutboxes = new OpenSim.Framework.LocklessQueue[THROTTLE_CATEGORY_COUNT]; + private readonly DoubleLocklessQueue[] m_packetOutboxes = new DoubleLocklessQueue[THROTTLE_CATEGORY_COUNT]; /// A container that can hold one packet for each outbox, used to store /// dequeued packets that are being held for throttling private readonly OutgoingPacket[] m_nextPackets = new OutgoingPacket[THROTTLE_CATEGORY_COUNT]; @@ -202,7 +202,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP ThrottleOutPacketType type = (ThrottleOutPacketType)i; // Initialize the packet outboxes, where packets sit while they are waiting for tokens - m_packetOutboxes[i] = new OpenSim.Framework.LocklessQueue(); + m_packetOutboxes[i] = new DoubleLocklessQueue(); // Initialize the token buckets that control the throttling for each category m_throttleCategories[i] = new TokenBucket(m_throttleCategory, rates.GetRate(type)); } @@ -430,15 +430,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// public bool EnqueueOutgoing(OutgoingPacket packet, bool forceQueue) { + return EnqueueOutgoing(packet, forceQueue, false); + } + + public bool EnqueueOutgoing(OutgoingPacket packet, bool forceQueue, bool highPriority) + { int category = (int)packet.Category; if (category >= 0 && category < m_packetOutboxes.Length) { - OpenSim.Framework.LocklessQueue queue = m_packetOutboxes[category]; + DoubleLocklessQueue queue = m_packetOutboxes[category]; if (m_deliverPackets == false) { - queue.Enqueue(packet); + queue.Enqueue(packet, highPriority); return true; } @@ -449,7 +454,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // queued packets if (queue.Count > 0) { - queue.Enqueue(packet); + queue.Enqueue(packet, highPriority); return true; } @@ -462,7 +467,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP else { // Force queue specified or not enough tokens in the bucket, queue this packet - queue.Enqueue(packet); + queue.Enqueue(packet, highPriority); return true; } } @@ -494,7 +499,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (m_deliverPackets == false) return false; OutgoingPacket packet = null; - OpenSim.Framework.LocklessQueue queue; + DoubleLocklessQueue queue; TokenBucket bucket; bool packetSent = false; ThrottleOutPacketTypeFlags emptyCategories = 0; @@ -534,7 +539,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } catch { - m_packetOutboxes[i] = new OpenSim.Framework.LocklessQueue(); + m_packetOutboxes[i] = new DoubleLocklessQueue(); } if (success) { @@ -567,7 +572,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } else { - m_packetOutboxes[i] = new OpenSim.Framework.LocklessQueue(); + m_packetOutboxes[i] = new DoubleLocklessQueue(); emptyCategories |= CategoryToFlag(i); } } @@ -724,4 +729,33 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } } + + public class DoubleLocklessQueue : OpenSim.Framework.LocklessQueue + { + OpenSim.Framework.LocklessQueue highQueue = new OpenSim.Framework.LocklessQueue(); + + public override int Count + { + get + { + return base.Count + highQueue.Count; + } + } + + public override bool Dequeue(out T item) + { + if (highQueue.Dequeue(out item)) + return true; + + return base.Dequeue(out item); + } + + public void Enqueue(T item, bool highPriority) + { + if (highPriority) + highQueue.Enqueue(item); + else + Enqueue(item); + } + } } diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 9a4abd4..6c72edc 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -803,6 +803,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP #region Queue or Send + bool highPriority = false; + + if (category != ThrottleOutPacketType.Unknown && (category & ThrottleOutPacketType.HighPriority) != 0) + { + category = (ThrottleOutPacketType)((int)category & 127); + highPriority = true; + } + OutgoingPacket outgoingPacket = new OutgoingPacket(udpClient, buffer, category, null); // If we were not provided a method for handling unacked, use the UDPServer default method outgoingPacket.UnackedMethod = ((method == null) ? delegate(OutgoingPacket oPacket) { ResendUnacked(oPacket); } : method); @@ -811,7 +819,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // continue to display the deleted object until relog. Therefore, we need to always queue a kill object // packet so that it isn't sent before a queued update packet. bool requestQueue = type == PacketType.KillObject; - if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket, requestQueue)) + if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket, requestQueue, highPriority)) SendPacketFinal(outgoingPacket); #endregion Queue or Send -- cgit v1.1 From 7bd9a0edb75ede38e71ca0f436bf89835b13d9ad Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 19 Jan 2013 14:30:38 +0100 Subject: Remove group IM test code also mentioning "OpenSimulator Testing" --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 27 +--------------------- 1 file changed, 1 insertion(+), 26 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 9550b5a..fd82db7 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -897,32 +897,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP msg.MessageBlock.Message = Util.StringToBytes1024(im.message); msg.MessageBlock.BinaryBucket = im.binaryBucket; - if (im.message.StartsWith("[grouptest]")) - { // this block is test code for implementing group IM - delete when group IM is finished - IEventQueue eq = Scene.RequestModuleInterface(); - if (eq != null) - { - im.dialog = 17; - - //eq.ChatterboxInvitation( - // new UUID("00000000-68f9-1111-024e-222222111123"), - // "OpenSimulator Testing", im.fromAgentID, im.message, im.toAgentID, im.fromAgentName, im.dialog, 0, - // false, 0, new Vector3(), 1, im.imSessionID, im.fromGroup, im.binaryBucket); - - eq.ChatterboxInvitation( - new UUID("00000000-68f9-1111-024e-222222111123"), - "OpenSimulator Testing", new UUID(im.fromAgentID), im.message, new UUID(im.toAgentID), im.fromAgentName, im.dialog, 0, - false, 0, new Vector3(), 1, new UUID(im.imSessionID), im.fromGroup, Util.StringToBytes256("OpenSimulator Testing")); - - eq.ChatterBoxSessionAgentListUpdates( - new UUID("00000000-68f9-1111-024e-222222111123"), - new UUID(im.fromAgentID), new UUID(im.toAgentID), false, false, false); - } - - Console.WriteLine("SendInstantMessage: " + msg); - } - else - OutPacket(msg, ThrottleOutPacketType.Task); + OutPacket(msg, ThrottleOutPacketType.Task); } } -- cgit v1.1 From cc1781926b4c49c72977d4ddb16cc583a9ffeb80 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 31 Jan 2013 20:37:58 +0000 Subject: * Adds a satisfying angular roll when an avatar is flying and turning. (General, not physics). Makes flying not feel as stiff. Conflicts: OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index fd82db7..f2b0160 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -4963,8 +4963,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP // in that direction, even though we don't model this on the server. Implementing this in the future // may improve movement smoothness. // acceleration = new Vector3(1, 0, 0); - - angularVelocity = Vector3.Zero; + + angularVelocity = presence.AngularVelocity; + rotation = presence.Rotation; if (sendTexture) textureEntry = presence.Appearance.Texture.GetBytes(); -- cgit v1.1 From 598f891d703593bde4b96472b5d1b1ce6aaf4c74 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 6 Feb 2013 04:03:32 +0100 Subject: Move SoubleQueu to Util. Change HTTP inv to prioritize COF. Determine COF for SP --- .../Region/ClientStack/Linden/UDP/LLUDPServer.cs | 108 --------------------- 1 file changed, 108 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 6c72edc..d49f1f7 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -1903,112 +1903,4 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } } - - internal class DoubleQueue where T:class - { - private Queue m_lowQueue = new Queue(); - private Queue m_highQueue = new Queue(); - - private object m_syncRoot = new object(); - private Semaphore m_s = new Semaphore(0, 1); - - public DoubleQueue() - { - } - - public virtual int Count - { - get { return m_highQueue.Count + m_lowQueue.Count; } - } - - public virtual void Enqueue(T data) - { - Enqueue(m_lowQueue, data); - } - - public virtual void EnqueueLow(T data) - { - Enqueue(m_lowQueue, data); - } - - public virtual void EnqueueHigh(T data) - { - Enqueue(m_highQueue, data); - } - - private void Enqueue(Queue q, T data) - { - lock (m_syncRoot) - { - m_lowQueue.Enqueue(data); - m_s.WaitOne(0); - m_s.Release(); - } - } - - public virtual T Dequeue() - { - return Dequeue(Timeout.Infinite); - } - - public virtual T Dequeue(int tmo) - { - return Dequeue(TimeSpan.FromMilliseconds(tmo)); - } - - public virtual T Dequeue(TimeSpan wait) - { - T res = null; - - if (!Dequeue(wait, ref res)) - return null; - - return res; - } - - public bool Dequeue(int timeout, ref T res) - { - return Dequeue(TimeSpan.FromMilliseconds(timeout), ref res); - } - - public bool Dequeue(TimeSpan wait, ref T res) - { - if (!m_s.WaitOne(wait)) - return false; - - lock (m_syncRoot) - { - if (m_highQueue.Count > 0) - res = m_highQueue.Dequeue(); - else - res = m_lowQueue.Dequeue(); - - if (m_highQueue.Count == 0 && m_lowQueue.Count == 0) - return true; - - try - { - m_s.Release(); - } - catch - { - } - - return true; - } - } - - public virtual void Clear() - { - - lock (m_syncRoot) - { - // Make sure sem count is 0 - m_s.WaitOne(0); - - m_lowQueue.Clear(); - m_highQueue.Clear(); - } - } - } } -- cgit v1.1 From 6aa876a83b08390ab057eb012fd2c730010f79d8 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 7 Feb 2013 03:40:48 +0000 Subject: Rename Bounciness to Restitution --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 0a39ded..f1fe6e1 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -2654,7 +2654,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP byte physshapetype = part.PhysicsShapeType; float density = part.Density; float friction = part.Friction; - float bounce = part.Bounciness; + float bounce = part.Restitution; float gravmod = part.GravityModifier; eq.partPhysicsProperties(localid, physshapetype, density, friction, bounce, gravmod,AgentId); -- cgit v1.1 From bbda7b94b3fe2350d5413879388cfce7309ca907 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 7 Feb 2013 03:40:48 +0000 Subject: Rename Bounciness to Restitution --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index f2b0160..ca15e3e 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -2654,7 +2654,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP byte physshapetype = part.PhysicsShapeType; float density = part.Density; float friction = part.Friction; - float bounce = part.Bounciness; + float bounce = part.Restitution; float gravmod = part.GravityModifier; eq.partPhysicsProperties(localid, physshapetype, density, friction, bounce, gravmod,AgentId); -- cgit v1.1 From 04235e58e87ae42617111cad2884e42785914d4e Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 12 Feb 2013 01:02:16 +0100 Subject: Push updates from keyframe directly to the front of the output queue rather than through the update system. --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index ca15e3e..8d46415 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -3721,6 +3721,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// public void SendEntityUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags) { + if ((updateFlags & PrimUpdateFlags.Immediate) != 0) + { + SendUnqueuedTerseUpdate((SceneObjectPart)entity); + return; + } + if (entity is SceneObjectPart) { SceneObjectPart e = (SceneObjectPart)entity; @@ -4075,6 +4081,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP ProcessEntityUpdates(-1); } + public void SendUnqueuedTerseUpdate(SceneObjectPart part) + { + ImprovedTerseObjectUpdatePacket packet + = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket( + PacketType.ImprovedTerseObjectUpdate); + packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; + packet.RegionData.TimeDilation = Utils.FloatToUInt16(1.0f, 0.0f, 1.0f); + packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; + + packet.ObjectData[0] = CreateImprovedTerseBlock(part, false); + + OutPacket(packet, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority); + } + #endregion Primitive Packet/Data Sending Methods // These are used to implement an adaptive backoff in the number -- cgit v1.1 From 048e904f051ccc38e7d00936b45288af3c6fc010 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 12 Feb 2013 01:13:30 +0100 Subject: Use actual time dilation for unqueued updates --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 8d46415..81a772b 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -4087,7 +4087,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket( PacketType.ImprovedTerseObjectUpdate); packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; - packet.RegionData.TimeDilation = Utils.FloatToUInt16(1.0f, 0.0f, 1.0f); + packet.RegionData.TimeDilation = Utils.FloatToUInt16(m_scene.TimeDilation, 0.0f, 1.0f); packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; packet.ObjectData[0] = CreateImprovedTerseBlock(part, false); -- cgit v1.1 From 2065590232894acb8dae15ff935dfae1405326a5 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 12 Feb 2013 03:15:32 +0100 Subject: Revert "Use actual time dilation for unqueued updates" This reverts commit 048e904f051ccc38e7d00936b45288af3c6fc010. --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 81a772b..8d46415 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -4087,7 +4087,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket( PacketType.ImprovedTerseObjectUpdate); packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; - packet.RegionData.TimeDilation = Utils.FloatToUInt16(m_scene.TimeDilation, 0.0f, 1.0f); + packet.RegionData.TimeDilation = Utils.FloatToUInt16(1.0f, 0.0f, 1.0f); packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; packet.ObjectData[0] = CreateImprovedTerseBlock(part, false); -- cgit v1.1 From 14c064c65da3d9cce045664f83daaeb7a79edcdd Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 12 Feb 2013 03:15:40 +0100 Subject: Revert "Push updates from keyframe directly to the front of the output queue rather" This reverts commit 04235e58e87ae42617111cad2884e42785914d4e. --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 20 -------------------- 1 file changed, 20 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 8d46415..ca15e3e 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -3721,12 +3721,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// public void SendEntityUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags) { - if ((updateFlags & PrimUpdateFlags.Immediate) != 0) - { - SendUnqueuedTerseUpdate((SceneObjectPart)entity); - return; - } - if (entity is SceneObjectPart) { SceneObjectPart e = (SceneObjectPart)entity; @@ -4081,20 +4075,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP ProcessEntityUpdates(-1); } - public void SendUnqueuedTerseUpdate(SceneObjectPart part) - { - ImprovedTerseObjectUpdatePacket packet - = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket( - PacketType.ImprovedTerseObjectUpdate); - packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; - packet.RegionData.TimeDilation = Utils.FloatToUInt16(1.0f, 0.0f, 1.0f); - packet.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; - - packet.ObjectData[0] = CreateImprovedTerseBlock(part, false); - - OutPacket(packet, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority); - } - #endregion Primitive Packet/Data Sending Methods // These are used to implement an adaptive backoff in the number -- cgit v1.1 From 4be35df5fa1f1ba364ac45ae8b2585319dfbdbae Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 16 Feb 2013 05:09:27 +0100 Subject: Fix shape parameters sent for meshes tosupport the full number of faces --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index ca15e3e..0267805 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -3893,6 +3893,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP part.Shape.LightEntry = false; } } + + if (part.Shape != null && (part.Shape.SculptType == (byte)SculptType.Mesh)) + { + // Ensure that mesh has at least 8 valid faces + part.Shape.ProfileBegin = 12500; + part.Shape.ProfileEnd = 0; + part.Shape.ProfileHollow = 27500; + } } ++updatesThisCall; -- cgit v1.1 From da2b59848461d0f309067762403f9143551bb5ba Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 25 Feb 2013 18:26:59 +0100 Subject: Make banking no longer break sit rotations. Fix spinning avatars. --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 0267805..0388828 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -4960,6 +4960,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP position = part.OffsetPosition + presence.OffsetPosition * part.RotationOffset; rotation = part.RotationOffset * presence.Rotation; } + angularVelocity = Vector3.Zero; + } + else + { + angularVelocity = presence.AngularVelocity; + rotation = presence.Rotation; } attachPoint = 0; @@ -4972,9 +4978,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP // may improve movement smoothness. // acceleration = new Vector3(1, 0, 0); - angularVelocity = presence.AngularVelocity; - rotation = presence.Rotation; - if (sendTexture) textureEntry = presence.Appearance.Texture.GetBytes(); else -- cgit v1.1 From c341664c1b8ccf3bd7b81795b900b971a15ff318 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 24 Mar 2013 18:56:28 +0100 Subject: Phase 1 of implementing a transfer permission. Overwrite libOMV's PermissionMask with our own and add export permissions as well as a new definition for "All" as meaning "all conventional permissions" rather than "all possible permissions" --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 5b2bad4..f8b9352 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -51,6 +51,7 @@ using RegionFlags = OpenMetaverse.RegionFlags; using Nini.Config; using System.IO; +using PermissionMask = OpenSim.Framework.PermissionMask; namespace OpenSim.Region.ClientStack.LindenUDP { @@ -1802,7 +1803,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP public void SendInventoryItemDetails(UUID ownerID, InventoryItemBase item) { - const uint FULL_MASK_PERMISSIONS = (uint)PermissionMask.All; + // Fudge this value. It's only needed to make the CRC anyway + const uint FULL_MASK_PERMISSIONS = (uint)0x7fffffff; FetchInventoryReplyPacket inventoryReply = (FetchInventoryReplyPacket)PacketPool.Instance.GetPacket(PacketType.FetchInventoryReply); // TODO: don't create new blocks if recycling an old packet @@ -2007,7 +2009,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP protected void SendBulkUpdateInventoryItem(InventoryItemBase item) { - const uint FULL_MASK_PERMISSIONS = (uint)PermissionMask.All; + const uint FULL_MASK_PERMISSIONS = (uint)0x7ffffff; BulkUpdateInventoryPacket bulkUpdate = (BulkUpdateInventoryPacket)PacketPool.Instance.GetPacket(PacketType.BulkUpdateInventory); @@ -2066,7 +2068,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// IClientAPI.SendInventoryItemCreateUpdate(InventoryItemBase) public void SendInventoryItemCreateUpdate(InventoryItemBase Item, UUID transactionID, uint callbackId) { - const uint FULL_MASK_PERMISSIONS = (uint)PermissionMask.All; + const uint FULL_MASK_PERMISSIONS = (uint)0x7fffffff; UpdateCreateInventoryItemPacket InventoryReply = (UpdateCreateInventoryItemPacket)PacketPool.Instance.GetPacket( -- cgit v1.1 From 6571e7ead276027e5ed86cb1fc9d1b47ddae2e6e Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 22 Apr 2013 22:24:41 +0200 Subject: Allow callers to set the invoice parameter for GenericMessage --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index f8b9352..4979be8 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -903,9 +903,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } - public void SendGenericMessage(string method, List message) + public void SendGenericMessage(string method, UUID invoice, List message) { GenericMessagePacket gmp = new GenericMessagePacket(); + + gmp.AgentData.AgentID = AgentId; + gmp.AgentData.SessionID = m_sessionId; + gmp.AgentData.TransactionID = invoice; + gmp.MethodData.Method = Util.StringToBytes256(method); gmp.ParamList = new GenericMessagePacket.ParamListBlock[message.Count]; int i = 0; @@ -918,9 +923,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP OutPacket(gmp, ThrottleOutPacketType.Task); } - public void SendGenericMessage(string method, List message) + public void SendGenericMessage(string method, UUID invoice, List message) { GenericMessagePacket gmp = new GenericMessagePacket(); + + gmp.AgentData.AgentID = AgentId; + gmp.AgentData.SessionID = m_sessionId; + gmp.AgentData.TransactionID = invoice; + gmp.MethodData.Method = Util.StringToBytes256(method); gmp.ParamList = new GenericMessagePacket.ParamListBlock[message.Count]; int i = 0; -- cgit v1.1 From 40036ca05f3a34ef7f0728ed52878068a66bc502 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 25 Apr 2013 21:35:18 +0100 Subject: Change EconomyDataRequest signature to use an IClientAPI rather than UUID. This is needed because recent LL viewer codebases call this earlier in login when the client is not yet established in the sim and can't be found by UUID. Sending the reply requires having the IClientAPI. --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 4979be8..98160c9 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -9860,7 +9860,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP EconomyDataRequest handlerEconomoyDataRequest = OnEconomyDataRequest; if (handlerEconomoyDataRequest != null) { - handlerEconomoyDataRequest(AgentId); + handlerEconomoyDataRequest(this); } return true; } -- cgit v1.1 From f9daf921f72e9962546fe5cfcc45db3ace8f903c Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 13 May 2013 03:29:11 +0200 Subject: Explicitly zero avatar velocity on sit --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 98160c9..d5b7ec8 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -5124,6 +5124,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP 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); -- cgit v1.1 From 0086c3b5fb24f4a25fe2e28f9cedcaa41c70b36c Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 25 May 2013 01:58:50 +0200 Subject: Update the money framework to allow sending the new style linden "serverside is now viewerside" messages regarding currency This will require all money modules to be refactored! --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 30 ++++++++++------------ 1 file changed, 14 insertions(+), 16 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index d5b7ec8..7208f08 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -354,7 +354,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP // protected HashSet m_attachmentsSent; - private int m_moneyBalance; private bool m_deliverPackets = true; private int m_animationSequenceNumber = 1; private bool m_SendLogoutPacketWhenClosing = true; @@ -438,7 +437,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP public string Name { get { return FirstName + " " + LastName; } } public uint CircuitCode { get { return m_circuitCode; } } - public int MoneyBalance { get { return m_moneyBalance; } } public int NextAnimationSequenceNumber { get { return m_animationSequenceNumber++; } } /// @@ -502,7 +500,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_firstName = sessionInfo.LoginInfo.First; m_lastName = sessionInfo.LoginInfo.Last; m_startpos = sessionInfo.LoginInfo.StartPos; - m_moneyBalance = 1000; m_udpServer = udpServer; m_udpClient = udpClient; @@ -1526,7 +1523,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP OutPacket(tpProgress, ThrottleOutPacketType.Unknown); } - public void SendMoneyBalance(UUID transaction, bool success, byte[] description, int balance) + public void SendMoneyBalance(UUID transaction, bool success, byte[] description, int balance, int transactionType, UUID sourceID, bool sourceIsGroup, UUID destID, bool destIsGroup, int amount, string item) { MoneyBalanceReplyPacket money = (MoneyBalanceReplyPacket)PacketPool.Instance.GetPacket(PacketType.MoneyBalanceReply); money.MoneyData.AgentID = AgentId; @@ -1534,7 +1531,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP money.MoneyData.TransactionSuccess = success; money.MoneyData.Description = description; money.MoneyData.MoneyBalance = balance; - money.TransactionInfo.ItemDescription = Util.StringToBytes256("NONE"); + money.TransactionInfo.TransactionType = transactionType; + money.TransactionInfo.SourceID = sourceID; + money.TransactionInfo.IsSourceGroup = sourceIsGroup; + money.TransactionInfo.DestID = destID; + money.TransactionInfo.IsDestGroup = destIsGroup; + money.TransactionInfo.Amount = amount; + money.TransactionInfo.ItemDescription = Util.StringToBytes256(item); + OutPacket(money, ThrottleOutPacketType.Task); } @@ -2278,6 +2282,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// public AgentAlertMessagePacket BuildAgentAlertPacket(string message, bool modal) { + // Prepend a slash to make the message come up in the top right + // again. + // Allow special formats to be sent from aware modules. + if (!modal && !message.StartsWith("ALERT: ") && !message.StartsWith("NOTIFY: ") && message != "Home position set." && message != "You died and have been teleported to your home location") + message = "/" + message; AgentAlertMessagePacket alertPack = (AgentAlertMessagePacket)PacketPool.Instance.GetPacket(PacketType.AgentAlertMessage); alertPack.AgentData.AgentID = AgentId; alertPack.AlertData.Message = Util.StringToBytes256(message); @@ -12217,17 +12226,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_udpServer.SendPacket(m_udpClient, packet, throttlePacketType, doAutomaticSplitting, method); } - public bool AddMoney(int debit) - { - if (m_moneyBalance + debit >= 0) - { - m_moneyBalance += debit; - SendMoneyBalance(UUID.Zero, true, Util.StringToBytes256("Poof Poof!"), m_moneyBalance); - return true; - } - return false; - } - protected void HandleAutopilot(Object sender, string method, List args) { float locx = 0; -- cgit v1.1 From 9589a09eda2a08c12dc54a99fb04faa18e5c6de7 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 31 May 2013 22:02:31 +0200 Subject: Fix multi-wear of alpha and tattoo layers. --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 7208f08..eebb8ae 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -1737,7 +1737,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP newBlock.CreationDate = item.CreationDate; newBlock.SalePrice = item.SalePrice; newBlock.SaleType = item.SaleType; - newBlock.Flags = item.Flags; + newBlock.Flags = item.Flags & 0xff; newBlock.CRC = Helpers.InventoryCRC(newBlock.CreationDate, newBlock.SaleType, @@ -1991,7 +1991,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP itemBlock.GroupID = item.GroupID; itemBlock.GroupOwned = item.GroupOwned; itemBlock.GroupMask = item.GroupPermissions; - itemBlock.Flags = item.Flags; + itemBlock.Flags = item.Flags & 0xff; itemBlock.SalePrice = item.SalePrice; itemBlock.SaleType = item.SaleType; itemBlock.CreationDate = item.CreationDate; @@ -2058,7 +2058,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP bulkUpdate.ItemData[0].GroupID = item.GroupID; bulkUpdate.ItemData[0].GroupOwned = item.GroupOwned; bulkUpdate.ItemData[0].GroupMask = item.GroupPermissions; - bulkUpdate.ItemData[0].Flags = item.Flags; + bulkUpdate.ItemData[0].Flags = item.Flags & 0xff; bulkUpdate.ItemData[0].SalePrice = item.SalePrice; bulkUpdate.ItemData[0].SaleType = item.SaleType; @@ -2112,7 +2112,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP InventoryReply.InventoryData[0].GroupID = Item.GroupID; InventoryReply.InventoryData[0].GroupOwned = Item.GroupOwned; InventoryReply.InventoryData[0].GroupMask = Item.GroupPermissions; - InventoryReply.InventoryData[0].Flags = Item.Flags; + InventoryReply.InventoryData[0].Flags = Item.Flags & 0xff; InventoryReply.InventoryData[0].SalePrice = Item.SalePrice; InventoryReply.InventoryData[0].SaleType = Item.SaleType; InventoryReply.InventoryData[0].CreationDate = Item.CreationDate; -- cgit v1.1 From ddf67bf929fbc32d8319f777b248642b4da0305a Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 8 Sep 2013 19:41:51 +0200 Subject: Mono 2.0 fix - call ToArray() explicitly --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index eebb8ae..f4ea975 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -3933,6 +3933,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP part.Shape.ProfileHollow = 27500; } } + else if (update.Entity is ScenePresence) + { + ScenePresence presence = (ScenePresence)update.Entity; + + // If ParentUUID is not UUID.Zero and ParentID is 0, this + // avatar is in the process of crossing regions while + // sat on an object. In this state, we don't want any + // updates because they will visually orbit the avatar. + // Update will be forced once crossing is completed anyway. + if (presence.ParentUUID != UUID.Zero && presence.ParentID == 0) + continue; + } ++updatesThisCall; -- cgit v1.1 From f93dac9239dc71020f143339997b3b7abc15f69d Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sun, 20 Apr 2014 10:47:31 +0200 Subject: Implement Oren's fix to prevent a privilege escalation with groups --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index f4ea975..7c62f90 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -2233,9 +2233,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP public void SendAgentDataUpdate(UUID agentid, UUID activegroupid, string firstname, string lastname, ulong grouppowers, string groupname, string grouptitle) { - m_activeGroupID = activegroupid; - m_activeGroupName = groupname; - m_activeGroupPowers = grouppowers; + if (agentid == AgentId) + { + m_activeGroupID = activegroupid; + m_activeGroupName = groupname; + m_activeGroupPowers = grouppowers; + } AgentDataUpdatePacket sendAgentDataUpdate = (AgentDataUpdatePacket)PacketPool.Instance.GetPacket(PacketType.AgentDataUpdate); sendAgentDataUpdate.AgentData.ActiveGroupID = activegroupid; -- cgit v1.1 From 5000a5c038ddc2a8d5cd8cd46e9dcb9a0845faae Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sun, 20 Jul 2014 00:17:35 +0200 Subject: Fix coalesced objects not showing up as "piles" of prims (AVN only bug) --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index f599342..b4a0a98 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -1794,7 +1794,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP newBlock.CreationDate = item.CreationDate; newBlock.SalePrice = item.SalePrice; newBlock.SaleType = item.SaleType; - newBlock.Flags = item.Flags & 0xff; + newBlock.Flags = item.Flags & 0x2000ff; newBlock.CRC = Helpers.InventoryCRC(newBlock.CreationDate, newBlock.SaleType, @@ -2048,7 +2048,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP itemBlock.GroupID = item.GroupID; itemBlock.GroupOwned = item.GroupOwned; itemBlock.GroupMask = item.GroupPermissions; - itemBlock.Flags = item.Flags & 0xff; + itemBlock.Flags = item.Flags & 0x2000ff; itemBlock.SalePrice = item.SalePrice; itemBlock.SaleType = item.SaleType; itemBlock.CreationDate = item.CreationDate; @@ -2115,7 +2115,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP bulkUpdate.ItemData[0].GroupID = item.GroupID; bulkUpdate.ItemData[0].GroupOwned = item.GroupOwned; bulkUpdate.ItemData[0].GroupMask = item.GroupPermissions; - bulkUpdate.ItemData[0].Flags = item.Flags & 0xff; + bulkUpdate.ItemData[0].Flags = item.Flags & 0x2000ff; bulkUpdate.ItemData[0].SalePrice = item.SalePrice; bulkUpdate.ItemData[0].SaleType = item.SaleType; @@ -2169,7 +2169,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP InventoryReply.InventoryData[0].GroupID = Item.GroupID; InventoryReply.InventoryData[0].GroupOwned = Item.GroupOwned; InventoryReply.InventoryData[0].GroupMask = Item.GroupPermissions; - InventoryReply.InventoryData[0].Flags = Item.Flags & 0xff; + InventoryReply.InventoryData[0].Flags = Item.Flags & 0x2000ff; InventoryReply.InventoryData[0].SalePrice = Item.SalePrice; InventoryReply.InventoryData[0].SaleType = Item.SaleType; InventoryReply.InventoryData[0].CreationDate = Item.CreationDate; -- cgit v1.1 From a5fcc0c0c0f41ea3cf490e8061f71a6a2afeca02 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 20 Jul 2014 14:47:35 +0100 Subject: remove avn hack on sitted avatars positions --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 30 +++------------------- 1 file changed, 3 insertions(+), 27 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index b4a0a98..f7338fc 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -5132,22 +5132,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP position = presence.OffsetPosition; rotation = presence.Rotation; - - if (presence.ParentID != 0) - { - SceneObjectPart part = m_scene.GetSceneObjectPart(presence.ParentID); - if (part != null && part != part.ParentGroup.RootPart) - { - position = part.OffsetPosition + presence.OffsetPosition * part.RotationOffset; - rotation = part.RotationOffset * presence.Rotation; - } - angularVelocity = Vector3.Zero; - } - else - { - angularVelocity = presence.AngularVelocity; - rotation = presence.Rotation; - } + angularVelocity = presence.AngularVelocity; + rotation = presence.Rotation; attachPoint = 0; // m_log.DebugFormat( @@ -5266,17 +5252,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP Vector3 offsetPosition = data.OffsetPosition; Quaternion rotation = data.Rotation; uint parentID = data.ParentID; - - if (parentID != 0) - { - SceneObjectPart part = m_scene.GetSceneObjectPart(parentID); - if (part != null && part != part.ParentGroup.RootPart) - { - offsetPosition = part.OffsetPosition + data.OffsetPosition * part.RotationOffset; - rotation = part.RotationOffset * data.Rotation; - parentID = part.ParentGroup.RootPart.LocalId; - } - } + // m_log.DebugFormat( // "[LLCLIENTVIEW]: Sending full update to {0} with position {1} in {2}", Name, data.OffsetPosition, m_scene.Name); -- cgit v1.1 From 3e73e96befad493a2e647567683566dc2b52823f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 22 Jul 2014 01:49:42 +0100 Subject: fix HUD attachment update filter to allow avatar center etc --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index f7338fc..779e563 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -3805,7 +3805,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { SceneObjectPart e = (SceneObjectPart)entity; SceneObjectGroup g = e.ParentGroup; - if (g.RootPart.Shape.State > 30) // HUD + if (g.RootPart.Shape.State > 30 && g.RootPart.Shape.State < 39) // HUD if (g.OwnerID != AgentId) return; // Don't send updates for other people's HUDs } @@ -3925,7 +3925,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 > 30 && part.ParentGroup.RootPart.Shape.State < 39) continue; ScenePresence sp; // Owner is not in the sim, don't update it to -- cgit v1.1 From 55df2b317c720888f42b9a4ec7d750f3657cecb4 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 27 Jul 2014 12:02:59 +0100 Subject: dont send packets twice --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 1 - 1 file changed, 1 deletion(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 50dae2a..b7c8594 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -1079,7 +1079,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP // packet so that it isn't sent before a queued update packet. bool requestQueue = type == PacketType.KillObject; if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket, requestQueue, highPriority)) - if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket, requestQueue)) { SendPacketFinal(outgoingPacket); return true; -- cgit v1.1 From 477b5b5623dd58a6ccc8812223df4bb436d450d1 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Tue, 29 Jul 2014 03:40:05 +0200 Subject: Add new fields to parcel update --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 779e563..969d946 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -4974,7 +4974,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP IEventQueue eq = Scene.RequestModuleInterface(); if (eq != null) { - eq.ParcelProperties(updateMessage, this.AgentId); + OSD message_body = updateMessage.Serialize(); + // Add new fields here until OMV has them + OSDMap parcelData = (OSDMap)message_body; + parcelData["SeeAVs"] = OSD.FromBoolean(true); + parcelData["AnyAVSounds"] = OSD.FromBoolean(true); + parcelData["GroupAVSounds"] = OSD.FromBoolean(true); + OSDMap message = new OSDMap(); + message.Add("message", OSD.FromString("ParcelProperties")); + message.Add("body", message_body); + eq.Enqueue (message, this.AgentId); + //eq.ParcelProperties(updateMessage, this.AgentId); } else { -- cgit v1.1 From dfa9780c8c09c795bdd0dec6174ee8680c534e47 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Tue, 29 Jul 2014 04:19:01 +0200 Subject: Send new parcel permissions to activate viewer options - done right this time --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 969d946..3c44c5f 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -4976,10 +4976,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP { OSD message_body = updateMessage.Serialize(); // Add new fields here until OMV has them - OSDMap parcelData = (OSDMap)message_body; - parcelData["SeeAVs"] = OSD.FromBoolean(true); - parcelData["AnyAVSounds"] = OSD.FromBoolean(true); - parcelData["GroupAVSounds"] = OSD.FromBoolean(true); + OSDMap bodyMap = (OSDMap)message_body; + OSDArray parcelDataArray = (OSDArray)bodyMap["ParcelData"]; + OSDMap parcelData = (OSDMap)parcelDataArray[0]; + parcelData["SeeAVs"] = OSD.FromBoolean(landData.SeeAVs); + parcelData["AnyAVSounds"] = OSD.FromBoolean(landData.AnyAVSounds); + parcelData["GroupAVSounds"] = OSD.FromBoolean(landData.GroupAVSounds); OSDMap message = new OSDMap(); message.Add("message", OSD.FromString("ParcelProperties")); message.Add("body", message_body); -- cgit v1.1 From 30f00bfb14cce582382bd37b1e22062af664ec64 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 30 Jul 2014 21:11:11 +0100 Subject: make HandlerRegionHandshakeReply processing async and delay it a bit. This delays things like terrain height map sending, giving chance to completemovent to send more priority information. POssible things on this should be on other event trigger when its more apropriate really done. --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 3c44c5f..34a2797 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -4879,7 +4879,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) { // m_log.DebugFormat("[LLCLIENTVIEW]: Sending land properties for {0} to {1}", lo.LandData.GlobalID, Name); - + LandData landData = lo.LandData; ParcelPropertiesMessage updateMessage = new ParcelPropertiesMessage(); @@ -5517,7 +5517,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP AddLocalPacketHandler(PacketType.RezObject, HandlerRezObject); AddLocalPacketHandler(PacketType.DeRezObject, HandlerDeRezObject); AddLocalPacketHandler(PacketType.ModifyLand, HandlerModifyLand); - AddLocalPacketHandler(PacketType.RegionHandshakeReply, HandlerRegionHandshakeReply, false); + +// AddLocalPacketHandler(PacketType.RegionHandshakeReply, HandlerRegionHandshakeReply, false); + AddLocalPacketHandler(PacketType.RegionHandshakeReply, HandlerRegionHandshakeReply, true); + AddLocalPacketHandler(PacketType.AgentWearablesRequest, HandlerAgentWearablesRequest); AddLocalPacketHandler(PacketType.AgentSetAppearance, HandlerAgentSetAppearance); AddLocalPacketHandler(PacketType.AgentIsNowWearing, HandlerAgentIsNowWearing); @@ -6473,6 +6476,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP Action handlerRegionHandShakeReply = OnRegionHandShakeReply; if (handlerRegionHandShakeReply != null) { + Thread.Sleep(500); handlerRegionHandShakeReply(this); } -- cgit v1.1 From 05a2feba5d780c57c252891a20071800fd9f2e3e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 4 Aug 2014 19:57:47 +0100 Subject: start sending terrain in scenePresence after well defined avatar. Minor change on significante AgentUpdate check. --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 28 +++++++++++++----- .../Region/ClientStack/Linden/UDP/LLUDPServer.cs | 34 +++++++++++----------- 2 files changed, 37 insertions(+), 25 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 34a2797..7d61577 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -577,7 +577,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Fire the callback for this connection closing if (OnConnectionClosed != null) + { OnConnectionClosed(this); + } + // Flush all of the packets out of the UDP server for this client if (m_udpServer != null) @@ -5518,8 +5521,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP AddLocalPacketHandler(PacketType.DeRezObject, HandlerDeRezObject); AddLocalPacketHandler(PacketType.ModifyLand, HandlerModifyLand); -// AddLocalPacketHandler(PacketType.RegionHandshakeReply, HandlerRegionHandshakeReply, false); - AddLocalPacketHandler(PacketType.RegionHandshakeReply, HandlerRegionHandshakeReply, true); + AddLocalPacketHandler(PacketType.RegionHandshakeReply, HandlerRegionHandshakeReply, false); AddLocalPacketHandler(PacketType.AgentWearablesRequest, HandlerAgentWearablesRequest); AddLocalPacketHandler(PacketType.AgentSetAppearance, HandlerAgentSetAppearance); @@ -5732,10 +5734,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP #region Scene/Avatar // Threshold for body rotation to be a significant agent update - private const float QDELTA = 0.000001f; + // private const float QDELTA = 0.000001f; + // QDELTA is now relative to abs of cos of angle between orientations + + private const float QDELTABODY = 1 - 0.0001f; + private const float QDELTAHEAD = 1 - 0.0001f; + // Threshold for camera rotation to be a significant agent update private const float VDELTA = 0.01f; - + /// /// This checks the update significance against the last update made. /// @@ -5755,13 +5762,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// private bool CheckAgentMovementUpdateSignificance(AgentUpdatePacket.AgentDataBlock x) { - float qdelta1 = 1 - (float)Math.Pow(Quaternion.Dot(x.BodyRotation, m_thisAgentUpdateArgs.BodyRotation), 2); + // float qdelta1 = 1 - (float)Math.Pow(Quaternion.Dot(x.BodyRotation, m_thisAgentUpdateArgs.BodyRotation), 2); //qdelta2 = 1 - (float)Math.Pow(Quaternion.Dot(x.HeadRotation, m_thisAgentUpdateArgs.HeadRotation), 2); + // now using abs of cos + float qdelta1 = (float)Math.Abs(Quaternion.Dot(x.BodyRotation, m_thisAgentUpdateArgs.BodyRotation)); + float qdelta2 = (float)Math.Abs(Quaternion.Dot(x.HeadRotation, m_thisAgentUpdateArgs.HeadRotation)); bool movementSignificant = - (qdelta1 > QDELTA) // significant if body rotation above threshold - // Ignoring head rotation altogether, because it's not being used for anything interesting up the stack +// (qdelta1 > QDELTA) // significant if body rotation above threshold + (qdelta1 < QDELTABODY) // higher angle lower cos +// Ignoring head rotation altogether, because it's not being used for anything interesting up the stack // || (qdelta2 > QDELTA * 10) // significant if head rotation above threshold + || (qdelta2 < QDELTAHEAD) // using cos above || (x.ControlFlags != m_thisAgentUpdateArgs.ControlFlags) // significant if control flags changed || (x.ControlFlags != (byte)AgentManager.ControlFlags.NONE) // significant if user supplying any movement update commands || (x.Far != m_thisAgentUpdateArgs.Far) // significant if far distance changed @@ -6476,7 +6488,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP Action handlerRegionHandShakeReply = OnRegionHandShakeReply; if (handlerRegionHandShakeReply != null) { - Thread.Sleep(500); +// Thread.Sleep(500); handlerRegionHandShakeReply(this); } diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index b7c8594..a3fdae1 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -1750,25 +1750,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP endPoint, sessionInfo); - // Send ack straight away to let the viewer know that the connection is active. - // The client will be null if it already exists (e.g. if on a region crossing the client sends a use - // circuit code to the existing child agent. This is not particularly obvious. - SendAckImmediate(endPoint, uccp.Header.Sequence); - - // We only want to send initial data to new clients, not ones which are being converted from child to root. - if (client != null) - { - AgentCircuitData aCircuit = m_scene.AuthenticateHandler.GetAgentCircuitData(uccp.CircuitCode.Code); - bool tp = (aCircuit.teleportFlags > 0); - // Let's delay this for TP agents, otherwise the viewer doesn't know where to get resources from - if (!tp) - client.SceneAgent.SendInitialDataToMe(); - } - // Now we know we can handle more data - Thread.Sleep(200); +// Thread.Sleep(200); - // Obtain the queue and remove it from the cache + // Obtain the pending queue and remove it from the cache Queue queue = null; lock (m_pendingCache) @@ -1790,6 +1775,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP PacketReceived(buf); } queue = null; + + // Send ack straight away to let the viewer know that the connection is active. + // The client will be null if it already exists (e.g. if on a region crossing the client sends a use + // circuit code to the existing child agent. This is not particularly obvious. + SendAckImmediate(endPoint, uccp.Header.Sequence); + + // We only want to send initial data to new clients, not ones which are being converted from child to root. + if (client != null) + { + AgentCircuitData aCircuit = m_scene.AuthenticateHandler.GetAgentCircuitData(uccp.CircuitCode.Code); + bool tp = (aCircuit.teleportFlags > 0); + // Let's delay this for TP agents, otherwise the viewer doesn't know where to get resources from + if (!tp) + client.SceneAgent.SendInitialDataToMe(); + } } else { -- cgit v1.1 From 3d81f25e34cd7d536ad0e36242703ac1bc56038d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 4 Aug 2014 20:32:11 +0100 Subject: Revert "start sending terrain in scenePresence after well defined avatar. Minor" This reverts commit 05a2feba5d780c57c252891a20071800fd9f2e3e. --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 28 +++++------------- .../Region/ClientStack/Linden/UDP/LLUDPServer.cs | 34 +++++++++++----------- 2 files changed, 25 insertions(+), 37 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 7d61577..34a2797 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -577,10 +577,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Fire the callback for this connection closing if (OnConnectionClosed != null) - { OnConnectionClosed(this); - } - // Flush all of the packets out of the UDP server for this client if (m_udpServer != null) @@ -5521,7 +5518,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP AddLocalPacketHandler(PacketType.DeRezObject, HandlerDeRezObject); AddLocalPacketHandler(PacketType.ModifyLand, HandlerModifyLand); - AddLocalPacketHandler(PacketType.RegionHandshakeReply, HandlerRegionHandshakeReply, false); +// AddLocalPacketHandler(PacketType.RegionHandshakeReply, HandlerRegionHandshakeReply, false); + AddLocalPacketHandler(PacketType.RegionHandshakeReply, HandlerRegionHandshakeReply, true); AddLocalPacketHandler(PacketType.AgentWearablesRequest, HandlerAgentWearablesRequest); AddLocalPacketHandler(PacketType.AgentSetAppearance, HandlerAgentSetAppearance); @@ -5734,15 +5732,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP #region Scene/Avatar // Threshold for body rotation to be a significant agent update - // private const float QDELTA = 0.000001f; - // QDELTA is now relative to abs of cos of angle between orientations - - private const float QDELTABODY = 1 - 0.0001f; - private const float QDELTAHEAD = 1 - 0.0001f; - + private const float QDELTA = 0.000001f; // Threshold for camera rotation to be a significant agent update private const float VDELTA = 0.01f; - + /// /// This checks the update significance against the last update made. /// @@ -5762,18 +5755,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// private bool CheckAgentMovementUpdateSignificance(AgentUpdatePacket.AgentDataBlock x) { - // float qdelta1 = 1 - (float)Math.Pow(Quaternion.Dot(x.BodyRotation, m_thisAgentUpdateArgs.BodyRotation), 2); + float qdelta1 = 1 - (float)Math.Pow(Quaternion.Dot(x.BodyRotation, m_thisAgentUpdateArgs.BodyRotation), 2); //qdelta2 = 1 - (float)Math.Pow(Quaternion.Dot(x.HeadRotation, m_thisAgentUpdateArgs.HeadRotation), 2); - // now using abs of cos - float qdelta1 = (float)Math.Abs(Quaternion.Dot(x.BodyRotation, m_thisAgentUpdateArgs.BodyRotation)); - float qdelta2 = (float)Math.Abs(Quaternion.Dot(x.HeadRotation, m_thisAgentUpdateArgs.HeadRotation)); bool movementSignificant = -// (qdelta1 > QDELTA) // significant if body rotation above threshold - (qdelta1 < QDELTABODY) // higher angle lower cos -// Ignoring head rotation altogether, because it's not being used for anything interesting up the stack + (qdelta1 > QDELTA) // significant if body rotation above threshold + // Ignoring head rotation altogether, because it's not being used for anything interesting up the stack // || (qdelta2 > QDELTA * 10) // significant if head rotation above threshold - || (qdelta2 < QDELTAHEAD) // using cos above || (x.ControlFlags != m_thisAgentUpdateArgs.ControlFlags) // significant if control flags changed || (x.ControlFlags != (byte)AgentManager.ControlFlags.NONE) // significant if user supplying any movement update commands || (x.Far != m_thisAgentUpdateArgs.Far) // significant if far distance changed @@ -6488,7 +6476,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP Action handlerRegionHandShakeReply = OnRegionHandShakeReply; if (handlerRegionHandShakeReply != null) { -// Thread.Sleep(500); + Thread.Sleep(500); handlerRegionHandShakeReply(this); } diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index a3fdae1..b7c8594 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -1750,10 +1750,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP endPoint, sessionInfo); + // Send ack straight away to let the viewer know that the connection is active. + // The client will be null if it already exists (e.g. if on a region crossing the client sends a use + // circuit code to the existing child agent. This is not particularly obvious. + SendAckImmediate(endPoint, uccp.Header.Sequence); + + // We only want to send initial data to new clients, not ones which are being converted from child to root. + if (client != null) + { + AgentCircuitData aCircuit = m_scene.AuthenticateHandler.GetAgentCircuitData(uccp.CircuitCode.Code); + bool tp = (aCircuit.teleportFlags > 0); + // Let's delay this for TP agents, otherwise the viewer doesn't know where to get resources from + if (!tp) + client.SceneAgent.SendInitialDataToMe(); + } + // Now we know we can handle more data -// Thread.Sleep(200); + Thread.Sleep(200); - // Obtain the pending queue and remove it from the cache + // Obtain the queue and remove it from the cache Queue queue = null; lock (m_pendingCache) @@ -1775,21 +1790,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP PacketReceived(buf); } queue = null; - - // Send ack straight away to let the viewer know that the connection is active. - // The client will be null if it already exists (e.g. if on a region crossing the client sends a use - // circuit code to the existing child agent. This is not particularly obvious. - SendAckImmediate(endPoint, uccp.Header.Sequence); - - // We only want to send initial data to new clients, not ones which are being converted from child to root. - if (client != null) - { - AgentCircuitData aCircuit = m_scene.AuthenticateHandler.GetAgentCircuitData(uccp.CircuitCode.Code); - bool tp = (aCircuit.teleportFlags > 0); - // Let's delay this for TP agents, otherwise the viewer doesn't know where to get resources from - if (!tp) - client.SceneAgent.SendInitialDataToMe(); - } } else { -- cgit v1.1 From 3cca5ec6674b413a419d3f1c42467e57fb883f56 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 4 Aug 2014 21:52:29 +0100 Subject: check... --- .../Region/ClientStack/Linden/UDP/LLUDPServer.cs | 34 +++++++++++----------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index b7c8594..a3fdae1 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -1750,25 +1750,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP endPoint, sessionInfo); - // Send ack straight away to let the viewer know that the connection is active. - // The client will be null if it already exists (e.g. if on a region crossing the client sends a use - // circuit code to the existing child agent. This is not particularly obvious. - SendAckImmediate(endPoint, uccp.Header.Sequence); - - // We only want to send initial data to new clients, not ones which are being converted from child to root. - if (client != null) - { - AgentCircuitData aCircuit = m_scene.AuthenticateHandler.GetAgentCircuitData(uccp.CircuitCode.Code); - bool tp = (aCircuit.teleportFlags > 0); - // Let's delay this for TP agents, otherwise the viewer doesn't know where to get resources from - if (!tp) - client.SceneAgent.SendInitialDataToMe(); - } - // Now we know we can handle more data - Thread.Sleep(200); +// Thread.Sleep(200); - // Obtain the queue and remove it from the cache + // Obtain the pending queue and remove it from the cache Queue queue = null; lock (m_pendingCache) @@ -1790,6 +1775,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP PacketReceived(buf); } queue = null; + + // Send ack straight away to let the viewer know that the connection is active. + // The client will be null if it already exists (e.g. if on a region crossing the client sends a use + // circuit code to the existing child agent. This is not particularly obvious. + SendAckImmediate(endPoint, uccp.Header.Sequence); + + // We only want to send initial data to new clients, not ones which are being converted from child to root. + if (client != null) + { + AgentCircuitData aCircuit = m_scene.AuthenticateHandler.GetAgentCircuitData(uccp.CircuitCode.Code); + bool tp = (aCircuit.teleportFlags > 0); + // Let's delay this for TP agents, otherwise the viewer doesn't know where to get resources from + if (!tp) + client.SceneAgent.SendInitialDataToMe(); + } } else { -- cgit v1.1 From bd3d58dd00ceafab961d684208c10fae20f89dc2 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 6 Aug 2014 04:54:14 +0100 Subject: try to make the baked textures cache work --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 73 ++++++++++++---------- 1 file changed, 40 insertions(+), 33 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 34a2797..7f25f78 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -6535,7 +6535,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP WearableCacheItem[] cacheitems = new WearableCacheItem[appear.WearableData.Length]; for (int i=0; i AvatarWearable.MAX_WEARABLES) maxWearablesLoop = AvatarWearable.MAX_WEARABLES; - if (bakedTextureModule != null && cache != null) +// if (bakedTextureModule != null && cache != null) + if (cache != null) { // We need to make sure the asset stored in the bake is available on this server also by it's assetid before we map it to a Cacheid WearableCacheItem[] cacheItems = null; ScenePresence p = m_scene.GetScenePresence(AgentId); if (p.Appearance != null) - if (p.Appearance.WearableCacheItems == null || p.Appearance.WearableCacheItemsDirty) + { + if (p.Appearance.WearableCacheItems == null) { - try + if (bakedTextureModule != null) { - cacheItems = bakedTextureModule.Get(AgentId); - p.Appearance.WearableCacheItems = cacheItems; - p.Appearance.WearableCacheItemsDirty = false; - } + try + { + if (p.Appearance.WearableCacheItemsDirty) + { + cacheItems = bakedTextureModule.Get(AgentId); + p.Appearance.WearableCacheItems = cacheItems; + p.Appearance.WearableCacheItemsDirty = false; + } + } - /* - * The following Catch types DO NOT WORK, it jumps to the General Packet Exception Handler if you don't catch Exception! - * - catch (System.Net.Sockets.SocketException) - { - cacheItems = null; - } - catch (WebException) - { - cacheItems = null; - } - catch (InvalidOperationException) - { - cacheItems = null; - } */ - catch (Exception) - { - cacheItems = null; + /* + * The following Catch types DO NOT WORK, it jumps to the General Packet Exception Handler if you don't catch Exception! + * + catch (System.Net.Sockets.SocketException) + { + cacheItems = null; + } + catch (WebException) + { + cacheItems = null; + } + catch (InvalidOperationException) + { + cacheItems = null; + } */ + catch (Exception) + { + cacheItems = null; + } } - } else if (p.Appearance.WearableCacheItems != null) { cacheItems = p.Appearance.WearableCacheItems; } + } if (cache != null && cacheItems != null) { @@ -12077,8 +12088,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP item.TextureAsset.Temporary = true; cache.Store(item.TextureAsset); } - - } } @@ -12136,13 +12145,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; - - if (cache.GetCached(cachedresp.WearableData[i].TextureID.ToString()) == null) cachedresp.WearableData[i].TextureID = UUID.Zero; //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); - else - cachedresp.WearableData[i].TextureID = UUID.Zero; +// else +// cachedresp.WearableData[i].TextureID = UUID.Zero; // UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); cachedresp.WearableData[i].HostName = new byte[0]; } -- cgit v1.1 From 66dea8fe05dbf0f9783f520cddf4d3aa700015d6 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 6 Aug 2014 05:17:30 +0100 Subject: some debug to remove later --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 7f25f78..0e8c7ca 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -12041,6 +12041,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { if (bakedTextureModule != null) { + m_log.Debug("[ HandleAgentTextureCached] bakedTextureModule"); try { if (p.Appearance.WearableCacheItemsDirty) @@ -12072,7 +12073,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } } - else if (p.Appearance.WearableCacheItems != null) + + if (p.Appearance.WearableCacheItems != null) { cacheItems = p.Appearance.WearableCacheItems; } -- cgit v1.1 From 552b4e45e8700cc71bbbea18b5bad167998a74e4 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 6 Aug 2014 05:56:10 +0100 Subject: bakemodule didnt like last changes --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 0e8c7ca..08b6cb4 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -12037,19 +12037,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP ScenePresence p = m_scene.GetScenePresence(AgentId); if (p.Appearance != null) { - if (p.Appearance.WearableCacheItems == null) + if (p.Appearance.WearableCacheItems == null || p.Appearance.WearableCacheItemsDirty) { if (bakedTextureModule != null) { m_log.Debug("[ HandleAgentTextureCached] bakedTextureModule"); try { - if (p.Appearance.WearableCacheItemsDirty) - { - cacheItems = bakedTextureModule.Get(AgentId); - p.Appearance.WearableCacheItems = cacheItems; - p.Appearance.WearableCacheItemsDirty = false; - } + cacheItems = bakedTextureModule.Get(AgentId); + p.Appearance.WearableCacheItems = cacheItems; + p.Appearance.WearableCacheItemsDirty = false; } /* @@ -12074,7 +12071,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } - if (p.Appearance.WearableCacheItems != null) + else if (p.Appearance.WearableCacheItems != null) { cacheItems = p.Appearance.WearableCacheItems; } -- cgit v1.1 From c3f9c99fb32d15e57b24502b71c79fe028ed3007 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 7 Aug 2014 05:20:45 +0100 Subject: DANGER... changed bakedtextures caching. Assuming grid baking is cache only, reduced number of accesses to it. TESTING --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 110 ++++++++------------- 1 file changed, 43 insertions(+), 67 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 08b6cb4..38a9af3 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -3684,6 +3684,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP avp.Sender.IsTrial = false; avp.Sender.ID = agentID; avp.AppearanceData = new AvatarAppearancePacket.AppearanceDataBlock[0]; + + // this need be use in future + // avp.AppearanceData[0].AppearanceVersion = 0; + // avp.AppearanceData[0].CofVersion = 0; + //m_log.DebugFormat("[CLIENT]: Sending appearance for {0} to {1}", agentID.ToString(), AgentId.ToString()); OutPacket(avp, ThrottleOutPacketType.Task); } @@ -12006,8 +12011,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP AgentCachedTextureResponsePacket cachedresp = (AgentCachedTextureResponsePacket)PacketPool.Instance.GetPacket(PacketType.AgentCachedTextureResponse); if (cachedtex.AgentData.SessionID != SessionId) - return false; - + return false; // TODO: don't create new blocks if recycling an old packet cachedresp.AgentData.AgentID = AgentId; @@ -12022,23 +12026,27 @@ namespace OpenSim.Region.ClientStack.LindenUDP //WearableCacheItem[] items = fac.GetCachedItems(AgentId); IAssetService cache = m_scene.AssetService; - IBakedTextureModule bakedTextureModule = m_scene.RequestModuleInterface(); //bakedTextureModule = null; int maxWearablesLoop = cachedtex.WearableData.Length; if (maxWearablesLoop > AvatarWearable.MAX_WEARABLES) maxWearablesLoop = AvatarWearable.MAX_WEARABLES; -// if (bakedTextureModule != null && cache != null) + int cacheHits = 0; + if (cache != null) { // We need to make sure the asset stored in the bake is available on this server also by it's assetid before we map it to a Cacheid WearableCacheItem[] cacheItems = null; + ScenePresence p = m_scene.GetScenePresence(AgentId); - if (p.Appearance != null) + + if (p!= null && p.Appearance != null) { - if (p.Appearance.WearableCacheItems == null || p.Appearance.WearableCacheItemsDirty) + /* we should only check bakedTextureModule at login or when appearance changes + if (p.Appearance.WearableCacheItems == null) // currently with a caching only bakemodule Appearance.Wearables.dirty as no use { + IBakedTextureModule bakedTextureModule = m_scene.RequestModuleInterface(); if (bakedTextureModule != null) { m_log.Debug("[ HandleAgentTextureCached] bakedTextureModule"); @@ -12047,23 +12055,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP cacheItems = bakedTextureModule.Get(AgentId); p.Appearance.WearableCacheItems = cacheItems; p.Appearance.WearableCacheItemsDirty = false; - } - /* - * The following Catch types DO NOT WORK, it jumps to the General Packet Exception Handler if you don't catch Exception! - * - catch (System.Net.Sockets.SocketException) - { - cacheItems = null; - } - catch (WebException) - { - cacheItems = null; + if (cacheItems != null) + { + foreach (WearableCacheItem item in cacheItems) + { + if (item.TextureAsset != null) + { + item.TextureAsset.Temporary = true; + item.TextureAsset.Local = true; + cache.Store(item.TextureAsset); + } + } + } } - catch (InvalidOperationException) - { - cacheItems = null; - } */ + catch (Exception) { cacheItems = null; @@ -12075,36 +12081,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP { cacheItems = p.Appearance.WearableCacheItems; } +*/ + cacheItems = p.Appearance.WearableCacheItems; } - if (cache != null && cacheItems != null) - { - foreach (WearableCacheItem item in cacheItems) - { - - if (cache.GetCached(item.TextureID.ToString()) == null) - { - item.TextureAsset.Temporary = true; - cache.Store(item.TextureAsset); - } - } - } - if (cacheItems != null) { - for (int i = 0; i < maxWearablesLoop; i++) { - WearableCacheItem item = - WearableCacheItem.SearchTextureIndex(cachedtex.WearableData[i].TextureIndex,cacheItems); + int idx = cachedtex.WearableData[i].TextureIndex; cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); - cachedresp.WearableData[i].TextureIndex= cachedtex.WearableData[i].TextureIndex; + cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; cachedresp.WearableData[i].HostName = new byte[0]; - if (item != null && cachedtex.WearableData[i].ID == item.CacheId) + if (cachedtex.WearableData[i].ID == cacheItems[idx].CacheId) { - - cachedresp.WearableData[i].TextureID = item.TextureID; + cachedresp.WearableData[i].TextureID = cacheItems[idx].TextureID; + cacheHits++; } else { @@ -12124,36 +12117,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } } - else + else // no cache { - if (cache == null) + for (int i = 0; i < maxWearablesLoop; i++) { - for (int i = 0; i < maxWearablesLoop; i++) - { - cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); - cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; - cachedresp.WearableData[i].TextureID = UUID.Zero; - //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); - cachedresp.WearableData[i].HostName = new byte[0]; - } - } - else - { - for (int i = 0; i < maxWearablesLoop; i++) - { - cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); - cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; - - if (cache.GetCached(cachedresp.WearableData[i].TextureID.ToString()) == null) - cachedresp.WearableData[i].TextureID = UUID.Zero; - //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); -// else -// cachedresp.WearableData[i].TextureID = UUID.Zero; - // UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); - cachedresp.WearableData[i].HostName = new byte[0]; - } + cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); + cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; + cachedresp.WearableData[i].TextureID = UUID.Zero; + cachedresp.WearableData[i].HostName = new byte[0]; } } + + m_log.DebugFormat("texture cached: hits {0}", cacheHits); + cachedresp.Header.Zerocoded = true; OutPacket(cachedresp, ThrottleOutPacketType.Task); -- cgit v1.1 From 1408c9eee7eb8b73b49255f6c7bf81f4a759d01c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 7 Aug 2014 07:55:56 +0100 Subject: reply to cached checks with same serial number --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 38a9af3..def1f8e 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -12016,8 +12016,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP // TODO: don't create new blocks if recycling an old packet cachedresp.AgentData.AgentID = AgentId; cachedresp.AgentData.SessionID = m_sessionId; - cachedresp.AgentData.SerialNum = m_cachedTextureSerial; - m_cachedTextureSerial++; +// cachedresp.AgentData.SerialNum = m_cachedTextureSerial; +// m_cachedTextureSerial++; + cachedresp.AgentData.SerialNum = cachedtex.AgentData.SerialNum; cachedresp.WearableData = new AgentCachedTextureResponsePacket.WearableDataBlock[cachedtex.WearableData.Length]; @@ -12094,7 +12095,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; cachedresp.WearableData[i].HostName = new byte[0]; - if (cachedtex.WearableData[i].ID == cacheItems[idx].CacheId) + if (cachedtex.WearableData[i].ID == cacheItems[idx].CacheId) { cachedresp.WearableData[i].TextureID = cacheItems[idx].TextureID; cacheHits++; -- cgit v1.1 From dfa9ba0937f6e2d30e1d541d64533ede4ecb671e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 7 Aug 2014 08:47:03 +0100 Subject: minor clean, dont check for cache if we aren't using it.. --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 104 +++++---------------- 1 file changed, 22 insertions(+), 82 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index def1f8e..e9a087b 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -12011,120 +12011,60 @@ namespace OpenSim.Region.ClientStack.LindenUDP AgentCachedTextureResponsePacket cachedresp = (AgentCachedTextureResponsePacket)PacketPool.Instance.GetPacket(PacketType.AgentCachedTextureResponse); if (cachedtex.AgentData.SessionID != SessionId) - return false; + return false; // TODO: don't create new blocks if recycling an old packet cachedresp.AgentData.AgentID = AgentId; cachedresp.AgentData.SessionID = m_sessionId; -// cachedresp.AgentData.SerialNum = m_cachedTextureSerial; -// m_cachedTextureSerial++; cachedresp.AgentData.SerialNum = cachedtex.AgentData.SerialNum; cachedresp.WearableData = new AgentCachedTextureResponsePacket.WearableDataBlock[cachedtex.WearableData.Length]; - //IAvatarFactoryModule fac = m_scene.RequestModuleInterface(); - // var item = fac.GetBakedTextureFaces(AgentId); - //WearableCacheItem[] items = fac.GetCachedItems(AgentId); - - IAssetService cache = m_scene.AssetService; - //bakedTextureModule = null; int maxWearablesLoop = cachedtex.WearableData.Length; if (maxWearablesLoop > AvatarWearable.MAX_WEARABLES) maxWearablesLoop = AvatarWearable.MAX_WEARABLES; int cacheHits = 0; - if (cache != null) - { - // We need to make sure the asset stored in the bake is available on this server also by it's assetid before we map it to a Cacheid - - WearableCacheItem[] cacheItems = null; - - ScenePresence p = m_scene.GetScenePresence(AgentId); - - if (p!= null && p.Appearance != null) - { - /* we should only check bakedTextureModule at login or when appearance changes - if (p.Appearance.WearableCacheItems == null) // currently with a caching only bakemodule Appearance.Wearables.dirty as no use - { - IBakedTextureModule bakedTextureModule = m_scene.RequestModuleInterface(); - if (bakedTextureModule != null) - { - m_log.Debug("[ HandleAgentTextureCached] bakedTextureModule"); - try - { - cacheItems = bakedTextureModule.Get(AgentId); - p.Appearance.WearableCacheItems = cacheItems; - p.Appearance.WearableCacheItemsDirty = false; + // We need to make sure the asset stored in the bake is available on this server also by it's assetid before we map it to a Cacheid - if (cacheItems != null) - { - foreach (WearableCacheItem item in cacheItems) - { - if (item.TextureAsset != null) - { - item.TextureAsset.Temporary = true; - item.TextureAsset.Local = true; - cache.Store(item.TextureAsset); - } - } - } - } + WearableCacheItem[] cacheItems = null; - catch (Exception) - { - cacheItems = null; - } - } - } + ScenePresence p = m_scene.GetScenePresence(AgentId); - else if (p.Appearance.WearableCacheItems != null) - { - cacheItems = p.Appearance.WearableCacheItems; - } -*/ - cacheItems = p.Appearance.WearableCacheItems; - } + if (p != null && p.Appearance != null) + { + cacheItems = p.Appearance.WearableCacheItems; + } - if (cacheItems != null) + if (cacheItems != null) + { + for (int i = 0; i < maxWearablesLoop; i++) { - for (int i = 0; i < maxWearablesLoop; i++) - { - int idx = cachedtex.WearableData[i].TextureIndex; + int idx = cachedtex.WearableData[i].TextureIndex; - cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); - cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; - cachedresp.WearableData[i].HostName = new byte[0]; - if (cachedtex.WearableData[i].ID == cacheItems[idx].CacheId) - { - cachedresp.WearableData[i].TextureID = cacheItems[idx].TextureID; - cacheHits++; - } - else - { - cachedresp.WearableData[i].TextureID = UUID.Zero; - } + cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); + cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; + cachedresp.WearableData[i].HostName = new byte[0]; + if (cachedtex.WearableData[i].ID == cacheItems[idx].CacheId) + { + cachedresp.WearableData[i].TextureID = cacheItems[idx].TextureID; + cacheHits++; } - } - else - { - for (int i = 0; i < maxWearablesLoop; i++) + else { - cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); - cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; cachedresp.WearableData[i].TextureID = UUID.Zero; - //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); - cachedresp.WearableData[i].HostName = new byte[0]; } } } - else // no cache + else { for (int i = 0; i < maxWearablesLoop; i++) { cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; cachedresp.WearableData[i].TextureID = UUID.Zero; + //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); cachedresp.WearableData[i].HostName = new byte[0]; } } -- cgit v1.1 From 5628c0bcd68b032c0d819656d53b5b39bc83d68d Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Thu, 7 Aug 2014 23:54:38 +0200 Subject: Reduce delay time on regin handshake reply to speed up terrain sending. Terrain IS more important than avatar! --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index e9a087b..8a28faf 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -6481,7 +6481,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP Action handlerRegionHandShakeReply = OnRegionHandShakeReply; if (handlerRegionHandShakeReply != null) { - Thread.Sleep(500); + Thread.Sleep(100); handlerRegionHandShakeReply(this); } -- cgit v1.1 From ebc18a80bf87ca204c5d590bec0b2415f010ff83 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 10 Aug 2014 14:49:58 +0100 Subject: OutgoingPacketHandler can not be paced by hits on SendPacket() --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index a3fdae1..e317fc0 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -1418,6 +1418,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP queue.Enqueue(buffer); return; } + else if (packet.Type == PacketType.CompleteAgentMovement) { // Send ack straight away to let the viewer know that we got it. @@ -2150,13 +2151,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP // If nothing was sent, sleep for the minimum amount of time before a // token bucket could get more tokens - //if (!m_packetSent) - // Thread.Sleep((int)TickCountResolution); + + if (!m_packetSent) +// Thread.Sleep((int)TickCountResolution); + Thread.Sleep(20); // be independent of TickCountResolution // // Instead, now wait for data present to be explicitly signalled. Evidence so far is that with // modern mono it reduces CPU base load since there is no more continuous polling. - if (!m_packetSent) - m_dataPresentEvent.WaitOne(100); + // this misses heavy load cases +// if (!m_packetSent) +// m_dataPresentEvent.WaitOne(100); Watchdog.UpdateThread(); } -- cgit v1.1 From c0378d54304b2b6bde4a3c24eb137f664716ae81 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 10 Aug 2014 16:36:20 +0100 Subject: actually let delay match throttles as original design --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index e317fc0..0bb53c4 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -301,8 +301,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// /// This allows the outbound loop to only operate when there is data to send rather than continuously polling. /// Some data is sent immediately and not queued. That data would not trigger this event. + /// WRONG use. May be usefull in future revision /// - private AutoResetEvent m_dataPresentEvent = new AutoResetEvent(false); +// private AutoResetEvent m_dataPresentEvent = new AutoResetEvent(false); private Pool m_incomingPacketPool; @@ -990,8 +991,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP PacketPool.Instance.ReturnPacket(packet); - if (packetQueued) - m_dataPresentEvent.Set(); + /// WRONG use. May be usefull in future revision +// if (packetQueued) +// m_dataPresentEvent.Set(); } /// @@ -2153,14 +2155,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP // token bucket could get more tokens if (!m_packetSent) -// Thread.Sleep((int)TickCountResolution); - Thread.Sleep(20); // be independent of TickCountResolution - // - // Instead, now wait for data present to be explicitly signalled. Evidence so far is that with - // modern mono it reduces CPU base load since there is no more continuous polling. - // this misses heavy load cases -// if (!m_packetSent) -// m_dataPresentEvent.WaitOne(100); + Thread.Sleep((int)TickCountResolution); + + // .... wrong core code removed + Watchdog.UpdateThread(); } -- cgit v1.1 From dbbfaf3ac375a8d8f95327c334183e74b9fa70be Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 12 Aug 2014 22:17:15 +0100 Subject: force AgentUpdate after CompleteAgentMovement to pass by significance test --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 8a28faf..89deafd 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -5764,14 +5764,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP //qdelta2 = 1 - (float)Math.Pow(Quaternion.Dot(x.HeadRotation, m_thisAgentUpdateArgs.HeadRotation), 2); bool movementSignificant = - (qdelta1 > QDELTA) // significant if body rotation above threshold - // Ignoring head rotation altogether, because it's not being used for anything interesting up the stack - // || (qdelta2 > QDELTA * 10) // significant if head rotation above threshold - || (x.ControlFlags != m_thisAgentUpdateArgs.ControlFlags) // significant if control flags changed + (x.ControlFlags != m_thisAgentUpdateArgs.ControlFlags) // significant if control flags changed || (x.ControlFlags != (byte)AgentManager.ControlFlags.NONE) // significant if user supplying any movement update commands - || (x.Far != m_thisAgentUpdateArgs.Far) // significant if far distance changed || (x.Flags != m_thisAgentUpdateArgs.Flags) // significant if Flags changed || (x.State != m_thisAgentUpdateArgs.State) // significant if Stats changed + || (qdelta1 > QDELTA) // significant if body rotation above threshold + // Ignoring head rotation altogether, because it's not being used for anything interesting up the stack + // || (qdelta2 > QDELTA * 10) // significant if head rotation above threshold + || (x.Far != m_thisAgentUpdateArgs.Far) // significant if far distance changed ; //if (movementSignificant) //{ @@ -6751,6 +6751,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP private bool HandleCompleteAgentMovement(IClientAPI sender, Packet Pack) { + + m_thisAgentUpdateArgs.CameraAtAxis.X = float.MinValue; + m_thisAgentUpdateArgs.ControlFlags = uint.MaxValue; + Action handlerCompleteMovementToRegion = OnCompleteMovementToRegion; if (handlerCompleteMovementToRegion != null) { -- cgit v1.1 From b9224a70c488ac53726dcf53e18c718bbb9948d6 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 12 Aug 2014 22:27:50 +0100 Subject: no need to go from cos into squared sin when just abs of cos is as good --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 89deafd..0b82ce9 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -5737,7 +5737,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP #region Scene/Avatar // Threshold for body rotation to be a significant agent update - private const float QDELTA = 0.000001f; + // use the abs of cos + private const float QDELTABody = 1.0f - 0.0001f; + private const float QDELTAHead = 1.0f - 0.0001f; // Threshold for camera rotation to be a significant agent update private const float VDELTA = 0.01f; @@ -5760,17 +5762,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// private bool CheckAgentMovementUpdateSignificance(AgentUpdatePacket.AgentDataBlock x) { - float qdelta1 = 1 - (float)Math.Pow(Quaternion.Dot(x.BodyRotation, m_thisAgentUpdateArgs.BodyRotation), 2); - //qdelta2 = 1 - (float)Math.Pow(Quaternion.Dot(x.HeadRotation, m_thisAgentUpdateArgs.HeadRotation), 2); + float qdelta1 = Math.Abs(Quaternion.Dot(x.BodyRotation, m_thisAgentUpdateArgs.BodyRotation)); + //qdelta2 = Math.Abs(Quaternion.Dot(x.HeadRotation, m_thisAgentUpdateArgs.HeadRotation)); bool movementSignificant = (x.ControlFlags != m_thisAgentUpdateArgs.ControlFlags) // significant if control flags changed || (x.ControlFlags != (byte)AgentManager.ControlFlags.NONE) // significant if user supplying any movement update commands || (x.Flags != m_thisAgentUpdateArgs.Flags) // significant if Flags changed || (x.State != m_thisAgentUpdateArgs.State) // significant if Stats changed - || (qdelta1 > QDELTA) // significant if body rotation above threshold + || (qdelta1 < QDELTABody) // significant if body rotation above(below cos) threshold // Ignoring head rotation altogether, because it's not being used for anything interesting up the stack - // || (qdelta2 > QDELTA * 10) // significant if head rotation above threshold + // || (qdelta2 < QDELTAHead) // significant if head rotation above(below cos) threshold || (x.Far != m_thisAgentUpdateArgs.Far) // significant if far distance changed ; //if (movementSignificant) -- cgit v1.1 From f811efde852e921d6deb82b45b31629bdd04ab11 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 12 Aug 2014 22:36:17 +0100 Subject: do the significance test invalidation at MoveAgentToRegion --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 0b82ce9..f5bb70b 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -856,6 +856,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP public void MoveAgentIntoRegion(RegionInfo regInfo, Vector3 pos, Vector3 look) { + m_thisAgentUpdateArgs.CameraAtAxis.X = float.MinValue; + m_thisAgentUpdateArgs.ControlFlags = uint.MaxValue; + AgentMovementCompletePacket mov = (AgentMovementCompletePacket)PacketPool.Instance.GetPacket(PacketType.AgentMovementComplete); mov.SimData.ChannelVersion = m_channelVersion; mov.AgentData.SessionID = m_sessionId; @@ -6753,10 +6756,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP private bool HandleCompleteAgentMovement(IClientAPI sender, Packet Pack) { - - m_thisAgentUpdateArgs.CameraAtAxis.X = float.MinValue; - m_thisAgentUpdateArgs.ControlFlags = uint.MaxValue; - Action handlerCompleteMovementToRegion = OnCompleteMovementToRegion; if (handlerCompleteMovementToRegion != null) { -- cgit v1.1 From 20b3cab5d1cb1bbbe951a90ae6de7ffb495e6375 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 12 Aug 2014 23:57:41 +0100 Subject: take agentUpdate checks out of llUDPserver (disabling useless debug) and do it only where its supposed to be done.. --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 56 ++++++++++++---------- .../Region/ClientStack/Linden/UDP/LLUDPServer.cs | 22 ++------- 2 files changed, 35 insertions(+), 43 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index f5bb70b..9462bdc 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -5819,55 +5819,63 @@ namespace OpenSim.Region.ClientStack.LindenUDP return cameraSignificant; } - private bool HandleAgentUpdate(IClientAPI sener, Packet packet) - { + private bool HandleAgentUpdate(IClientAPI sender, Packet packet) + { // We got here, which means that something in agent update was significant AgentUpdatePacket agentUpdate = (AgentUpdatePacket)packet; AgentUpdatePacket.AgentDataBlock x = agentUpdate.AgentData; if (x.AgentID != AgentId || x.SessionID != SessionId) + { + PacketPool.Instance.ReturnPacket(packet); return false; + } + + TotalAgentUpdates++; - // Before we update the current m_thisAgentUpdateArgs, let's check this again - // to see what exactly changed bool movement = CheckAgentMovementUpdateSignificance(x); bool camera = CheckAgentCameraUpdateSignificance(x); - m_thisAgentUpdateArgs.AgentID = x.AgentID; - m_thisAgentUpdateArgs.BodyRotation = x.BodyRotation; - m_thisAgentUpdateArgs.CameraAtAxis = x.CameraAtAxis; - m_thisAgentUpdateArgs.CameraCenter = x.CameraCenter; - m_thisAgentUpdateArgs.CameraLeftAxis = x.CameraLeftAxis; - m_thisAgentUpdateArgs.CameraUpAxis = x.CameraUpAxis; - m_thisAgentUpdateArgs.ControlFlags = x.ControlFlags; - m_thisAgentUpdateArgs.Far = x.Far; - m_thisAgentUpdateArgs.Flags = x.Flags; - m_thisAgentUpdateArgs.HeadRotation = x.HeadRotation; - m_thisAgentUpdateArgs.SessionID = x.SessionID; - m_thisAgentUpdateArgs.State = x.State; - - UpdateAgent handlerAgentUpdate = OnAgentUpdate; - UpdateAgent handlerPreAgentUpdate = OnPreAgentUpdate; - UpdateAgent handlerAgentCameraUpdate = OnAgentCameraUpdate; - // Was there a significant movement/state change? if (movement) { + m_thisAgentUpdateArgs.BodyRotation = x.BodyRotation; + m_thisAgentUpdateArgs.ControlFlags = x.ControlFlags; + m_thisAgentUpdateArgs.Far = x.Far; + m_thisAgentUpdateArgs.Flags = x.Flags; + m_thisAgentUpdateArgs.HeadRotation = x.HeadRotation; + m_thisAgentUpdateArgs.SessionID = x.SessionID; + m_thisAgentUpdateArgs.State = x.State; + + UpdateAgent handlerAgentUpdate = OnAgentUpdate; + UpdateAgent handlerPreAgentUpdate = OnPreAgentUpdate; + if (handlerPreAgentUpdate != null) OnPreAgentUpdate(this, m_thisAgentUpdateArgs); if (handlerAgentUpdate != null) OnAgentUpdate(this, m_thisAgentUpdateArgs); + + handlerAgentUpdate = null; + handlerPreAgentUpdate = null; } + // Was there a significant camera(s) change? if (camera) + { + m_thisAgentUpdateArgs.CameraAtAxis = x.CameraAtAxis; + m_thisAgentUpdateArgs.CameraCenter = x.CameraCenter; + m_thisAgentUpdateArgs.CameraLeftAxis = x.CameraLeftAxis; + m_thisAgentUpdateArgs.CameraUpAxis = x.CameraUpAxis; + + UpdateAgent handlerAgentCameraUpdate = OnAgentCameraUpdate; + if (handlerAgentCameraUpdate != null) handlerAgentCameraUpdate(this, m_thisAgentUpdateArgs); - handlerAgentUpdate = null; - handlerPreAgentUpdate = null; - handlerAgentCameraUpdate = null; + handlerAgentCameraUpdate = null; + } PacketPool.Instance.ReturnPacket(packet); diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 0bb53c4..15d0316 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -731,7 +731,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP "debug lludp status", "Return status of LLUDP packet processing.", HandleStatusCommand); - +/* disabled MainConsole.Instance.Commands.AddCommand( "Debug", false, @@ -739,6 +739,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP "debug lludp toggle agentupdate", "Toggle whether agentupdate packets are processed or simply discarded.", HandleAgentUpdateCommand); + */ } private void HandlePacketCommand(string module, string[] args) @@ -1553,24 +1554,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP LogPacketHeader(true, udpClient.CircuitCode, 0, packet.Type, (ushort)packet.Length); #endregion BinaryStats - if (packet.Type == PacketType.AgentUpdate) - { - if (m_discardAgentUpdates) - return; - - ((LLClientView)client).TotalAgentUpdates++; - - AgentUpdatePacket agentUpdate = (AgentUpdatePacket)packet; - - LLClientView llClient = client as LLClientView; - if (agentUpdate.AgentData.SessionID != client.SessionId - || agentUpdate.AgentData.AgentID != client.AgentId - || !(llClient == null || llClient.CheckAgentUpdateSignificance(agentUpdate.AgentData)) ) - { - PacketPool.Instance.ReturnPacket(packet); - return; - } - } +// AgentUpdate mess removed from here #region Ping Check Handling -- cgit v1.1 From 0760fa3106955147d9a4dc96e5ef81635275c164 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 13 Aug 2014 00:17:03 +0100 Subject: process AgentUpdates in order with rest of packets. Only give higher priority to chat --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 15d0316..2e9ac4c 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -1595,11 +1595,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP incomingPacket = new IncomingPacket((LLClientView)client, packet); } - if (incomingPacket.Packet.Type == PacketType.AgentUpdate || - incomingPacket.Packet.Type == PacketType.ChatFromViewer) +// if (incomingPacket.Packet.Type == PacketType.AgentUpdate || +// incomingPacket.Packet.Type == PacketType.ChatFromViewer) + if (incomingPacket.Packet.Type == PacketType.ChatFromViewer) packetInbox.EnqueueHigh(incomingPacket); else packetInbox.EnqueueLow(incomingPacket); + } #region BinaryStats -- cgit v1.1 From cf48b814ebbc28761571c1b219376da445f844c9 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 13 Aug 2014 01:42:16 +0100 Subject: remove HandleCompleteMovementIntoRegion delay hack from llUDPserver. If we need a delay, we need to do it at end of HandleUseCircuitCode before feeding pending packets (including that one) into processing queue. --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 6 ++++-- .../Region/ClientStack/Linden/UDP/LLUDPServer.cs | 22 +++++++++++++--------- 2 files changed, 17 insertions(+), 11 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 9462bdc..73d7a6c 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -5845,7 +5845,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_thisAgentUpdateArgs.Far = x.Far; m_thisAgentUpdateArgs.Flags = x.Flags; m_thisAgentUpdateArgs.HeadRotation = x.HeadRotation; - m_thisAgentUpdateArgs.SessionID = x.SessionID; +// m_thisAgentUpdateArgs.SessionID = x.SessionID; m_thisAgentUpdateArgs.State = x.State; UpdateAgent handlerAgentUpdate = OnAgentUpdate; @@ -6762,8 +6762,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP return true; } - private bool HandleCompleteAgentMovement(IClientAPI sender, Packet Pack) + private bool HandleCompleteAgentMovement(IClientAPI sender, Packet Pack) { + m_log.DebugFormat("[LLClientView] HandleCompleteAgentMovement"); + Action handlerCompleteMovementToRegion = OnCompleteMovementToRegion; if (handlerCompleteMovementToRegion != null) { diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 2e9ac4c..fe79f87 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -1422,6 +1422,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP return; } +/* else if (packet.Type == PacketType.CompleteAgentMovement) { // Send ack straight away to let the viewer know that we got it. @@ -1435,6 +1436,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP return; } + */ } // Determine which agent this packet came from @@ -1718,7 +1720,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP try { - // DateTime startTime = DateTime.Now; +// DateTime startTime = DateTime.Now; object[] array = (object[])o; endPoint = (IPEndPoint)array[0]; UseCircuitCodePacket uccp = (UseCircuitCodePacket)array[1]; @@ -1738,9 +1740,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP uccp.CircuitCode.SessionID, endPoint, sessionInfo); - + // Now we know we can handle more data -// Thread.Sleep(200); + Thread.Sleep(200); // Obtain the pending queue and remove it from the cache Queue queue = null; @@ -1751,6 +1753,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { m_log.DebugFormat("[LLUDPSERVER]: Client created but no pending queue present"); return; + } m_pendingCache.Remove(endPoint); } @@ -1758,11 +1761,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_log.DebugFormat("[LLUDPSERVER]: Client created, processing pending queue, {0} entries", queue.Count); // Reinject queued packets - while(queue.Count > 0) + while (queue.Count > 0) { UDPPacketBuffer buf = queue.Dequeue(); PacketReceived(buf); } + queue = null; // Send ack straight away to let the viewer know that the connection is active. @@ -1788,8 +1792,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP uccp.CircuitCode.ID, m_scene.RegionInfo.RegionName, uccp.CircuitCode.Code, endPoint); lock (m_pendingCache) m_pendingCache.Remove(endPoint); - } - + } // m_log.DebugFormat( // "[LLUDPSERVER]: Handling UseCircuitCode request from {0} took {1}ms", // buffer.RemoteEndPoint, (DateTime.Now - startTime).Milliseconds); @@ -1806,8 +1809,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP e.StackTrace); } } - - private void HandleCompleteMovementIntoRegion(object o) +/* + private void HandleCompleteMovementIntoRegion(object o) { IPEndPoint endPoint = null; IClientAPI client = null; @@ -1916,6 +1919,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP e.StackTrace); } } +*/ /// /// Send an ack immediately to the given endpoint. @@ -2053,7 +2057,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_incomingPacketPool.ReturnObject(incomingPacket); } } - catch (Exception ex) + catch(Exception ex) { m_log.Error("[LLUDPSERVER]: Error in the incoming packet handler loop: " + ex.Message, ex); } -- cgit v1.1 From ecae45a21e4dff4986ff90f10a6eae54f95b391c Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Wed, 13 Aug 2014 03:05:25 +0200 Subject: Revert "make HandlerRegionHandshakeReply processing async and delay it a bit. This" This reverts commit 30f00bfb14cce582382bd37b1e22062af664ec64. Conflicts: OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 8a28faf..aa742ef 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -4884,7 +4884,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) { // m_log.DebugFormat("[LLCLIENTVIEW]: Sending land properties for {0} to {1}", lo.LandData.GlobalID, Name); - + LandData landData = lo.LandData; ParcelPropertiesMessage updateMessage = new ParcelPropertiesMessage(); @@ -5522,10 +5522,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP AddLocalPacketHandler(PacketType.RezObject, HandlerRezObject); AddLocalPacketHandler(PacketType.DeRezObject, HandlerDeRezObject); AddLocalPacketHandler(PacketType.ModifyLand, HandlerModifyLand); - -// AddLocalPacketHandler(PacketType.RegionHandshakeReply, HandlerRegionHandshakeReply, false); - AddLocalPacketHandler(PacketType.RegionHandshakeReply, HandlerRegionHandshakeReply, true); - + AddLocalPacketHandler(PacketType.RegionHandshakeReply, HandlerRegionHandshakeReply, false); AddLocalPacketHandler(PacketType.AgentWearablesRequest, HandlerAgentWearablesRequest); AddLocalPacketHandler(PacketType.AgentSetAppearance, HandlerAgentSetAppearance); AddLocalPacketHandler(PacketType.AgentIsNowWearing, HandlerAgentIsNowWearing); @@ -6481,7 +6478,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP Action handlerRegionHandShakeReply = OnRegionHandShakeReply; if (handlerRegionHandShakeReply != null) { - Thread.Sleep(100); handlerRegionHandShakeReply(this); } -- cgit v1.1 From 8c657e48377213e7ee66c05a4047085cee6084ea Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 14 Aug 2014 20:41:36 +0100 Subject: add a estimator of client ping time, and painfully make it visible in show connections console command --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 12 ++++++++++++ OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs | 16 ++++++++++++++++ OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 18 +++++++++++++----- 3 files changed, 41 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 59d1c69..e69bf23 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 bd4e617..9cf65d7 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 fe79f87..910d7cf 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; } -- cgit v1.1 From a46d6004dfdc353678271e36aafff5eaafd3fd91 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 14 Aug 2014 21:04:30 +0100 Subject: reduce ping filter time constant --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 910d7cf..bd192dc 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; -- cgit v1.1 From 0ae8fed4c20f53921193b7b8f0b5b2f4ab1b61b3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 14 Aug 2014 21:18:58 +0100 Subject: reduce ping cliping lower limit --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index 9cf65d7..fe31bd9 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; -- cgit v1.1 From 1edaf29149c767a2742b44d69308edb2e2d64428 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 16 Aug 2014 13:43:26 +0100 Subject: NextAnimationSequenceNumber be a udpserver variable with random start --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 7 +++++-- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 17 +++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index e69bf23..6f41ac8 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 bd192dc..3b0312d 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(); } -- cgit v1.1 From 4c46ebdbf501733e1b9d7e23943da095c4f60bce Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 19 Aug 2014 03:47:26 +0100 Subject: 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(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 6f41ac8..8f69b3e 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 } -- cgit v1.1 From 505cbf9983ffd70d473299e517bf792f3f04d46d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 19 Aug 2014 03:58:16 +0100 Subject: still another ... --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 8f69b3e..608b739 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 -- cgit v1.1 From 8f0d35e59a77ec44c7ee55296a02882b424b469f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 19 Aug 2014 09:04:20 +0100 Subject: fix the encoding of rotation in updates, not just using the next field to override w bytes. ( specially having it commented ) --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 27 ++++++++++------------ 1 file changed, 12 insertions(+), 15 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 608b739..6eb0c5e 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(); -- cgit v1.1 From 919aef157385c694b598439e3a50a2fe7a4f9e98 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 19 Aug 2014 10:03:04 +0100 Subject: 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(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 6eb0c5e..b0cb4ea 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); -- cgit v1.1 From 542118adf1791075bfb904d805a2c29cf303237e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 20 Aug 2014 18:55:06 +0100 Subject: remove from use the UpdatesResend on resending udp packets. Just resend the UDP packet. Also just loose packets we tried to send 6 times already (ll says 3) A viewer may just beeing ignoring them, or then the link is just dead. --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 80 ++++++++++++---------- .../Region/ClientStack/Linden/UDP/LLUDPServer.cs | 10 +++ 2 files changed, 54 insertions(+), 36 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index b0cb4ea..475cfe2 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -3838,47 +3838,53 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_entityUpdates.Enqueue(priority, new EntityUpdate(entity, updateFlags, m_scene.TimeDilation)); } - /// - /// Requeue an EntityUpdate when it was not acknowledged by the client. - /// We will update the priority and put it in the correct queue, merging update flags - /// with any other updates that may be queued for the same entity. - /// The original update time is used for the merged update. - /// - private void ResendPrimUpdate(EntityUpdate update) - { - // If the update exists in priority queue, it will be updated. - // If it does not exist then it will be added with the current (rather than its original) priority - uint priority = m_prioritizer.GetUpdatePriority(this, update.Entity); + /* dont use this + udp packet resent must be done at udp level only + re map from a packet to original updates just doesnt work - lock (m_entityUpdates.SyncRoot) - m_entityUpdates.Enqueue(priority, update); - } + /// + /// Requeue an EntityUpdate when it was not acknowledged by the client. + /// We will update the priority and put it in the correct queue, merging update flags + /// with any other updates that may be queued for the same entity. + /// The original update time is used for the merged update. + /// + private void ResendPrimUpdate(EntityUpdate update) + { + // If the update exists in priority queue, it will be updated. + // If it does not exist then it will be added with the current (rather than its original) priority + uint priority = m_prioritizer.GetUpdatePriority(this, update.Entity); - /// - /// Requeue a list of EntityUpdates when they were not acknowledged by the client. - /// We will update the priority and put it in the correct queue, merging update flags - /// with any other updates that may be queued for the same entity. - /// The original update time is used for the merged update. - /// - private void ResendPrimUpdates(List updates, OutgoingPacket oPacket) - { - // m_log.WarnFormat("[CLIENT] resending prim updates {0}, packet sequence number {1}", updates[0].UpdateTime, oPacket.SequenceNumber); + lock (m_entityUpdates.SyncRoot) + m_entityUpdates.Enqueue(priority, update); + } - // Remove the update packet from the list of packets waiting for acknowledgement - // because we are requeuing the list of updates. They will be resent in new packets - // with the most recent state and priority. - m_udpClient.NeedAcks.Remove(oPacket.SequenceNumber); - // Count this as a resent packet since we are going to requeue all of the updates contained in it - Interlocked.Increment(ref m_udpClient.PacketsResent); + /// + /// Requeue a list of EntityUpdates when they were not acknowledged by the client. + /// We will update the priority and put it in the correct queue, merging update flags + /// with any other updates that may be queued for the same entity. + /// The original update time is used for the merged update. + /// + private void ResendPrimUpdates(List updates, OutgoingPacket oPacket) + { + // m_log.WarnFormat("[CLIENT] resending prim updates {0}, packet sequence number {1}", updates[0].UpdateTime, oPacket.SequenceNumber); - // We're not going to worry about interlock yet since its not currently critical that this total count - // is 100% correct - m_udpServer.PacketsResentCount++; + // Remove the update packet from the list of packets waiting for acknowledgement + // because we are requeuing the list of updates. They will be resent in new packets + // with the most recent state and priority. + m_udpClient.NeedAcks.Remove(oPacket.SequenceNumber); - foreach (EntityUpdate update in updates) - ResendPrimUpdate(update); - } + // Count this as a resent packet since we are going to requeue all of the updates contained in it + Interlocked.Increment(ref m_udpClient.PacketsResent); + + // We're not going to worry about interlock yet since its not currently critical that this total count + // is 100% correct + m_udpServer.PacketsResentCount++; + + foreach (EntityUpdate update in updates) + ResendPrimUpdate(update); + } + */ // OpenSim.Framework.Lazy> objectUpdateBlocks = new OpenSim.Framework.Lazy>(); // OpenSim.Framework.Lazy> compressedUpdateBlocks = new OpenSim.Framework.Lazy>(); @@ -4197,7 +4203,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP for (int i = 0; i < blocks.Count; i++) packet.ObjectData[i] = blocks[i]; - OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseUpdates.Value, oPacket); }); +// OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseUpdates.Value, oPacket); }); + // use default udp retry + OutPacket(packet, ThrottleOutPacketType.Task, true); } #endregion Packet Sending diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 3b0312d..bf44152 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -1207,6 +1207,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP //m_log.DebugFormat("[LLUDPSERVER]: Resending packet #{0} (attempt {1}), {2}ms have passed", // outgoingPacket.SequenceNumber, outgoingPacket.ResendCount, Environment.TickCount - outgoingPacket.TickCount); + // Bump up the resend count on this packet + Interlocked.Increment(ref outgoingPacket.ResendCount); + + // loose packets we retried more than 6 times + // sl says 3 so lets be more tolerant + // we can't not keep hammering with packets a viewer may just beeing ignoring + + if (outgoingPacket.ResendCount > 6) + return; + // Set the resent flag outgoingPacket.Buffer.Data[0] = (byte)(outgoingPacket.Buffer.Data[0] | Helpers.MSG_RESENT); outgoingPacket.Category = ThrottleOutPacketType.Resend; -- cgit v1.1 From ea1c232f92549d0282532779169ebf4b1811d0c4 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 21 Aug 2014 00:08:43 +0100 Subject: revert droping udp packet resends after 6 retries, keep resending. --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index bf44152..3b0312d 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -1207,16 +1207,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP //m_log.DebugFormat("[LLUDPSERVER]: Resending packet #{0} (attempt {1}), {2}ms have passed", // outgoingPacket.SequenceNumber, outgoingPacket.ResendCount, Environment.TickCount - outgoingPacket.TickCount); - // Bump up the resend count on this packet - Interlocked.Increment(ref outgoingPacket.ResendCount); - - // loose packets we retried more than 6 times - // sl says 3 so lets be more tolerant - // we can't not keep hammering with packets a viewer may just beeing ignoring - - if (outgoingPacket.ResendCount > 6) - return; - // Set the resent flag outgoingPacket.Buffer.Data[0] = (byte)(outgoingPacket.Buffer.Data[0] | Helpers.MSG_RESENT); outgoingPacket.Category = ThrottleOutPacketType.Resend; -- cgit v1.1 From 5bf145a3977a55c474106bbe2a6c107dd9457f0d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 21 Aug 2014 00:49:10 +0100 Subject: add a direct sendpartfullUpdate to send a full object update to a part, optionally overriding its parentID. check what it does to attachments --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 475cfe2..06f1301 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -4208,9 +4208,35 @@ namespace OpenSim.Region.ClientStack.LindenUDP OutPacket(packet, ThrottleOutPacketType.Task, true); } + + #endregion Packet Sending + } + // hack.. dont use + public void SendPartFullUpdate(ISceneEntity ent, uint? parentID) + { + if (ent is SceneObjectPart) + { + SceneObjectPart part = (SceneObjectPart)ent; + ObjectUpdatePacket packet = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate); + packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle; + packet.RegionData.TimeDilation = 1; + packet.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; + + ObjectUpdatePacket.ObjectDataBlock blk = CreatePrimUpdateBlock(part, this.m_agentId); + if (parentID.HasValue) + { + blk.ParentID = parentID.Value; + } + + packet.ObjectData[0] = blk; + + OutPacket(packet, ThrottleOutPacketType.Task, true); + } + } + public void ReprioritizeUpdates() { lock (m_entityUpdates.SyncRoot) -- cgit v1.1 From 63d1916f511fdbbec8bc111f4bf80b3e4e0bc267 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 23 Aug 2014 20:59:11 +0100 Subject: Remove entities from updates queues on kill. Do it sync so enqueues after the kill work --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 06f1301..3d02f36 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -1660,6 +1660,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP // foreach (uint id in localIDs) // m_log.DebugFormat("[CLIENT]: Sending KillObjectPacket to {0} for {1} in {2}", Name, id, regionHandle); + // remove pending entities + lock (m_entityProps.SyncRoot) + m_entityProps.Remove(localIDs); + lock (m_entityUpdates.SyncRoot) + m_entityUpdates.Remove(localIDs); + KillObjectPacket kill = (KillObjectPacket)PacketPool.Instance.GetPacket(PacketType.KillObject); // TODO: don't create new blocks if recycling an old packet kill.ObjectData = new KillObjectPacket.ObjectDataBlock[localIDs.Count]; -- cgit v1.1 From d55041d9349c6d846fc32c01ea28083f40fd4263 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 23 Aug 2014 21:13:30 +0100 Subject: on updates, send rotations using livomv Quaternion.toBytes() again --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 3d02f36..e62bea6 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -5334,13 +5334,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP 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); data.CollisionPlane.ToBytes(objectData, 0); offsetPosition.ToBytes(objectData, 16); velocity.ToBytes(objectData, 28); acceleration.ToBytes(objectData, 40); - vrot.ToBytes(objectData, 52); + rotation.ToBytes(objectData, 52); data.AngularVelocity.ToBytes(objectData, 64); ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock(); @@ -5400,8 +5399,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP Quaternion rotation = data.RotationOffset; rotation.Normalize(); - Vector3 vrot = new Vector3(rotation.X, rotation.Y, rotation.Z); - vrot.ToBytes(objectData, 36); + rotation.ToBytes(objectData, 36); data.AngularVelocity.ToBytes(objectData, 48); ObjectUpdatePacket.ObjectDataBlock update = new ObjectUpdatePacket.ObjectDataBlock(); -- cgit v1.1 From f4a6be86546b3bfeefbdbade33f2faabdd080c1f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 24 Aug 2014 00:44:14 +0100 Subject: clean sendKill a bit, remove a IsChild that is set too early in a calling path --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 24 ++-------------------- 1 file changed, 2 insertions(+), 22 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index e62bea6..e19877c 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -1677,28 +1677,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP kill.Header.Reliable = true; kill.Header.Zerocoded = true; - if (localIDs.Count == 1 && m_scene.GetScenePresence(localIDs[0]) != null) - { - OutPacket(kill, ThrottleOutPacketType.Task); - } - else - { - // We MUST lock for both manipulating the kill record and sending the packet, in order to avoid a race - // condition where a kill can be processed before an out-of-date update for the same object. - // ProcessEntityUpdates() also takes the m_killRecord lock. -// lock (m_killRecord) -// { -// foreach (uint localID in localIDs) -// m_killRecord.Add(localID); - - // The throttle queue used here must match that being used for updates. Otherwise, there is a - // chance that a kill packet put on a separate queue will be sent to the client before an existing - // update packet on another queue. Receiving updates after kills results in unowned and undeletable - // scene objects in a viewer until that viewer is relogged in. - OutPacket(kill, ThrottleOutPacketType.Task); -// } - } - } + OutPacket(kill, ThrottleOutPacketType.Task); + } /// /// Send information about the items contained in a folder to the client. -- cgit v1.1 From c24601bc6a9be5ab84a8c7b4600382ef9f0c895e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 25 Aug 2014 21:49:39 +0100 Subject: change enconding of attachment updates NameValue and State fields --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index e19877c..b45d561 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}", -- cgit v1.1 From 75cbe620c025dba998d8291277e499ecb27a250c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 25 Aug 2014 22:45:31 +0100 Subject: *test* cleanup the bugs nest --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index b45d561..0663983 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( -- cgit v1.1 From 6857afe2a4ca73da904b9928c282c0087ff4b3bf Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 25 Aug 2014 23:31:04 +0100 Subject: *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 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 0663983..7087bb7 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); } -- cgit v1.1 From 92b0b27caff9f73f619e1df32a430706b53f6782 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 26 Aug 2014 17:42:44 +0100 Subject: dont append acks to a resend packet --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 3b0312d..dea9d7f 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 -- cgit v1.1 From 1e888d61caf80c3ac5748fb3550dd8137818f4cd Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 27 Aug 2014 01:33:09 +0100 Subject: 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(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index fe31bd9..8852715 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; -- cgit v1.1 From ade4bf69b173958fb8b8309760cee9b87cfe2927 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 28 Aug 2014 10:38:31 +0100 Subject: if we send wearables with ThrottleOutPacketType.HighPriority, then we should send other avatarinformation with same priority on same Task category ( plus cleanup ) --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 111 +-------------------- .../Region/ClientStack/Linden/UDP/LLUDPClient.cs | 32 +++--- 2 files changed, 18 insertions(+), 125 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 7087bb7..e82f1d7 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -3694,7 +3694,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // avp.AppearanceData[0].CofVersion = 0; //m_log.DebugFormat("[CLIENT]: Sending appearance for {0} to {1}", agentID.ToString(), AgentId.ToString()); - OutPacket(avp, ThrottleOutPacketType.Task); + OutPacket(avp, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority); } public void SendAnimations(UUID[] animations, int[] seqs, UUID sourceAgentId, UUID[] objectIDs) @@ -3722,7 +3722,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP ani.AnimationSourceList[i].ObjectID = objectIDs[i]; } ani.Header.Reliable = false; - OutPacket(ani, ThrottleOutPacketType.Task); + OutPacket(ani, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority); } #endregion @@ -3751,7 +3751,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP objupdate.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; objupdate.ObjectData[0] = CreateAvatarUpdateBlock(presence); - OutPacket(objupdate, ThrottleOutPacketType.Task); + OutPacket(objupdate, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority); // We need to record the avatar local id since the root prim of an attachment points to this. // m_attachmentsSent.Add(avatar.LocalId); @@ -3824,65 +3824,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_entityUpdates.Enqueue(priority, new EntityUpdate(entity, updateFlags, m_scene.TimeDilation)); } - /* dont use this - udp packet resent must be done at udp level only - re map from a packet to original updates just doesnt work - - /// - /// Requeue an EntityUpdate when it was not acknowledged by the client. - /// We will update the priority and put it in the correct queue, merging update flags - /// with any other updates that may be queued for the same entity. - /// The original update time is used for the merged update. - /// - private void ResendPrimUpdate(EntityUpdate update) - { - // If the update exists in priority queue, it will be updated. - // If it does not exist then it will be added with the current (rather than its original) priority - uint priority = m_prioritizer.GetUpdatePriority(this, update.Entity); - - lock (m_entityUpdates.SyncRoot) - m_entityUpdates.Enqueue(priority, update); - } - - - /// - /// Requeue a list of EntityUpdates when they were not acknowledged by the client. - /// We will update the priority and put it in the correct queue, merging update flags - /// with any other updates that may be queued for the same entity. - /// The original update time is used for the merged update. - /// - private void ResendPrimUpdates(List updates, OutgoingPacket oPacket) - { - // m_log.WarnFormat("[CLIENT] resending prim updates {0}, packet sequence number {1}", updates[0].UpdateTime, oPacket.SequenceNumber); - - // Remove the update packet from the list of packets waiting for acknowledgement - // because we are requeuing the list of updates. They will be resent in new packets - // with the most recent state and priority. - m_udpClient.NeedAcks.Remove(oPacket.SequenceNumber); - - // Count this as a resent packet since we are going to requeue all of the updates contained in it - Interlocked.Increment(ref m_udpClient.PacketsResent); - - // We're not going to worry about interlock yet since its not currently critical that this total count - // is 100% correct - m_udpServer.PacketsResentCount++; - - foreach (EntityUpdate update in updates) - ResendPrimUpdate(update); - } - */ - -// OpenSim.Framework.Lazy> objectUpdateBlocks = new OpenSim.Framework.Lazy>(); -// OpenSim.Framework.Lazy> compressedUpdateBlocks = new OpenSim.Framework.Lazy>(); -// OpenSim.Framework.Lazy> terseUpdateBlocks = new OpenSim.Framework.Lazy>(); -// OpenSim.Framework.Lazy> terseAgentUpdateBlocks = new OpenSim.Framework.Lazy>(); -// -// OpenSim.Framework.Lazy> objectUpdates = new OpenSim.Framework.Lazy>(); -// OpenSim.Framework.Lazy> compressedUpdates = new OpenSim.Framework.Lazy>(); -// OpenSim.Framework.Lazy> terseUpdates = new OpenSim.Framework.Lazy>(); -// OpenSim.Framework.Lazy> terseAgentUpdates = new OpenSim.Framework.Lazy>(); - - private void ProcessEntityUpdates(int maxUpdates) { OpenSim.Framework.Lazy> objectUpdateBlocks = new OpenSim.Framework.Lazy>(); @@ -3895,15 +3836,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP OpenSim.Framework.Lazy> terseUpdates = new OpenSim.Framework.Lazy>(); OpenSim.Framework.Lazy> terseAgentUpdates = new OpenSim.Framework.Lazy>(); -// objectUpdateBlocks.Value.Clear(); -// compressedUpdateBlocks.Value.Clear(); -// terseUpdateBlocks.Value.Clear(); -// terseAgentUpdateBlocks.Value.Clear(); -// objectUpdates.Value.Clear(); -// compressedUpdates.Value.Clear(); -// terseUpdates.Value.Clear(); -// terseAgentUpdates.Value.Clear(); - // Check to see if this is a flush if (maxUpdates <= 0) { @@ -3970,36 +3902,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (sp.IsChildAgent) continue; - // If the object is an attachment we don't want it to be in the kill - // record. Else attaching from inworld and subsequently dropping - // it will no longer work. -// lock (m_killRecord) -// { -// m_killRecord.Remove(part.LocalId); -// m_killRecord.Remove(part.ParentGroup.RootPart.LocalId); -// } - } - else - { - // Please do not remove this unless you can demonstrate on the OpenSim mailing list that a client - // will never receive an update after a prim kill. Even then, keeping the kill record may be a good - // safety measure. - // - // If a Linden Lab 1.23.5 client (and possibly later and earlier) receives an object update - // after a kill, it will keep displaying the deleted object until relog. OpenSim currently performs - // updates and kills on different threads with different scheduling strategies, hence this protection. - // - // This doesn't appear to apply to child prims - a client will happily ignore these updates - // after the root prim has been deleted. - // - // We ignore this for attachments because attaching something from inworld breaks unless we do. -// lock (m_killRecord) -// { -// if (m_killRecord.Contains(part.LocalId)) -// continue; -// if (m_killRecord.Contains(part.ParentGroup.RootPart.LocalId)) -// continue; -// } } if (part.ParentGroup.IsAttachment && m_disableFacelights) @@ -4188,16 +4090,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP for (int i = 0; i < blocks.Count; i++) packet.ObjectData[i] = blocks[i]; - -// OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseUpdates.Value, oPacket); }); - // use default udp retry + OutPacket(packet, ThrottleOutPacketType.Task, true); } - - #endregion Packet Sending - } // hack.. dont use diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index 8852715..bb68921 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs @@ -364,9 +364,6 @@ 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); @@ -383,8 +380,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP task = task + (int)(m_cannibalrate * texture); texture = (int)((1 - m_cannibalrate) * texture); - total = resend + land + wind + cloud + task + texture + asset; - total /= 128; + // int total = resend + land + wind + cloud + task + texture + asset; + //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); @@ -428,25 +425,27 @@ namespace OpenSim.Region.ClientStack.LindenUDP int i = 0; // multiply by 8 to convert bytes back to bits - rate = (float)m_throttleCategories[(int)ThrottleOutPacketType.Resend].RequestedDripRate * 8 * multiplier; + multiplier *= 8; + + rate = (float)m_throttleCategories[(int)ThrottleOutPacketType.Resend].RequestedDripRate * multiplier; Buffer.BlockCopy(Utils.FloatToBytes(rate), 0, data, i, 4); i += 4; - rate = (float)m_throttleCategories[(int)ThrottleOutPacketType.Land].RequestedDripRate * 8 * multiplier; + rate = (float)m_throttleCategories[(int)ThrottleOutPacketType.Land].RequestedDripRate * multiplier; Buffer.BlockCopy(Utils.FloatToBytes(rate), 0, data, i, 4); i += 4; - rate = (float)m_throttleCategories[(int)ThrottleOutPacketType.Wind].RequestedDripRate * 8 * multiplier; + rate = (float)m_throttleCategories[(int)ThrottleOutPacketType.Wind].RequestedDripRate * multiplier; Buffer.BlockCopy(Utils.FloatToBytes(rate), 0, data, i, 4); i += 4; - rate = (float)m_throttleCategories[(int)ThrottleOutPacketType.Cloud].RequestedDripRate * 8 * multiplier; + rate = (float)m_throttleCategories[(int)ThrottleOutPacketType.Cloud].RequestedDripRate * multiplier; Buffer.BlockCopy(Utils.FloatToBytes(rate), 0, data, i, 4); i += 4; - rate = (float)m_throttleCategories[(int)ThrottleOutPacketType.Task].RequestedDripRate * 8 * multiplier; + rate = (float)m_throttleCategories[(int)ThrottleOutPacketType.Task].RequestedDripRate * multiplier; Buffer.BlockCopy(Utils.FloatToBytes(rate), 0, data, i, 4); i += 4; - rate = (float)m_throttleCategories[(int)ThrottleOutPacketType.Texture].RequestedDripRate * 8 * multiplier; + rate = (float)m_throttleCategories[(int)ThrottleOutPacketType.Texture].RequestedDripRate * multiplier; Buffer.BlockCopy(Utils.FloatToBytes(rate), 0, data, i, 4); i += 4; - rate = (float)m_throttleCategories[(int)ThrottleOutPacketType.Asset].RequestedDripRate * 8 * multiplier; + rate = (float)m_throttleCategories[(int)ThrottleOutPacketType.Asset].RequestedDripRate * multiplier; Buffer.BlockCopy(Utils.FloatToBytes(rate), 0, data, i, 4); i += 4; m_packedThrottles = data; @@ -485,19 +484,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP TokenBucket bucket = m_throttleCategories[category]; - // 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 + // Don't send this packet if queue is not empty if (queue.Count > 0 || m_nextPackets[category] != null) { queue.Enqueue(packet, highPriority); return true; } - - + if (!forceQueue && bucket.RemoveTokens(packet.Buffer.DataLength)) { - // Enough tokens were removed from the bucket, the packet will not be queued + // enough tokens so it can be sent imediatly by caller return false; } else -- cgit v1.1 From ff4df688ba548aa6050bcec232b98bd5a4ac4ffd Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 28 Aug 2014 12:55:31 +0100 Subject: send all presences terseupdates in same batch --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index e82f1d7..7227964 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -4015,8 +4015,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP } else { - if (update.Entity is ScenePresence && ((ScenePresence)update.Entity).UUID == AgentId) - // Self updates go into a special list + if (update.Entity is ScenePresence) + // ALL presence updates go into a special list terseAgentUpdateBlocks.Value.Add(CreateImprovedTerseBlock(update.Entity, updateFlags.HasFlag(PrimUpdateFlags.Textures))); else // Everything else goes here @@ -4028,7 +4028,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP #region Packet Sending - const float TIME_DILATION = 1.0f; +// const float TIME_DILATION = 1.0f; ushort timeDilation = Utils.FloatToUInt16(avgTimeDilation, 0.0f, 1.0f); if (terseAgentUpdateBlocks.IsValueCreated) -- cgit v1.1 From 5a2d4fd47f64a656b36fd428473715d9f764729b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 28 Aug 2014 16:49:32 +0100 Subject: add some functions for estimation of number of bytes that can be send in a category in specified time --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs | 8 ++++++++ OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs | 5 +++++ 2 files changed, 13 insertions(+) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index bb68921..7c55b37 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs @@ -453,6 +453,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP return data; } + + public int GetCatBytesCanSend(ThrottleOutPacketType cat, int timeMS) + { + TokenBucket bucket = m_throttleCategories[(int)cat]; + int bytes = timeMS * (int)(bucket.RequestedDripRate / 1000); + bytes += (int)bucket.CurrentTokenCount(); + return bytes; + } /// /// Queue an outgoing packet if appropriate. diff --git a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs index 4c33db5..2a60b48 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs @@ -274,6 +274,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP return false; } + public long CurrentTokenCount() + { + return m_tokenCount; + } + /// /// Deposit tokens into the bucket from a child bucket that did /// not use all of its available tokens -- cgit v1.1 From 9839904ebe82f9c7a2084d7d7cf4e5399c679ce5 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 28 Aug 2014 18:51:55 +0100 Subject: try to make sense of throttle rate limits --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs | 16 +++++++++++++--- OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs | 3 ++- 2 files changed, 15 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index 7c55b37..84c0d03 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs @@ -217,6 +217,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_maxRTO = maxRTO; // Create a token bucket throttle for this client that has the scene token bucket as a parent + // 2500000 bits/s max m_throttleClient = new AdaptiveTokenBucket(parentThrottle, rates.Total, rates.AdaptiveThrottlesEnabled); // Create a token bucket throttle for the total categary with the client bucket as a throttle m_throttleCategory = new TokenBucket(m_throttleClient, 0); @@ -224,7 +225,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_throttleCategories = new TokenBucket[THROTTLE_CATEGORY_COUNT]; m_cannibalrate = rates.CannibalizeTextureRate; - + + long totalrate = 0; + long catrate = 0; + for (int i = 0; i < THROTTLE_CATEGORY_COUNT; i++) { ThrottleOutPacketType type = (ThrottleOutPacketType)i; @@ -232,9 +236,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Initialize the packet outboxes, where packets sit while they are waiting for tokens m_packetOutboxes[i] = new DoubleLocklessQueue(); // Initialize the token buckets that control the throttling for each category - m_throttleCategories[i] = new TokenBucket(m_throttleCategory, rates.GetRate(type)); + catrate = rates.GetRate(type); + totalrate += catrate; + m_throttleCategories[i] = new TokenBucket(m_throttleCategory, catrate); } + m_throttleCategory.RequestedDripRate = totalrate; + // Default the retransmission timeout to one second RTO = m_defaultRTO; @@ -380,7 +388,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP task = task + (int)(m_cannibalrate * texture); texture = (int)((1 - m_cannibalrate) * texture); - // int total = resend + land + wind + cloud + task + texture + asset; + int total = resend + land + wind + cloud + task + texture + asset; //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); @@ -409,6 +417,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP bucket = m_throttleCategories[(int)ThrottleOutPacketType.Texture]; bucket.RequestedDripRate = texture; + m_throttleCategory.RequestedDripRate = total; + // Reset the packed throttles cached data m_packedThrottles = null; } diff --git a/OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs b/OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs index e5bae6e..2b307c7 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs @@ -80,7 +80,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP Texture = throttleConfig.GetInt("texture_default", 18500); Asset = throttleConfig.GetInt("asset_default", 10500); - Total = throttleConfig.GetInt("client_throttle_max_bps", 0); + // 2500000 bps max + Total = throttleConfig.GetInt("client_throttle_max_bps",312500); AdaptiveThrottlesEnabled = throttleConfig.GetBoolean("enable_adaptive_throttles", false); -- cgit v1.1 From 894b5c10c61d7cc88c4f95b888111216590efff5 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 28 Aug 2014 18:54:08 +0100 Subject: remove misplaced comment --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs | 1 - 1 file changed, 1 deletion(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index 84c0d03..89a9401 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs @@ -217,7 +217,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_maxRTO = maxRTO; // Create a token bucket throttle for this client that has the scene token bucket as a parent - // 2500000 bits/s max m_throttleClient = new AdaptiveTokenBucket(parentThrottle, rates.Total, rates.AdaptiveThrottlesEnabled); // Create a token bucket throttle for the total categary with the client bucket as a throttle m_throttleCategory = new TokenBucket(m_throttleClient, 0); -- cgit v1.1 From 986863a0cd9cf79111865cee2729aa6edd7a8ffa Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 28 Aug 2014 22:26:03 +0100 Subject: try to reduce insane high data rate udp bursts. This needs testing on a region with a lot of contents. Should not affect much average rates. --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs | 2 ++ OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs | 10 +++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index 89a9401..e760513 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs @@ -616,6 +616,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP { // No packets in this queue. Fire the queue empty callback // if it has not been called recently + + bucket.Tick(); // tick the bucket emptyCategories |= CategoryToFlag(i); } } diff --git a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs index 2a60b48..b1f2236 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs @@ -312,6 +312,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Determine the interval over which we are adding tokens, never add // more than a single quantum of tokens + + // No... add no more than the estimated time between checks + Int32 deltaMS = Math.Min(Util.EnvironmentTickCountSubtract(m_lastDrip), m_ticksPerQuantum); m_lastDrip = Util.EnvironmentTickCount(); @@ -322,6 +325,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP Deposit(deltaMS * DripRate / m_ticksPerQuantum); } + + public void Tick() + { + m_lastDrip = Util.EnvironmentTickCount(); + } } public class AdaptiveTokenBucket : TokenBucket @@ -333,7 +341,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// packet per second. Open the throttle to 15 packets per second /// or about 160kbps. /// - protected const Int64 m_minimumFlow = m_minimumDripRate * 15; + protected const Int64 m_minimumFlow = m_minimumDripRate; // // The maximum rate for flow control. Drip rate can never be -- cgit v1.1 From 6f590c2f799d5c6109fffa6ce32f2e751ec9c59e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 29 Aug 2014 00:05:57 +0100 Subject: disable first drip --- OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs index b1f2236..a2ff884 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs @@ -180,7 +180,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP RequestedDripRate = dripRate; // TotalDripRequest = dripRate; // this will be overwritten when a child node registers // MaxBurst = (Int64)((double)dripRate * m_quantumsPerBurst); - m_lastDrip = Util.EnvironmentTickCount(); + m_lastDrip = Util.EnvironmentTickCount() + 100000; } #endregion Constructor -- cgit v1.1 From 438798202fc1f578864a2796cb8a66b3199a77e0 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 29 Aug 2014 13:26:30 +0100 Subject: replace the tick() by a limit on the maximum number of tokens that can be acumulated ( variable named BurtRate, not exactly a rate...) --- .../Region/ClientStack/Linden/UDP/LLUDPClient.cs | 2 - .../Region/ClientStack/Linden/UDP/TokenBucket.cs | 52 ++++++++++++++++------ 2 files changed, 39 insertions(+), 15 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index e760513..89a9401 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs @@ -616,8 +616,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP { // No packets in this queue. Fire the queue empty callback // if it has not been called recently - - bucket.Tick(); // tick the bucket emptyCategories |= CategoryToFlag(i); } } diff --git a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs index a2ff884..3147095 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs @@ -53,10 +53,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP protected const Int32 m_ticksPerQuantum = 1000; /// - /// This is the number of quantums worth of packets that can - /// be accommodated during a burst + /// This is the number of m_minimumDripRate bytes + /// allowed in a burst + /// roughtly, with this settings, the maximum time system will take + /// to recheck a bucket in ms + /// /// - protected const Double m_quantumsPerBurst = 1.5; + protected const Double m_quantumsPerBurst = 15; /// /// @@ -91,22 +94,33 @@ namespace OpenSim.Region.ClientStack.LindenUDP } /// - /// Maximum burst rate in bytes per second. This is the maximum number + /// This is the maximum number /// of tokens that can accumulate in the bucket at any one time. This /// also sets the total request for leaf nodes + /// this is not a rate. /// protected Int64 m_burstRate; public Int64 RequestedBurstRate { get { return m_burstRate; } - set { m_burstRate = (value < 0 ? 0 : value); } + set { + double rate = (value < 0 ? 0 : value); + if (rate < m_minimumDripRate) + rate = m_minimumDripRate; + else if (rate > m_minimumDripRate * m_quantumsPerBurst) + rate = m_minimumDripRate * m_quantumsPerBurst; + + m_burstRate = (Int64)rate; + } } public Int64 BurstRate { get { double rate = RequestedBurstRate * BurstRateModifier(); - if (rate < m_minimumDripRate * m_quantumsPerBurst) + if (rate < m_minimumDripRate) + rate = m_minimumDripRate; + else if (rate > m_minimumDripRate * m_quantumsPerBurst) rate = m_minimumDripRate * m_quantumsPerBurst; return (Int64) rate; @@ -126,8 +140,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP get { return (m_dripRate == 0 ? m_totalDripRequest : m_dripRate); } set { m_dripRate = (value < 0 ? 0 : value); - m_burstRate = (Int64)((double)m_dripRate * m_quantumsPerBurst); m_totalDripRequest = m_dripRate; + + double rate = m_dripRate; + if (rate > m_minimumDripRate * m_quantumsPerBurst) + rate = m_minimumDripRate * m_quantumsPerBurst; + else if (rate < m_minimumDripRate) + rate = m_minimumDripRate; + + m_burstRate = (Int64)rate; + + m_tokenCount = 0; + if (m_parent != null) m_parent.RegisterRequest(this,m_dripRate); } @@ -325,11 +349,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP Deposit(deltaMS * DripRate / m_ticksPerQuantum); } - - public void Tick() - { - m_lastDrip = Util.EnvironmentTickCount(); - } } public class AdaptiveTokenBucket : TokenBucket @@ -364,7 +383,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP get { return m_dripRate; } set { m_dripRate = OpenSim.Framework.Util.Clamp(value,m_minimumFlow,MaxDripRate); - m_burstRate = (Int64)((double)m_dripRate * m_quantumsPerBurst); + + double rate = m_dripRate; + if (rate > m_minimumDripRate * m_quantumsPerBurst) + rate = m_minimumDripRate * m_quantumsPerBurst; + else if (rate < m_minimumDripRate) + rate = m_minimumDripRate; + m_burstRate = (Int64)rate; + if (m_parent != null) m_parent.RegisterRequest(this,m_dripRate); } -- cgit v1.1 From fd0a635302f11ee7a39b9d0cab55c05276be12f6 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 29 Aug 2014 15:13:46 +0100 Subject: reduce burst --- OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs index 3147095..26467bc 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs @@ -59,7 +59,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// to recheck a bucket in ms /// /// - protected const Double m_quantumsPerBurst = 15; + protected const Double m_quantumsPerBurst = 5; /// /// -- cgit v1.1 From 7351d92a76ac24edce848fe7410e920f17962101 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 29 Aug 2014 16:19:30 +0100 Subject: add method to get a category throttle rate --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 8 ++- .../Region/ClientStack/Linden/UDP/LLUDPClient.cs | 67 +++++++++++----------- 2 files changed, 37 insertions(+), 38 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 7227964..12ee3b2 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -12306,16 +12306,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP } /// - /// Sets the throttles from values supplied by the client + /// Sets the throttles from values supplied caller /// /// public void SetAgentThrottleSilent(int throttle, int setting) { m_udpClient.ForceThrottleSetting(throttle,setting); - //m_udpClient.SetThrottles(throttles); - } + public int GetAgentThrottleSilent(int throttle) + { + return m_udpClient.GetThrottleSetting(throttle); + } /// /// Get the current throttles for this client as a packed byte array diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index 89a9401..f91abfe 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs @@ -688,6 +688,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP RTO = Math.Min(RTO * 2, m_maxRTO); } + + const int MIN_CALLBACK_MS = 30; + /// /// Does an early check to see if this queue empty callback is already /// running, then asynchronously firing the event @@ -695,24 +698,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// Throttle categories to fire the callback for private void BeginFireQueueEmpty(ThrottleOutPacketTypeFlags categories) { -// if (m_nextOnQueueEmpty != 0 && (Environment.TickCount & Int32.MaxValue) >= m_nextOnQueueEmpty) - if (!m_isQueueEmptyRunning && (Environment.TickCount & Int32.MaxValue) >= m_nextOnQueueEmpty) + if (!m_isQueueEmptyRunning) { - m_isQueueEmptyRunning = true; - int start = Environment.TickCount & Int32.MaxValue; - const int MIN_CALLBACK_MS = 30; + + if (start < m_nextOnQueueEmpty) + return; + + m_isQueueEmptyRunning = true; m_nextOnQueueEmpty = start + MIN_CALLBACK_MS; if (m_nextOnQueueEmpty == 0) m_nextOnQueueEmpty = 1; - // Use a value of 0 to signal that FireQueueEmpty is running -// m_nextOnQueueEmpty = 0; - - m_categories = categories; - - if (HasUpdates(m_categories)) + if (HasUpdates(categories)) { // Asynchronously run the callback Util.FireAndForget(FireQueueEmpty, categories); @@ -725,7 +724,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } private bool m_isQueueEmptyRunning; - private ThrottleOutPacketTypeFlags m_categories = 0; + /// /// Fires the OnQueueEmpty callback and sets the minimum time that it @@ -736,35 +735,33 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// signature private void FireQueueEmpty(object o) { -// int start = Environment.TickCount & Int32.MaxValue; -// const int MIN_CALLBACK_MS = 30; - -// if (m_udpServer.IsRunningOutbound) -// { - ThrottleOutPacketTypeFlags categories = (ThrottleOutPacketTypeFlags)o; - QueueEmpty callback = OnQueueEmpty; + ThrottleOutPacketTypeFlags categories = (ThrottleOutPacketTypeFlags)o; + QueueEmpty callback = OnQueueEmpty; - if (callback != null) - { -// if (m_udpServer.IsRunningOutbound) -// { - try { callback(categories); } - catch (Exception e) { m_log.Error("[LLUDPCLIENT]: OnQueueEmpty(" + categories + ") threw an exception: " + e.Message, e); } -// } - } -// } - -// m_nextOnQueueEmpty = start + MIN_CALLBACK_MS; -// if (m_nextOnQueueEmpty == 0) -// m_nextOnQueueEmpty = 1; - -// } + if (callback != null) + { + // if (m_udpServer.IsRunningOutbound) + // { + try { callback(categories); } + catch (Exception e) { m_log.Error("[LLUDPCLIENT]: OnQueueEmpty(" + categories + ") threw an exception: " + e.Message, e); } + // } + } m_isQueueEmptyRunning = false; } + internal void ForceThrottleSetting(int throttle, int setting) { - m_throttleCategories[throttle].RequestedDripRate = Math.Max(setting, LLUDPServer.MTU); ; + if (throttle > 0 && throttle < THROTTLE_CATEGORY_COUNT) + m_throttleCategories[throttle].RequestedDripRate = Math.Max(setting, LLUDPServer.MTU); + } + + internal int GetThrottleSetting(int throttle) + { + if (throttle > 0 && throttle < THROTTLE_CATEGORY_COUNT) + return (int)m_throttleCategories[throttle].RequestedDripRate; + else + return 0; } /// -- cgit v1.1 From 50433e089b548d3e9233b897568b7def489323fb Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 2 Sep 2014 15:48:59 +0100 Subject: *needs testing, not that good* change throttles math using floats and not int64, etc. Limite brust bytes to the total rate client requested times a look ahead estimation time, Avoid queues starvation with updates waiting... --- .../Region/ClientStack/Linden/UDP/LLUDPClient.cs | 61 ++++---- .../Region/ClientStack/Linden/UDP/LLUDPServer.cs | 2 +- .../Region/ClientStack/Linden/UDP/ThrottleRates.cs | 13 +- .../Region/ClientStack/Linden/UDP/TokenBucket.cs | 161 ++++++++------------- 4 files changed, 112 insertions(+), 125 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index f91abfe..45013b3 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs @@ -144,8 +144,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP get { return m_throttleClient; } } - /// Throttle bucket for this agent's connection - private readonly TokenBucket m_throttleCategory; /// Throttle buckets for each packet category private readonly TokenBucket[] m_throttleCategories; /// Outgoing queues for throttled packets @@ -163,6 +161,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP private int m_maxRTO = 60000; public bool m_deliverPackets = true; + private float m_burstTime; + public int m_lastStartpingTimeMS; public int m_pingMS; @@ -216,17 +216,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (maxRTO != 0) m_maxRTO = maxRTO; + m_burstTime = rates.BrustTime; + float m_burst = rates.ClientMaxRate * m_burstTime; + // Create a token bucket throttle for this client that has the scene token bucket as a parent - m_throttleClient = new AdaptiveTokenBucket(parentThrottle, rates.Total, rates.AdaptiveThrottlesEnabled); - // Create a token bucket throttle for the total categary with the client bucket as a throttle - m_throttleCategory = new TokenBucket(m_throttleClient, 0); + m_throttleClient = new AdaptiveTokenBucket(parentThrottle, rates.ClientMaxRate, m_burst, rates.AdaptiveThrottlesEnabled); // Create an array of token buckets for this clients different throttle categories m_throttleCategories = new TokenBucket[THROTTLE_CATEGORY_COUNT]; m_cannibalrate = rates.CannibalizeTextureRate; - long totalrate = 0; - long catrate = 0; + m_burst = rates.Total * rates.BrustTime; for (int i = 0; i < THROTTLE_CATEGORY_COUNT; i++) { @@ -235,13 +235,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Initialize the packet outboxes, where packets sit while they are waiting for tokens m_packetOutboxes[i] = new DoubleLocklessQueue(); // Initialize the token buckets that control the throttling for each category - catrate = rates.GetRate(type); - totalrate += catrate; - m_throttleCategories[i] = new TokenBucket(m_throttleCategory, catrate); + m_throttleCategories[i] = new TokenBucket(m_throttleClient, rates.GetRate(type), m_burst); } - m_throttleCategory.RequestedDripRate = totalrate; - // Default the retransmission timeout to one second RTO = m_defaultRTO; @@ -285,7 +281,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_info.taskThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Task].DripRate; m_info.assetThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Asset].DripRate; m_info.textureThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Texture].DripRate; - m_info.totalThrottle = (int)m_throttleCategory.DripRate; + m_info.totalThrottle = (int)m_throttleClient.DripRate; return m_info; } @@ -373,6 +369,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Make sure none of the throttles are set below our packet MTU, // otherwise a throttle could become permanently clogged + +/* not using floats resend = Math.Max(resend, LLUDPServer.MTU); land = Math.Max(land, LLUDPServer.MTU); wind = Math.Max(wind, LLUDPServer.MTU); @@ -380,6 +378,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP task = Math.Max(task, LLUDPServer.MTU); texture = Math.Max(texture, LLUDPServer.MTU); asset = Math.Max(asset, LLUDPServer.MTU); +*/ // Since most textures are now delivered through http, make it possible // to cannibalize some of the bw from the texture throttle to use for @@ -388,7 +387,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP texture = (int)((1 - m_cannibalrate) * texture); int total = resend + land + wind + cloud + task + texture + asset; - + + float m_burst = total * m_burstTime; + //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); @@ -397,26 +398,31 @@ namespace OpenSim.Region.ClientStack.LindenUDP bucket = m_throttleCategories[(int)ThrottleOutPacketType.Resend]; bucket.RequestedDripRate = resend; + bucket.RequestedBurst = m_burst; bucket = m_throttleCategories[(int)ThrottleOutPacketType.Land]; bucket.RequestedDripRate = land; + bucket.RequestedBurst = m_burst; bucket = m_throttleCategories[(int)ThrottleOutPacketType.Wind]; bucket.RequestedDripRate = wind; + bucket.RequestedBurst = m_burst; bucket = m_throttleCategories[(int)ThrottleOutPacketType.Cloud]; bucket.RequestedDripRate = cloud; + bucket.RequestedBurst = m_burst; bucket = m_throttleCategories[(int)ThrottleOutPacketType.Asset]; bucket.RequestedDripRate = asset; + bucket.RequestedBurst = m_burst; bucket = m_throttleCategories[(int)ThrottleOutPacketType.Task]; bucket.RequestedDripRate = task; + bucket.RequestedBurst = m_burst; bucket = m_throttleCategories[(int)ThrottleOutPacketType.Texture]; bucket.RequestedDripRate = texture; - - m_throttleCategory.RequestedDripRate = total; + bucket.RequestedBurst = m_burst; // Reset the packed throttles cached data m_packedThrottles = null; @@ -465,10 +471,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP public int GetCatBytesCanSend(ThrottleOutPacketType cat, int timeMS) { - TokenBucket bucket = m_throttleCategories[(int)cat]; - int bytes = timeMS * (int)(bucket.RequestedDripRate / 1000); - bytes += (int)bucket.CurrentTokenCount(); - return bytes; + int icat = (int)cat; + if (icat > 0 && icat < THROTTLE_CATEGORY_COUNT) + { + TokenBucket bucket = m_throttleCategories[icat]; + return bucket.GetCatBytesCanSend(timeMS); + } + else + return 0; } /// @@ -572,6 +582,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_udpServer.SendPacketFinal(nextPacket); m_nextPackets[i] = null; packetSent = true; + + if (m_packetOutboxes[i].Count < 5) + emptyCategories |= CategoryToFlag(i); } } else @@ -599,6 +612,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Send the packet m_udpServer.SendPacketFinal(packet); packetSent = true; + + if (queue.Count < 5) + emptyCategories |= CategoryToFlag(i); } else { @@ -606,11 +622,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_nextPackets[i] = packet; } - // If the queue is empty after this dequeue, fire the queue - // empty callback now so it has a chance to fill before we - // get back here - if (queue.Count == 0) - emptyCategories |= CategoryToFlag(i); } else { diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index dea9d7f..9b3802d 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -449,7 +449,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } #endregion BinaryStats - m_throttle = new TokenBucket(null, sceneThrottleBps); + m_throttle = new TokenBucket(null, sceneThrottleBps, sceneThrottleBps * 10e-3f); ThrottleRates = new ThrottleRates(configSource); Random rnd = new Random(Util.EnvironmentTickCount()); diff --git a/OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs b/OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs index 2b307c7..451dee5 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/ThrottleRates.cs @@ -62,6 +62,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// Amount of the texture throttle to steal for the task throttle public double CannibalizeTextureRate; + public int ClientMaxRate; + public float BrustTime; + /// /// Default constructor /// @@ -80,8 +83,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP Texture = throttleConfig.GetInt("texture_default", 18500); Asset = throttleConfig.GetInt("asset_default", 10500); - // 2500000 bps max - Total = throttleConfig.GetInt("client_throttle_max_bps",312500); + Total = Resend + Land + Wind + Cloud + Task + Texture + Asset; + // 3000000 bps default max + ClientMaxRate = throttleConfig.GetInt("client_throttle_max_bps", 375000); + if (ClientMaxRate > 1000000) + ClientMaxRate = 1000000; // no more than 8Mbps + + BrustTime = (float)throttleConfig.GetInt("client_throttle_burtsTimeMS", 10); + BrustTime *= 1e-3f; AdaptiveThrottlesEnabled = throttleConfig.GetBoolean("enable_adaptive_throttles", false); diff --git a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs index 26467bc..384439c 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs @@ -44,13 +44,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static Int32 m_counter = 0; -// private Int32 m_identifier; - - /// - /// Number of ticks (ms) per quantum, drip rate and max burst - /// are defined over this interval. - /// - protected const Int32 m_ticksPerQuantum = 1000; +// private Int32 m_identifier; + + protected const float m_timeScale = 1e-3f; /// /// This is the number of m_minimumDripRate bytes @@ -59,11 +55,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// to recheck a bucket in ms /// /// - protected const Double m_quantumsPerBurst = 5; + protected const float m_quantumsPerBurst = 5; /// /// - protected const Int32 m_minimumDripRate = 1400; + protected const float m_minimumDripRate = 1400; /// Time of the last drip, in system ticks protected Int32 m_lastDrip; @@ -72,12 +68,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// The number of bytes that can be sent at this moment. This is the /// current number of tokens in the bucket /// - protected Int64 m_tokenCount; + protected float m_tokenCount; /// /// Map of children buckets and their requested maximum burst rate /// - protected Dictionary m_children = new Dictionary(); + protected Dictionary m_children = new Dictionary(); #region Properties @@ -97,33 +93,29 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// This is the maximum number /// of tokens that can accumulate in the bucket at any one time. This /// also sets the total request for leaf nodes - /// this is not a rate. /// - protected Int64 m_burstRate; - public Int64 RequestedBurstRate + protected float m_burst; + public float RequestedBurst { - get { return m_burstRate; } + get { return m_burst; } set { - double rate = (value < 0 ? 0 : value); + float rate = (value < 0 ? 0 : value); if (rate < m_minimumDripRate) rate = m_minimumDripRate; else if (rate > m_minimumDripRate * m_quantumsPerBurst) rate = m_minimumDripRate * m_quantumsPerBurst; - m_burstRate = (Int64)rate; + m_burst = rate; } } - public Int64 BurstRate + public float Burst { get { - double rate = RequestedBurstRate * BurstRateModifier(); + float rate = RequestedBurst * BurstModifier(); if (rate < m_minimumDripRate) rate = m_minimumDripRate; - else if (rate > m_minimumDripRate * m_quantumsPerBurst) - rate = m_minimumDripRate * m_quantumsPerBurst; - - return (Int64) rate; + return (float)rate; } } @@ -134,40 +126,31 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// Tokens are added to the bucket any time /// is called, at the granularity of /// the system tick interval (typically around 15-22ms) - protected Int64 m_dripRate; - public virtual Int64 RequestedDripRate + protected float m_dripRate; + public virtual float RequestedDripRate { get { return (m_dripRate == 0 ? m_totalDripRequest : m_dripRate); } set { m_dripRate = (value < 0 ? 0 : value); m_totalDripRequest = m_dripRate; - double rate = m_dripRate; - if (rate > m_minimumDripRate * m_quantumsPerBurst) - rate = m_minimumDripRate * m_quantumsPerBurst; - else if (rate < m_minimumDripRate) - rate = m_minimumDripRate; - - m_burstRate = (Int64)rate; - - m_tokenCount = 0; - if (m_parent != null) m_parent.RegisterRequest(this,m_dripRate); } } - public virtual Int64 DripRate + public virtual float DripRate { get { + float rate = Math.Min(RequestedDripRate,TotalDripRequest); if (m_parent == null) - return Math.Min(RequestedDripRate,TotalDripRequest); - - double rate = (double)RequestedDripRate * m_parent.DripRateModifier(); + return rate; + + rate *= m_parent.DripRateModifier(); if (rate < m_minimumDripRate) rate = m_minimumDripRate; - return (Int64)rate; + return (float)rate; } } @@ -175,8 +158,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// The current total of the requested maximum burst rates of /// this bucket's children buckets. /// - protected Int64 m_totalDripRequest; - public Int64 TotalDripRequest + protected float m_totalDripRequest; + public float TotalDripRequest { get { return m_totalDripRequest; } set { m_totalDripRequest = value; } @@ -195,13 +178,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// zero if this bucket has no maximum capacity /// Rate that the bucket fills, in bytes per /// second. If zero, the bucket always remains full - public TokenBucket(TokenBucket parent, Int64 dripRate) + public TokenBucket(TokenBucket parent, float dripRate, float MaxBurst) { // m_identifier = m_counter++; m_counter++; Parent = parent; RequestedDripRate = dripRate; + RequestedBurst = MaxBurst; // TotalDripRequest = dripRate; // this will be overwritten when a child node registers // MaxBurst = (Int64)((double)dripRate * m_quantumsPerBurst); m_lastDrip = Util.EnvironmentTickCount() + 100000; @@ -216,15 +200,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// hierarchy. However, if any of the parents is over-booked, then /// the modifier will be less than 1. /// - protected double DripRateModifier() + protected float DripRateModifier() { - Int64 driprate = DripRate; - return driprate >= TotalDripRequest ? 1.0 : (double)driprate / (double)TotalDripRequest; + float driprate = DripRate; + return driprate >= TotalDripRequest ? 1.0f : driprate / TotalDripRequest; } /// /// - protected double BurstRateModifier() + protected float BurstModifier() { // for now... burst rate is always m_quantumsPerBurst (constant) // larger than drip rate so the ratio of burst requests is the @@ -236,7 +220,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// Register drip rate requested by a child of this throttle. Pass the /// changes up the hierarchy. /// - public void RegisterRequest(TokenBucket child, Int64 request) + public void RegisterRequest(TokenBucket child, float request) { lock (m_children) { @@ -244,7 +228,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // m_totalDripRequest = m_children.Values.Sum(); m_totalDripRequest = 0; - foreach (KeyValuePair cref in m_children) + foreach (KeyValuePair cref in m_children) m_totalDripRequest += cref.Value; } @@ -265,7 +249,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // m_totalDripRequest = m_children.Values.Sum(); m_totalDripRequest = 0; - foreach (KeyValuePair cref in m_children) + foreach (KeyValuePair cref in m_children) m_totalDripRequest += cref.Value; } @@ -281,7 +265,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// Number of tokens to remove from the bucket /// True if the requested number of tokens were removed from /// the bucket, otherwise false - public bool RemoveTokens(Int64 amount) + public bool RemoveTokens(int amount) { // Deposit tokens for this interval Drip(); @@ -298,24 +282,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP return false; } - public long CurrentTokenCount() - { - return m_tokenCount; - } - - /// - /// Deposit tokens into the bucket from a child bucket that did - /// not use all of its available tokens - /// - protected void Deposit(Int64 count) + public int GetCatBytesCanSend(int timeMS) { - m_tokenCount += count; - - // Deposit the overflow in the parent bucket, this is how we share - // unused bandwidth - Int64 burstrate = BurstRate; - if (m_tokenCount > burstrate) - m_tokenCount = burstrate; +// return (int)(m_tokenCount + timeMS * m_dripRate * 1e-3); + return (int)(timeMS * m_dripRate * 1e-3); } /// @@ -334,12 +304,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP return; } - // Determine the interval over which we are adding tokens, never add - // more than a single quantum of tokens - - // No... add no more than the estimated time between checks - - Int32 deltaMS = Math.Min(Util.EnvironmentTickCountSubtract(m_lastDrip), m_ticksPerQuantum); + Int32 deltaMS = Util.EnvironmentTickCountSubtract(m_lastDrip); m_lastDrip = Util.EnvironmentTickCount(); // This can be 0 in the very unusual case that the timer wrapped @@ -347,7 +312,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (deltaMS <= 0) return; - Deposit(deltaMS * DripRate / m_ticksPerQuantum); + m_tokenCount += deltaMS * DripRate * m_timeScale; + + float burst = Burst; + if (m_tokenCount > burst) + m_tokenCount = burst; } } @@ -357,20 +326,24 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// /// The minimum rate for flow control. Minimum drip rate is one - /// packet per second. Open the throttle to 15 packets per second - /// or about 160kbps. + /// packet per second. /// - protected const Int64 m_minimumFlow = m_minimumDripRate; + + protected const float m_minimumFlow = 50000; // // The maximum rate for flow control. Drip rate can never be // greater than this. // - protected Int64 m_maxDripRate = 0; - protected Int64 MaxDripRate + + protected float m_maxDripRate = 0; + public float MaxDripRate { get { return (m_maxDripRate == 0 ? m_totalDripRequest : m_maxDripRate); } - set { m_maxDripRate = (value == 0 ? 0 : Math.Max(value,m_minimumFlow)); } + set + { + m_maxDripRate = (value == 0 ? m_totalDripRequest : Math.Max(value, m_minimumFlow)); + } } private bool m_enabled = false; @@ -378,18 +351,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP // // // - public virtual Int64 AdjustedDripRate + public virtual float AdjustedDripRate { get { return m_dripRate; } set { - m_dripRate = OpenSim.Framework.Util.Clamp(value,m_minimumFlow,MaxDripRate); - - double rate = m_dripRate; - if (rate > m_minimumDripRate * m_quantumsPerBurst) - rate = m_minimumDripRate * m_quantumsPerBurst; - else if (rate < m_minimumDripRate) - rate = m_minimumDripRate; - m_burstRate = (Int64)rate; + m_dripRate = OpenSim.Framework.Util.Clamp(value,m_minimumFlow,MaxDripRate); if (m_parent != null) m_parent.RegisterRequest(this,m_dripRate); @@ -399,16 +365,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP // // // - public AdaptiveTokenBucket(TokenBucket parent, Int64 maxDripRate, bool enabled) : base(parent,maxDripRate) + public AdaptiveTokenBucket(TokenBucket parent, float maxDripRate,float maxBurst, bool enabled) + : base(parent, maxDripRate,maxBurst) { m_enabled = enabled; + + MaxDripRate = maxDripRate; - if (m_enabled) - { - // m_log.DebugFormat("[TOKENBUCKET] Adaptive throttle enabled"); - MaxDripRate = maxDripRate; - AdjustedDripRate = m_minimumFlow; - } + if (enabled) + AdjustedDripRate = m_maxDripRate * .5f; + else + AdjustedDripRate = m_maxDripRate; } // -- cgit v1.1 From 6611e75a2beba8d28aed4e1ea56135da491328c0 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 2 Sep 2014 16:11:46 +0100 Subject: void time change between gettime calls --- OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs index 384439c..1877cf0 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs @@ -304,11 +304,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP return; } - Int32 deltaMS = Util.EnvironmentTickCountSubtract(m_lastDrip); - m_lastDrip = Util.EnvironmentTickCount(); + Int32 now = Util.EnvironmentTickCount(); + Int32 deltaMS = now - m_lastDrip; + m_lastDrip = now; - // This can be 0 in the very unusual case that the timer wrapped - // It can be 0 if we try add tokens at a sub-tick rate if (deltaMS <= 0) return; -- cgit v1.1 From 0514679b15d12d9481a11637c9f0d43d90cfd94d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 2 Sep 2014 18:51:49 +0100 Subject: reduce MIN_CALLBACK_MS guard time. A value too high introduces a extra throttle and makes more packets to be sent in bursts and not in steady state flow. --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index 45013b3..33375ff 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs @@ -700,7 +700,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } - const int MIN_CALLBACK_MS = 30; + const int MIN_CALLBACK_MS = 10; /// /// Does an early check to see if this queue empty callback is already -- cgit v1.1 From 42b2248960b9b8e539f551093ed2241ce8d3b68d Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sat, 13 Sep 2014 00:49:32 +0200 Subject: If a client's SceneAgent is null, that client is not fully logged in or crashed while logging out. Don't reuse it, create a new one. --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 9b3802d..5ce82a5 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -2002,6 +2002,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP uint circuitCode, UUID agentID, UUID sessionID, IPEndPoint remoteEndPoint, AuthenticateResponse sessionInfo) { IClientAPI client = null; + bool createNew = false; // We currently synchronize this code across the whole scene to avoid issues such as // http://opensimulator.org/mantis/view.php?id=5365 However, once locking per agent circuit can be done @@ -2010,6 +2011,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP { if (!m_scene.TryGetClient(agentID, out client)) { + createNew = true; + } + else + { + if (client.SceneAgent == null) + { + m_scene.CloseAgent(agentID, true); + createNew = true; + } + } + + if (createNew) + { LLUDPClient udpClient = new LLUDPClient(this, ThrottleRates, m_throttle, circuitCode, agentID, remoteEndPoint, m_defaultRTO, m_maxRTO); client = new LLClientView(m_scene, this, udpClient, sessionInfo, agentID, sessionID, circuitCode); -- cgit v1.1 From 908e0e1cef792456fc1ba6394ff9119110870dc4 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 13 Sep 2014 20:37:20 +0100 Subject: do not use a blind expire of m_pendingCache. Entries must be valid while respective HandleUseCircuitCode, no matter how long it takes, so a viewer retry doesnt start a overlapping one. It HandleUseCircuitCode responsability to always remove entries, even on fails. Remove a client even if m_scene.CloseAgent fails. --- .../Region/ClientStack/Linden/UDP/LLUDPServer.cs | 38 +++++++++++++--------- 1 file changed, 23 insertions(+), 15 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 5ce82a5..18d5606 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -308,8 +308,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP - private ExpiringCache> m_pendingCache = new ExpiringCache>(); - +// private ExpiringCache> m_pendingCache = new ExpiringCache>(); + private Dictionary> m_pendingCache = new Dictionary>(); /// /// Event used to signal when queued packets are available for sending. /// @@ -1416,10 +1416,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP // And if there is a UseCircuitCode pending, also drop it lock (m_pendingCache) { - if (m_pendingCache.Contains(endPoint)) +// if (m_pendingCache.Contains(endPoint)) + if (m_pendingCache.ContainsKey(endPoint)) return; - m_pendingCache.AddOrUpdate(endPoint, new Queue(), 60); +// m_pendingCache.AddOrUpdate(endPoint, new Queue(), 60); + m_pendingCache.Add(endPoint, new Queue()); } // We need to copy the endpoint so that it doesn't get changed when another thread reuses the @@ -1765,10 +1767,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP uccp.CircuitCode.SessionID, endPoint, sessionInfo); - - // Now we know we can handle more data - Thread.Sleep(200); - + // Obtain the pending queue and remove it from the cache Queue queue = null; @@ -1786,13 +1785,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_log.DebugFormat("[LLUDPSERVER]: Client created, processing pending queue, {0} entries", queue.Count); // Reinject queued packets - while (queue.Count > 0) + if (queue != null) { - UDPPacketBuffer buf = queue.Dequeue(); - PacketReceived(buf); - } + while (queue.Count > 0) + { + UDPPacketBuffer buf = queue.Dequeue(); + PacketReceived(buf); + } - queue = null; + queue = null; + } // Send ack straight away to let the viewer know that the connection is active. // The client will be null if it already exists (e.g. if on a region crossing the client sends a use @@ -1815,6 +1817,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_log.WarnFormat( "[LLUDPSERVER]: Ignoring connection request for {0} to {1} with unknown circuit code {2} from IP {3}", uccp.CircuitCode.ID, m_scene.RegionInfo.RegionName, uccp.CircuitCode.Code, endPoint); + lock (m_pendingCache) m_pendingCache.Remove(endPoint); } @@ -1825,6 +1828,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP } catch (Exception e) { + // this may already be done.. or not.. + lock (m_pendingCache) + m_pendingCache.Remove(endPoint); + m_log.ErrorFormat( "[LLUDPSERVER]: UseCircuitCode handling from endpoint {0}, client {1} {2} failed. Exception {3}{4}", endPoint != null ? endPoint.ToString() : "n/a", @@ -2058,11 +2065,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP "[LLUDPSERVER]: No packets received from {0} agent of {1} for {2}ms in {3}. Disconnecting.", client.SceneAgent.IsChildAgent ? "child" : "root", client.Name, timeoutTicks, m_scene.Name); - if (!client.SceneAgent.IsChildAgent) + if (client.SceneAgent != null && !client.SceneAgent.IsChildAgent) client.Kick("Simulator logged you out due to connection timeout."); } - m_scene.CloseAgent(client.AgentId, true); + if (!m_scene.CloseAgent(client.AgentId, true)) + client.Close(true,true); } private void IncomingPacketHandler() -- cgit v1.1 From 3d9f25a19dda7c54ae50fd9b4da38247371018f3 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 14 Sep 2014 02:28:42 +0100 Subject: revert changes to m_pendingCache and remove client close if there is no SP, as requested --- .../Region/ClientStack/Linden/UDP/LLUDPServer.cs | 35 +++++++++------------- 1 file changed, 14 insertions(+), 21 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 18d5606..d811b64 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -308,8 +308,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP -// private ExpiringCache> m_pendingCache = new ExpiringCache>(); - private Dictionary> m_pendingCache = new Dictionary>(); + private ExpiringCache> m_pendingCache = new ExpiringCache>(); + /// /// Event used to signal when queued packets are available for sending. /// @@ -1416,12 +1416,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP // And if there is a UseCircuitCode pending, also drop it lock (m_pendingCache) { -// if (m_pendingCache.Contains(endPoint)) - if (m_pendingCache.ContainsKey(endPoint)) + if (m_pendingCache.Contains(endPoint)) return; -// m_pendingCache.AddOrUpdate(endPoint, new Queue(), 60); - m_pendingCache.Add(endPoint, new Queue()); + m_pendingCache.AddOrUpdate(endPoint, new Queue(), 60); } // We need to copy the endpoint so that it doesn't get changed when another thread reuses the @@ -1767,7 +1765,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP uccp.CircuitCode.SessionID, endPoint, sessionInfo); - + + // Now we know we can handle more data + Thread.Sleep(200); + // Obtain the pending queue and remove it from the cache Queue queue = null; @@ -1785,17 +1786,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_log.DebugFormat("[LLUDPSERVER]: Client created, processing pending queue, {0} entries", queue.Count); // Reinject queued packets - if (queue != null) + while (queue.Count > 0) { - while (queue.Count > 0) - { - UDPPacketBuffer buf = queue.Dequeue(); - PacketReceived(buf); - } - - queue = null; + UDPPacketBuffer buf = queue.Dequeue(); + PacketReceived(buf); } + queue = null; + // Send ack straight away to let the viewer know that the connection is active. // The client will be null if it already exists (e.g. if on a region crossing the client sends a use // circuit code to the existing child agent. This is not particularly obvious. @@ -1828,10 +1826,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP } catch (Exception e) { - // this may already be done.. or not.. - lock (m_pendingCache) - m_pendingCache.Remove(endPoint); - m_log.ErrorFormat( "[LLUDPSERVER]: UseCircuitCode handling from endpoint {0}, client {1} {2} failed. Exception {3}{4}", endPoint != null ? endPoint.ToString() : "n/a", @@ -2069,8 +2063,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP client.Kick("Simulator logged you out due to connection timeout."); } - if (!m_scene.CloseAgent(client.AgentId, true)) - client.Close(true,true); + m_scene.CloseAgent(client.AgentId, true); } private void IncomingPacketHandler() -- cgit v1.1 From d43d3df724b62d0bf2765f25794e83dacd6c60c1 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sun, 14 Sep 2014 20:46:22 +0200 Subject: Reinstate closing the client if CloseAgen returns false. This was part of the last Ubit patch. --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index d811b64..3539100 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -2063,7 +2063,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP client.Kick("Simulator logged you out due to connection timeout."); } - m_scene.CloseAgent(client.AgentId, true); + if (!m_scene.CloseAgent(client.AgentId, true)) + client.Close(true,true); } private void IncomingPacketHandler() -- cgit v1.1 From 8014ce7f1aaec0c418248e2e24a65c3cff0b3d27 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 15 Sep 2014 23:15:27 +0200 Subject: Fix a nullref in a debug message. If we have no SceneAgent, we can't output data from it. --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 3539100..99e7aba 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -2055,12 +2055,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP { ClientLogoutsDueToNoReceives++; - m_log.WarnFormat( - "[LLUDPSERVER]: No packets received from {0} agent of {1} for {2}ms in {3}. Disconnecting.", - client.SceneAgent.IsChildAgent ? "child" : "root", client.Name, timeoutTicks, m_scene.Name); + if (client.SceneAgent != null) + { + m_log.WarnFormat( + "[LLUDPSERVER]: No packets received from {0} agent of {1} for {2}ms in {3}. Disconnecting.", + client.SceneAgent.IsChildAgent ? "child" : "root", client.Name, timeoutTicks, m_scene.Name); - if (client.SceneAgent != null && !client.SceneAgent.IsChildAgent) - client.Kick("Simulator logged you out due to connection timeout."); + if (!client.SceneAgent.IsChildAgent) + client.Kick("Simulator logged you out due to connection timeout."); + } } if (!m_scene.CloseAgent(client.AgentId, true)) -- cgit v1.1 From 49bf83ecb834ee7fccbc705d319d036d9f153583 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 30 Sep 2014 23:31:55 +0100 Subject: do global position X and Y with double precision in autopilot, so corrected viewers do work --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 12ee3b2..6385aed 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -607,7 +607,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Disable UDP handling for this client m_udpClient.Shutdown(); - + //m_log.InfoFormat("[CLIENTVIEW] Memory pre GC {0}", System.GC.GetTotalMemory(false)); //GC.Collect(); @@ -4912,6 +4912,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP IEventQueue eq = Scene.RequestModuleInterface(); if (eq != null) { + OSD message_body = updateMessage.Serialize(); // Add new fields here until OMV has them OSDMap bodyMap = (OSDMap)message_body; @@ -4923,8 +4924,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP OSDMap message = new OSDMap(); message.Add("message", OSD.FromString("ParcelProperties")); message.Add("body", message_body); + eq.Enqueue (message, this.AgentId); - //eq.ParcelProperties(updateMessage, this.AgentId); + +// eq.ParcelProperties(updateMessage, this.AgentId); } else { @@ -12420,8 +12423,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP uint regionY = 0; Utils.LongToUInts(m_scene.RegionInfo.RegionHandle, out regionX, out regionY); - locx = Convert.ToSingle(args[0]) - (float)regionX; - locy = Convert.ToSingle(args[1]) - (float)regionY; + locx = (float)(Convert.ToDouble(args[0]) - (double)regionX); + locy = (float)(Convert.ToDouble(args[1]) - (double)regionY); locz = Convert.ToSingle(args[2]); Action handlerAutoPilotGo = OnAutoPilotGo; -- cgit v1.1 From 8c41271b3312f2a02608ffc41b220f7fb018d6ad Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 13 Oct 2014 13:17:48 +0100 Subject: *TEST* send udp sync. Stop uncontroled and hidden use of IO threads. Testing this may require several people. --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 3 ++- .../Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs | 18 +++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 99e7aba..ac4a877 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -1305,7 +1305,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP PacketsSentCount++; // Put the UDP payload on the wire - AsyncBeginSend(buffer); + //AsyncBeginSend(buffer); + SyncSend(buffer); // Keep track of when this packet was sent out (right now) outgoingPacket.TickCount = Environment.TickCount & Int32.MaxValue; diff --git a/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs index 881e768..1d76c14 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs @@ -375,12 +375,28 @@ namespace OpenMetaverse // Synchronous mode waits until the packet callback completes // before starting the receive to fetch another packet - if (!m_asyncPacketHandling) +// if (!m_asyncPacketHandling) AsyncBeginReceive(); } } } + public void SyncSend(UDPPacketBuffer buf) + { + try + { + m_udpSocket.SendTo( + buf.Data, + 0, + buf.DataLength, + SocketFlags.None, + buf.RemoteEndPoint + ); + } + catch (SocketException) { } + catch (ObjectDisposedException) { } + } + public void AsyncBeginSend(UDPPacketBuffer buf) { // if (IsRunningOutbound) -- cgit v1.1 From 33ec07332069de24b0442c7d1795580bd0669449 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 13 Oct 2014 22:46:58 +0100 Subject: revert to async send, since past experience showed sync didn't work when on mono --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index ac4a877..8cc009d 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -1305,8 +1305,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP PacketsSentCount++; // Put the UDP payload on the wire - //AsyncBeginSend(buffer); - SyncSend(buffer); + AsyncBeginSend(buffer); + //SyncSend(buffer); // Keep track of when this packet was sent out (right now) outgoingPacket.TickCount = Environment.TickCount & Int32.MaxValue; -- cgit v1.1 From 12ebc92e55efbe08616506d7f543c3c9ed88de43 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 13 Oct 2014 23:52:19 +0200 Subject: Revert "*TEST* send udp sync. Stop uncontroled and hidden use of IO threads." This reverts commit 8c41271b3312f2a02608ffc41b220f7fb018d6ad. Conflicts: OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 1 - .../Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs | 18 +----------------- 2 files changed, 1 insertion(+), 18 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 8cc009d..99e7aba 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -1306,7 +1306,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Put the UDP payload on the wire AsyncBeginSend(buffer); - //SyncSend(buffer); // Keep track of when this packet was sent out (right now) outgoingPacket.TickCount = Environment.TickCount & Int32.MaxValue; diff --git a/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs index 1d76c14..881e768 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs @@ -375,28 +375,12 @@ namespace OpenMetaverse // Synchronous mode waits until the packet callback completes // before starting the receive to fetch another packet -// if (!m_asyncPacketHandling) + if (!m_asyncPacketHandling) AsyncBeginReceive(); } } } - public void SyncSend(UDPPacketBuffer buf) - { - try - { - m_udpSocket.SendTo( - buf.Data, - 0, - buf.DataLength, - SocketFlags.None, - buf.RemoteEndPoint - ); - } - catch (SocketException) { } - catch (ObjectDisposedException) { } - } - public void AsyncBeginSend(UDPPacketBuffer buf) { // if (IsRunningOutbound) -- cgit v1.1 From 4571e5bc3e284c916d1ae4dd6429b80a8028b8e0 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 24 Oct 2014 18:10:28 +0100 Subject: try to make SOG crossings full async. Simplify some borders checking.... --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 6385aed..6f42990 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -3865,7 +3865,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { SceneObjectPart part = (SceneObjectPart)update.Entity; - if (part.ParentGroup.IsDeleted) + if (part.ParentGroup.IsDeleted || part.ParentGroup.inTransit) continue; if (part.ParentGroup.IsAttachment) -- cgit v1.1 From 54ab9e7d4dd04042cb36b292c3896d20f3df8060 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 30 Oct 2014 21:57:20 +0000 Subject: set udp SocketOptionName.ReuseAddress to false, to not allow two regions to bind to same port, as seems to be possible at least with mono 3.2.8, same as patch just pushed to core by justin. This is not necessary on windows, possible a bug on some mono versions. --- OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs index 881e768..a09195c 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs @@ -152,6 +152,8 @@ namespace OpenMetaverse SocketType.Dgram, ProtocolType.Udp); + m_udpSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, false); + try { // This udp socket flag is not supported under mono, -- cgit v1.1 From ba8e1efb434e9584972c56b9706752bb82a80057 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 31 Oct 2014 23:34:43 +0000 Subject: sadly revert to resend terseUpdates enqueuing them back into entityupdates queue. Viewers fail to handle correctly out of order updates with ugly visible effects. Make sure these packets don't include acks so they aren't lost. --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 49 ++++++++++++++++++++-- .../Region/ClientStack/Linden/UDP/LLUDPServer.cs | 2 +- 2 files changed, 47 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 6f42990..da30a04 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -3824,6 +3824,49 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_entityUpdates.Enqueue(priority, new EntityUpdate(entity, updateFlags, m_scene.TimeDilation)); } + + /// + /// Requeue an EntityUpdate when it was not acknowledged by the client. + /// We will update the priority and put it in the correct queue, merging update flags + /// with any other updates that may be queued for the same entity. + /// The original update time is used for the merged update. + /// + private void ResendPrimUpdate(EntityUpdate update) + { + // If the update exists in priority queue, it will be updated. + // If it does not exist then it will be added with the current (rather than its original) priority + uint priority = m_prioritizer.GetUpdatePriority(this, update.Entity); + + lock (m_entityUpdates.SyncRoot) + m_entityUpdates.Enqueue(priority, update); + } + + /// + /// Requeue a list of EntityUpdates when they were not acknowledged by the client. + /// We will update the priority and put it in the correct queue, merging update flags + /// with any other updates that may be queued for the same entity. + /// The original update time is used for the merged update. + /// + private void ResendPrimUpdates(List updates, OutgoingPacket oPacket) + { + // m_log.WarnFormat("[CLIENT] resending prim updates {0}, packet sequence number {1}", updates[0].UpdateTime, oPacket.SequenceNumber); + + // Remove the update packet from the list of packets waiting for acknowledgement + // because we are requeuing the list of updates. They will be resent in new packets + // with the most recent state and priority. + m_udpClient.NeedAcks.Remove(oPacket.SequenceNumber); + + // Count this as a resent packet since we are going to requeue all of the updates contained in it + Interlocked.Increment(ref m_udpClient.PacketsResent); + + // We're not going to worry about interlock yet since its not currently critical that this total count + // is 100% correct + m_udpServer.PacketsResentCount++; + + foreach (EntityUpdate update in updates) + ResendPrimUpdate(update); + } + private void ProcessEntityUpdates(int maxUpdates) { OpenSim.Framework.Lazy> objectUpdateBlocks = new OpenSim.Framework.Lazy>(); @@ -4044,7 +4087,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP for (int i = 0; i < blocks.Count; i++) packet.ObjectData[i] = blocks[i]; - OutPacket(packet, ThrottleOutPacketType.Unknown, true); + OutPacket(packet, ThrottleOutPacketType.Unknown, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseUpdates.Value, oPacket); }); } if (objectUpdateBlocks.IsValueCreated) @@ -4090,8 +4133,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP for (int i = 0; i < blocks.Count; i++) packet.ObjectData[i] = blocks[i]; - - OutPacket(packet, ThrottleOutPacketType.Task, true); + + OutPacket(packet, ThrottleOutPacketType.Task, true, delegate(OutgoingPacket oPacket) { ResendPrimUpdates(terseUpdates.Value, oPacket); }); } #endregion Packet Sending diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 99e7aba..f66534d 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 && !isResend) + if (!isZerocoded && !isResend && outgoingPacket.UnackedMethod == null) { // Keep appending ACKs until there is no room left in the buffer or there are // no more ACKs to append -- cgit v1.1 From 5cca6e7d16ee4dbfd23a0adcb50221e3e3051259 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 1 Nov 2014 00:01:11 +0000 Subject: don't send updates for deleted agents --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index da30a04..4b15e9f 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -3832,8 +3832,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// The original update time is used for the merged update. /// private void ResendPrimUpdate(EntityUpdate update) - { - // If the update exists in priority queue, it will be updated. + { + // If the update exists in priority queue, it will be updated. // If it does not exist then it will be added with the current (rather than its original) priority uint priority = m_prioritizer.GetUpdatePriority(this, update.Entity); @@ -3975,7 +3975,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP else if (update.Entity is ScenePresence) { ScenePresence presence = (ScenePresence)update.Entity; - + if (presence.IsDeleted) + continue; // If ParentUUID is not UUID.Zero and ParentID is 0, this // avatar is in the process of crossing regions while // sat on an object. In this state, we don't want any -- cgit v1.1 From ead78764abfe3d91f79b55ec200bd0d5e8ca2151 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 6 Nov 2014 19:03:25 +0000 Subject: allow drawdistance to change between 32 and MaxDrawDistance, configurable value default to 256, so should have no effect. Next steps needed: reduce client udp Throttles with distance, update childreen connections with significat movement and view range changes, Make disconnect be delayed in time, make disconnects be receiving region action not sender on region changes. Allow distance less than 256 to only connect to visible regions, even none. Make this be relative to camera and not agent position or region centers as it is now. --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 4b15e9f..b9646c7 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -5765,8 +5765,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP || (x.State != m_thisAgentUpdateArgs.State) // significant if Stats changed || (qdelta1 < QDELTABody) // significant if body rotation above(below cos) threshold // Ignoring head rotation altogether, because it's not being used for anything interesting up the stack - // || (qdelta2 < QDELTAHead) // significant if head rotation above(below cos) threshold - || (x.Far != m_thisAgentUpdateArgs.Far) // significant if far distance changed + // || (qdelta2 < QDELTAHead) // significant if head rotation above(below cos) threshold + || (Math.Abs(x.Far - m_thisAgentUpdateArgs.Far) >= 32) // significant if far distance changed ; //if (movementSignificant) //{ -- cgit v1.1 From caddabb5c4f62767305a589e9d818ae3457a8030 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 6 Nov 2014 22:25:16 +0000 Subject: scale ChildAgentThrottles with distance (internal to child server and not root as was done before ) --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 7 ++++++- OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs | 20 +++++++++++++------- 2 files changed, 19 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index b9646c7..f2f7cf9 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -12344,7 +12344,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// public void SetChildAgentThrottle(byte[] throttles) { - m_udpClient.SetThrottles(throttles); + SetChildAgentThrottle(throttles, 1.0f); + } + + public void SetChildAgentThrottle(byte[] throttles,float factor) + { + m_udpClient.SetThrottles(throttles, factor); GenericCall2 handler = OnUpdateThrottles; if (handler != null) { diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index 33375ff..0ae7617 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs @@ -340,6 +340,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP public void SetThrottles(byte[] throttleData) { + SetThrottles(throttleData, 1.0f); + } + + public void SetThrottles(byte[] throttleData, float factor) + { byte[] adjData; int pos = 0; @@ -359,13 +364,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP } // 0.125f converts from bits to bytes - int resend = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; - int land = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; - int wind = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; - int cloud = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; - int task = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; - int texture = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; - int asset = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); + float scale = 0.125f * factor; + int resend = (int)(BitConverter.ToSingle(adjData, pos) * scale); pos += 4; + int land = (int)(BitConverter.ToSingle(adjData, pos) * scale); pos += 4; + int wind = (int)(BitConverter.ToSingle(adjData, pos) * scale); pos += 4; + int cloud = (int)(BitConverter.ToSingle(adjData, pos) * scale); pos += 4; + int task = (int)(BitConverter.ToSingle(adjData, pos) * scale); pos += 4; + int texture = (int)(BitConverter.ToSingle(adjData, pos) * scale); pos += 4; + int asset = (int)(BitConverter.ToSingle(adjData, pos) * scale); // Make sure none of the throttles are set below our packet MTU, // otherwise a throttle could become permanently clogged -- cgit v1.1 From 785a2cc729a9935a6a68a33ce2b7df107f40e918 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 10 Nov 2014 04:48:36 +0100 Subject: Remove JustinCCs UDP patch - it is harmful to Avination's grid management --- OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs index a09195c..0030dee 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs @@ -152,7 +152,9 @@ namespace OpenMetaverse SocketType.Dgram, ProtocolType.Udp); - m_udpSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, false); + // OpenSim may need this but in AVN, this messes up automated + // sim restarts badly + //m_udpSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, false); try { @@ -416,4 +418,4 @@ namespace OpenMetaverse catch (ObjectDisposedException) { } } } -} \ No newline at end of file +} -- cgit v1.1 From 64deb6ae6fdf586bcd2e940d3cbf3ee54367dc83 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 10 Nov 2014 19:49:58 +0100 Subject: Second part of invisible base avatar option --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index f2f7cf9..b7a4b93 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -5142,7 +5142,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP acceleration = Vector3.Zero; if (sendTexture) - textureEntry = presence.Appearance.Texture.GetBytes(); + { + if (presence.Invisible) + textureEntry = AvatarAppearance.Invisible.GetBytes(); + else + textureEntry = presence.Appearance.Texture.GetBytes(); + } else textureEntry = null; } -- cgit v1.1 From bec456c2a529ca0b9ca7fd59e8110e5d5b27c126 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Tue, 11 Nov 2014 07:09:30 +0100 Subject: Remove the Invisible stuff and add more baked caching. Refactor selection of textures to save to Bakes module. --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index b7a4b93..849fec3 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -5143,10 +5143,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (sendTexture) { - if (presence.Invisible) - textureEntry = AvatarAppearance.Invisible.GetBytes(); - else - textureEntry = presence.Appearance.Texture.GetBytes(); + textureEntry = presence.Appearance.Texture.GetBytes(); } else textureEntry = null; -- cgit v1.1 From c5a7bf6601dfde518a008d45b4e4a8dc8de698bf Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sat, 28 Mar 2015 08:30:52 -0700 Subject: varregion: add varregion and TerrainData use in LLClientView. Add sending multiple parcel patches and sending patches by avatar view distance. --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 273 +++++++++++++-------- 1 file changed, 164 insertions(+), 109 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 849fec3..4c0fba5 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -312,6 +312,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP private const float m_sunPainDaHalfOrbitalCutoff = 4.712388980384689858f; private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private static string LogHeader = "[LLCLIENTVIEW]"; protected static Dictionary PacketHandlers = new Dictionary(); //Global/static handlers for all clients /// @@ -690,12 +691,36 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// true if the handler was added. This is currently always the case. public bool AddLocalPacketHandler(PacketType packetType, PacketMethod handler, bool doAsync) { + return AddLocalPacketHandler(packetType, handler, doAsync, false); + } + + /// + /// Add a handler for the given packet type. + /// + /// + /// + /// + /// If true, when the packet is received handle it on a different thread. Whether this is given direct to + /// a threadpool thread or placed in a queue depends on the inEngine parameter. + /// + /// + /// If async is false then this parameter is ignored. + /// If async is true and inEngine is false, then the packet is sent directly to a + /// threadpool thread. + /// If async is true and inEngine is true, then the packet is sent to the IncomingPacketAsyncHandlingEngine. + /// This may result in slower handling but reduces the risk of overloading the simulator when there are many + /// simultaneous async requests. + /// + /// true if the handler was added. This is currently always the case. + public bool AddLocalPacketHandler(PacketType packetType, PacketMethod handler, bool doAsync, bool inEngine) + { bool result = false; lock (m_packetHandlers) { if (!m_packetHandlers.ContainsKey(packetType)) { - m_packetHandlers.Add(packetType, new PacketProcessor() { method = handler, Async = doAsync }); + m_packetHandlers.Add( + packetType, new PacketProcessor() { method = handler, Async = doAsync }); result = true; } } @@ -1174,11 +1199,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// /// Send the region heightmap to the client + /// This method is only called when not doing intellegent terrain patch sending and + /// is only called when the scene presence is initially created and sends all of the + /// region's patches to the client. /// /// heightmap public virtual void SendLayerData(float[] map) { - Util.FireAndForget(DoSendLayerData, map); + Util.FireAndForget(DoSendLayerData, m_scene.Heightmap.GetTerrainData()); // Send it sync, and async. It's not that much data // and it improves user experience just so much! @@ -1191,15 +1219,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// private void DoSendLayerData(object o) { - float[] map = LLHeightFieldMoronize((float[])o); + TerrainData map = (TerrainData)o; try { + // Send LayerData in typerwriter pattern for (int y = 0; y < 16; y++) { - for (int x = 0; x < 16; x+=4) + for (int x = 0; x < 16; x++) { - SendLayerPacket(x, y, map); + SendLayerData(x, y, map); } } } @@ -1209,77 +1238,95 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } - /// - /// Sends a set of four patches (x, x+1, ..., x+3) to the client - /// - /// heightmap - /// X coordinate for patches 0..12 - /// Y coordinate for patches 0..15 - private void SendLayerPacket(int x, int y, float[] map) + // Legacy form of invocation that passes around a bare data array. + // Just ignore what was passed and use the real terrain info that is part of the scene. + // As a HORRIBLE kludge in an attempt to not change the definition of IClientAPI, + // there is a special form for specifying multiple terrain patches to send. + // The form is to pass 'px' as negative the number of patches to send and to + // pass the float array as pairs of patch X and Y coordinates. So, passing 'px' + // as -2 and map= [3, 5, 8, 4] would mean to send two terrain heightmap patches + // and the patches to send are <3,5> and <8,4>. + public void SendLayerData(int px, int py, float[] map) { - int[] patches = new int[4]; - patches[0] = x + 0 + y * 16; - patches[1] = x + 1 + y * 16; - patches[2] = x + 2 + y * 16; - patches[3] = x + 3 + y * 16; + if (px >= 0) + { + SendLayerData(px, py, m_scene.Heightmap.GetTerrainData()); + } + else + { + int numPatches = -px; + int[] xPatches = new int[numPatches]; + int[] yPatches = new int[numPatches]; + for (int pp = 0; pp < numPatches; pp++) + { + xPatches[pp] = (int)map[pp * 2]; + yPatches[pp] = (int)map[pp * 2 + 1]; + } - float[] heightmap = (map.Length == 65536) ? - map : - LLHeightFieldMoronize(map); + // DebugSendingPatches("SendLayerData", xPatches, yPatches); - try - { - Packet layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches); - OutPacket(layerpack, ThrottleOutPacketType.Land); + SendLayerData(xPatches, yPatches, m_scene.Heightmap.GetTerrainData()); } - catch + } + + private void DebugSendingPatches(string pWho, int[] pX, int[] pY) + { + if (m_log.IsDebugEnabled) { - for (int px = x ; px < x + 4 ; px++) - SendLayerData(px, y, map); + int numPatches = pX.Length; + string Xs = ""; + string Ys = ""; + for (int pp = 0; pp < numPatches; pp++) + { + Xs += String.Format("{0}", (int)pX[pp]) + ","; + Ys += String.Format("{0}", (int)pY[pp]) + ","; + } + m_log.DebugFormat("{0} {1}: numPatches={2}, X={3}, Y={4}", LogHeader, pWho, numPatches, Xs, Ys); } } /// - /// Sends a specified patch to a client + /// Sends a terrain packet for the point specified. + /// This is a legacy call that has refarbed the terrain into a flat map of floats. + /// We just use the terrain from the region we know about. /// /// Patch coordinate (x) 0..15 /// Patch coordinate (y) 0..15 /// heightmap - public void SendLayerData(int px, int py, float[] map) + public void SendLayerData(int px, int py, TerrainData terrData) + { + int[] xPatches = new[] { px }; + int[] yPatches = new[] { py }; + SendLayerData(xPatches, yPatches, terrData); + } + + private void SendLayerData(int[] px, int[] py, TerrainData terrData) { try { - int[] patches = new int[] { py * 16 + px }; - float[] heightmap = (map.Length == 65536) ? - map : - LLHeightFieldMoronize(map); - - LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches); - - // When a user edits the terrain, so much data is sent, the data queues up fast and presents a sub optimal editing experience. - // To alleviate this issue, when the user edits the terrain, we start skipping the queues until they're done editing the terrain. - // We also make them unreliable because it's extremely likely that multiple packets will be sent for a terrain patch area - // invalidating previous packets for that area. - - // It's possible for an editing user to flood themselves with edited packets but the majority of use cases are such that only a - // tiny percentage of users will be editing the terrain. Other, non-editing users will see the edits much slower. - - // One last note on this topic, by the time users are going to be editing the terrain, it's extremely likely that the sim will - // have rezzed already and therefore this is not likely going to cause any additional issues with lost packets, objects or terrain - // patches. + /* test code using the terrain compressor in libOpenMetaverse + int[] patchInd = new int[1]; + patchInd[0] = px + (py * Constants.TerrainPatchSize); + LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(terrData.GetFloatsSerialized(), patchInd); + */ + // Many, many patches could have been passed to us. Since the patches will be compressed + // into variable sized blocks, we cannot pre-compute how many will fit into one + // packet. While some fancy packing algorithm is possible, 4 seems to always fit. + int PatchesAssumedToFit = 4; + for (int pcnt = 0; pcnt < px.Length; pcnt += PatchesAssumedToFit) + { + int remaining = Math.Min(px.Length - pcnt, PatchesAssumedToFit); + int[] xPatches = new int[remaining]; + int[] yPatches = new int[remaining]; + for (int ii = 0; ii < remaining; ii++) + { + xPatches[ii] = px[pcnt + ii]; + yPatches[ii] = py[pcnt + ii]; + } + LayerDataPacket layerpack = OpenSimTerrainCompressor.CreateLandPacket(terrData, xPatches, yPatches); + // DebugSendingPatches("SendLayerDataInternal", xPatches, yPatches); - // m_justEditedTerrain is volatile, so test once and duplicate two affected statements so we only have one cache miss. - if (m_justEditedTerrain) - { - layerpack.Header.Reliable = false; - OutPacket(layerpack, - ThrottleOutPacketType.Unknown ); - } - else - { - layerpack.Header.Reliable = true; - OutPacket(layerpack, - ThrottleOutPacketType.Task); + SendTheLayerPacket(layerpack); } } catch (Exception e) @@ -1288,36 +1335,34 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } - /// - /// Munges heightfield into the LLUDP backed in restricted heightfield. - /// - /// float array in the base; Constants.RegionSize - /// float array in the base 256 - internal float[] LLHeightFieldMoronize(float[] map) + // When a user edits the terrain, so much data is sent, the data queues up fast and presents a + // sub optimal editing experience. To alleviate this issue, when the user edits the terrain, we + // start skipping the queues until they're done editing the terrain. We also make them + // unreliable because it's extremely likely that multiple packets will be sent for a terrain patch + // area invalidating previous packets for that area. + + // It's possible for an editing user to flood themselves with edited packets but the majority + // of use cases are such that only a tiny percentage of users will be editing the terrain. + // Other, non-editing users will see the edits much slower. + + // One last note on this topic, by the time users are going to be editing the terrain, it's + // extremely likely that the sim will have rezzed already and therefore this is not likely going + // to cause any additional issues with lost packets, objects or terrain patches. + + // m_justEditedTerrain is volatile, so test once and duplicate two affected statements so we + // only have one cache miss. + private void SendTheLayerPacket(LayerDataPacket layerpack) { - if (map.Length == 65536) - return map; + if (m_justEditedTerrain) + { + layerpack.Header.Reliable = false; + OutPacket(layerpack, ThrottleOutPacketType.Unknown ); + } else { - float[] returnmap = new float[65536]; - - if (map.Length < 65535) - { - // rebase the vector stride to 256 - for (int i = 0; i < Constants.RegionSize; i++) - Array.Copy(map, i * (int)Constants.RegionSize, returnmap, i * 256, (int)Constants.RegionSize); - } - else - { - for (int i = 0; i < 256; i++) - Array.Copy(map, i * (int)Constants.RegionSize, returnmap, i * 256, 256); - } - - //Array.Copy(map,0,returnmap,0,(map.Length < 65536)? map.Length : 65536); - - return returnmap; + layerpack.Header.Reliable = true; + OutPacket(layerpack, ThrottleOutPacketType.Land); } - } /// @@ -1346,21 +1391,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP { Vector2[] windSpeeds = (Vector2[])o; TerrainPatch[] patches = new TerrainPatch[2]; - patches[0] = new TerrainPatch(); - patches[0].Data = new float[16 * 16]; - patches[1] = new TerrainPatch(); - patches[1].Data = new float[16 * 16]; + patches[0] = new TerrainPatch { Data = new float[16 * 16] }; + patches[1] = new TerrainPatch { Data = new float[16 * 16] }; - for (int y = 0; y < 16; y++) + for (int x = 0; x < 16 * 16; x++) { - for (int x = 0; x < 16; x++) - { - patches[0].Data[y * 16 + x] = windSpeeds[y * 16 + x].X; - patches[1].Data[y * 16 + x] = windSpeeds[y * 16 + x].Y; - } + patches[0].Data[x] = windSpeeds[x].X; + patches[1].Data[x] = windSpeeds[x].Y; } - LayerDataPacket layerpack = TerrainCompressor.CreateLayerDataPacket(patches, TerrainPatch.LayerType.Wind); + byte layerType = (byte)TerrainPatch.LayerType.Wind; + if (m_scene.RegionInfo.RegionSizeX > Constants.RegionSize || m_scene.RegionInfo.RegionSizeY > Constants.RegionSize) + layerType = (byte)TerrainPatch.LayerType.WindExtended; + + // LayerDataPacket layerpack = TerrainCompressor.CreateLayerDataPacket(patches, (TerrainPatch.LayerType)layerType); + LayerDataPacket layerpack = OpenSimTerrainCompressor.CreateLayerDataPacket(patches, layerType, + (int)m_scene.RegionInfo.RegionSizeX, (int)m_scene.RegionInfo.RegionSizeY); layerpack.Header.Zerocoded = true; OutPacket(layerpack, ThrottleOutPacketType.Wind); } @@ -1384,7 +1430,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } - LayerDataPacket layerpack = TerrainCompressor.CreateLayerDataPacket(patches, TerrainPatch.LayerType.Cloud); + byte layerType = (byte)TerrainPatch.LayerType.Cloud; + if (m_scene.RegionInfo.RegionSizeX > Constants.RegionSize || m_scene.RegionInfo.RegionSizeY > Constants.RegionSize) + layerType = (byte)TerrainPatch.LayerType.CloudExtended; + + // LayerDataPacket layerpack = TerrainCompressor.CreateLayerDataPacket(patches, (TerrainPatch.LayerType)layerType); + LayerDataPacket layerpack = OpenSimTerrainCompressor.CreateLayerDataPacket(patches, layerType, + (int)m_scene.RegionInfo.RegionSizeX, (int)m_scene.RegionInfo.RegionSizeY); layerpack.Header.Zerocoded = true; OutPacket(layerpack, ThrottleOutPacketType.Cloud); } @@ -1489,10 +1541,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP mapReply.Data[i].Access = mapBlocks2[i].Access; mapReply.Data[i].Agents = mapBlocks2[i].Agents; - // TODO: hookup varregion sim size here mapReply.Size[i] = new MapBlockReplyPacket.SizeBlock(); - mapReply.Size[i].SizeX = 256; - mapReply.Size[i].SizeY = 256; + mapReply.Size[i].SizeX = mapBlocks2[i].SizeX; + mapReply.Size[i].SizeY = mapBlocks2[i].SizeY; } OutPacket(mapReply, ThrottleOutPacketType.Land); } @@ -1657,15 +1708,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP public void SendKillObject(List localIDs) { -// foreach (uint id in localIDs) -// m_log.DebugFormat("[CLIENT]: Sending KillObjectPacket to {0} for {1} in {2}", Name, id, regionHandle); - - // remove pending entities - lock (m_entityProps.SyncRoot) - m_entityProps.Remove(localIDs); - lock (m_entityUpdates.SyncRoot) - m_entityUpdates.Remove(localIDs); - KillObjectPacket kill = (KillObjectPacket)PacketPool.Instance.GetPacket(PacketType.KillObject); // TODO: don't create new blocks if recycling an old packet kill.ObjectData = new KillObjectPacket.ObjectDataBlock[localIDs.Count]; @@ -9087,6 +9129,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP TeleportLocationRequest handlerTeleportLocationRequest = OnTeleportLocationRequest; if (handlerTeleportLocationRequest != null) { + // Adjust teleport location to base of a larger region if requested to teleport to a sub-region + uint locX, locY; + Util.RegionHandleToWorldLoc(tpLocReq.Info.RegionHandle, out locX, out locY); + if ((locX >= m_scene.RegionInfo.WorldLocX) + && (locX < (m_scene.RegionInfo.WorldLocX + m_scene.RegionInfo.RegionSizeX)) + && (locY >= m_scene.RegionInfo.WorldLocY) + && (locY < (m_scene.RegionInfo.WorldLocY + m_scene.RegionInfo.RegionSizeY)) ) + { + tpLocReq.Info.RegionHandle = m_scene.RegionInfo.RegionHandle; + tpLocReq.Info.Position.X += locX - m_scene.RegionInfo.WorldLocX; + tpLocReq.Info.Position.Y += locY - m_scene.RegionInfo.WorldLocY; + } + handlerTeleportLocationRequest(this, tpLocReq.Info.RegionHandle, tpLocReq.Info.Position, tpLocReq.Info.LookAt, 16); } -- cgit v1.1 From 7aa171e49f991718ffac9a4749982f130ff7c285 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Fri, 12 Jun 2015 03:16:09 +0200 Subject: Maybe reduce incidence of ghost avatars --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index f66534d..b5f9da8 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -1757,6 +1757,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP AuthenticateResponse sessionInfo; if (IsClientAuthorized(uccp, out sessionInfo)) { + AgentCircuitData aCircuit = m_scene.AuthenticateHandler.GetAgentCircuitData(uccp.CircuitCode.Code); + // Begin the process of adding the client to the simulator client = AddClient( @@ -1766,6 +1768,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP endPoint, sessionInfo); + // This will be true if the client is new, e.g. not + // an existing child agent, and there is no circuit data + if (client != null && aCircuit == null) + { + m_scene.CloseAgent(client.AgentId, true); + return; + } + // Now we know we can handle more data Thread.Sleep(200); @@ -1802,7 +1812,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP // We only want to send initial data to new clients, not ones which are being converted from child to root. if (client != null) { - AgentCircuitData aCircuit = m_scene.AuthenticateHandler.GetAgentCircuitData(uccp.CircuitCode.Code); bool tp = (aCircuit.teleportFlags > 0); // Let's delay this for TP agents, otherwise the viewer doesn't know where to get resources from if (!tp) -- cgit v1.1 From 1fb2f0296fdaff56745daa1c1e8096cd8e25462b Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sat, 15 Aug 2015 02:46:41 +0200 Subject: Track selected objects per client --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 849fec3..7b6889a 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -474,6 +474,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP set { m_disableFacelights = value; } } + public List SelectedObjects {get; private set;} public bool SendLogoutPacketWhenClosing { set { m_SendLogoutPacketWhenClosing = value; } } @@ -494,6 +495,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // DebugPacketLevel = 1; CloseSyncLock = new Object(); + SelectedObjects = new List(); RegisterInterface(this); RegisterInterface(this); @@ -7347,6 +7349,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP for (int i = 0; i < incomingselect.ObjectData.Length; i++) { + if (!SelectedObjects.Contains(incomingselect.ObjectData[i].ObjectLocalID)) + SelectedObjects.Add(incomingselect.ObjectData[i].ObjectLocalID); handlerObjectSelect = OnObjectSelect; if (handlerObjectSelect != null) { @@ -7373,6 +7377,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP for (int i = 0; i < incomingdeselect.ObjectData.Length; i++) { + if (!SelectedObjects.Contains(incomingdeselect.ObjectData[i].ObjectLocalID)) + SelectedObjects.Add(incomingdeselect.ObjectData[i].ObjectLocalID); handlerObjectDeselect = OnObjectDeselect; if (handlerObjectDeselect != null) { -- cgit v1.1 From 9a0040d67c5af84defc6f40733bd0dd6a09450d6 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 19 Aug 2015 20:38:49 +0100 Subject: put back entities remove from updates on SendKillObject. --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 226f2a1..36c3780 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -1212,7 +1212,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Send it sync, and async. It's not that much data // and it improves user experience just so much! - DoSendLayerData(map); +// DoSendLayerData(map); } /// @@ -1710,6 +1710,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP public void SendKillObject(List localIDs) { + // think we do need this + // foreach (uint id in localIDs) + // m_log.DebugFormat("[CLIENT]: Sending KillObjectPacket to {0} for {1} in {2}", Name, id, regionHandle); + + // remove pending entities + lock (m_entityProps.SyncRoot) + m_entityProps.Remove(localIDs); + lock (m_entityUpdates.SyncRoot) + m_entityUpdates.Remove(localIDs); + KillObjectPacket kill = (KillObjectPacket)PacketPool.Instance.GetPacket(PacketType.KillObject); // TODO: don't create new blocks if recycling an old packet kill.ObjectData = new KillObjectPacket.ObjectDataBlock[localIDs.Count]; -- cgit v1.1 From e3d82ad706db04d295a549543380b71b00848f7f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 22 Aug 2015 04:08:30 +0100 Subject: delay terrain sending if land queue is 2 busy --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 11 ++++++++++- OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs | 14 ++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 36c3780..46836b1 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -1199,6 +1199,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP OutPacket(GATRP, ThrottleOutPacketType.Task); } + + public virtual bool CanSendLayerData() + { + int n = m_udpClient.GetCatBytesInSendQueue(ThrottleOutPacketType.Land); + if ( n > 100000) + return false; + return true; + } + /// /// Send the region heightmap to the client /// This method is only called when not doing intellegent terrain patch sending and @@ -9151,7 +9160,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if ((locX >= m_scene.RegionInfo.WorldLocX) && (locX < (m_scene.RegionInfo.WorldLocX + m_scene.RegionInfo.RegionSizeX)) && (locY >= m_scene.RegionInfo.WorldLocY) - && (locY < (m_scene.RegionInfo.WorldLocY + m_scene.RegionInfo.RegionSizeY)) ) + && (locY < (m_scene.RegionInfo.WorldLocY + m_scene.RegionInfo.RegionSizeY))) { tpLocReq.Info.RegionHandle = m_scene.RegionInfo.RegionHandle; tpLocReq.Info.Position.X += locX - m_scene.RegionInfo.WorldLocX; diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index 0ae7617..4b541e6 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs @@ -474,6 +474,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP return data; } + + public int GetCatBytesInSendQueue(ThrottleOutPacketType cat) + { + ; + int icat = (int)cat; + if (icat > 0 && icat < THROTTLE_CATEGORY_COUNT) + { + TokenBucket bucket = m_throttleCategories[icat]; + return m_packetOutboxes[icat].Count; + } + else + return 0; + } + public int GetCatBytesCanSend(ThrottleOutPacketType cat, int timeMS) { -- cgit v1.1 From e2cfc732939a1ccd686a310ef49995c24afe9e3c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 26 Aug 2015 15:20:18 +0100 Subject: NEVER EVER SEND TERRAIN PATCHS AS UNRELIABLE!!!!!!!!!!!!!!!!!!!!!!!!!! this costed me hours :P --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 39 ++++++++-------------- 1 file changed, 13 insertions(+), 26 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 46836b1..6c81035 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -1315,6 +1315,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP { try { + if (px.Length != py.Length || + terrData.SizeX != (int)Scene.RegionInfo.RegionSizeX || + terrData.SizeY != (int)Scene.RegionInfo.RegionSizeY) + { + if (px.Length != py.Length) + m_log.Debug("px py"); + if (terrData.SizeX != Scene.RegionInfo.RegionSizeX) + m_log.Debug("sx"); + if (terrData.SizeY != Scene.RegionInfo.RegionSizeY) + m_log.Debug("sx"); + } + /* test code using the terrain compressor in libOpenMetaverse int[] patchInd = new int[1]; patchInd[0] = px + (py * Constants.TerrainPatchSize); @@ -1346,34 +1358,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } - // When a user edits the terrain, so much data is sent, the data queues up fast and presents a - // sub optimal editing experience. To alleviate this issue, when the user edits the terrain, we - // start skipping the queues until they're done editing the terrain. We also make them - // unreliable because it's extremely likely that multiple packets will be sent for a terrain patch - // area invalidating previous packets for that area. - - // It's possible for an editing user to flood themselves with edited packets but the majority - // of use cases are such that only a tiny percentage of users will be editing the terrain. - // Other, non-editing users will see the edits much slower. - - // One last note on this topic, by the time users are going to be editing the terrain, it's - // extremely likely that the sim will have rezzed already and therefore this is not likely going - // to cause any additional issues with lost packets, objects or terrain patches. - - // m_justEditedTerrain is volatile, so test once and duplicate two affected statements so we - // only have one cache miss. - private void SendTheLayerPacket(LayerDataPacket layerpack) + private void SendTheLayerPacket(LayerDataPacket layerpack) { - if (m_justEditedTerrain) - { - layerpack.Header.Reliable = false; - OutPacket(layerpack, ThrottleOutPacketType.Unknown ); - } - else - { - layerpack.Header.Reliable = true; OutPacket(layerpack, ThrottleOutPacketType.Land); - } } /// -- cgit v1.1 From f9efa23d5e0534068dbfb4058cc318588dfbb1e6 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 27 Aug 2015 21:30:51 +0100 Subject: remove the rest of #justEditedTerrain, it was sending patchs non conforming to protocol, and no longer in agreement with how patchs are schedule to send --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 16 ---------------- 1 file changed, 16 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 6c81035..69f001a 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -338,8 +338,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP private bool m_VelocityInterpolate = false; private const uint MaxTransferBytesPerPacket = 600; - private volatile bool m_justEditedTerrain = false; - /// /// List used in construction of data blocks for an object update packet. This is to stop us having to /// continually recreate it. @@ -1315,18 +1313,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP { try { - if (px.Length != py.Length || - terrData.SizeX != (int)Scene.RegionInfo.RegionSizeX || - terrData.SizeY != (int)Scene.RegionInfo.RegionSizeY) - { - if (px.Length != py.Length) - m_log.Debug("px py"); - if (terrData.SizeX != Scene.RegionInfo.RegionSizeX) - m_log.Debug("sx"); - if (terrData.SizeY != Scene.RegionInfo.RegionSizeY) - m_log.Debug("sx"); - } - /* test code using the terrain compressor in libOpenMetaverse int[] patchInd = new int[1]; patchInd[0] = px + (py * Constants.TerrainPatchSize); @@ -6509,7 +6495,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP { // Note: the ModifyTerrain event handler sends out updated packets before the end of this event. Therefore, // a simple boolean value should work and perhaps queue up just a few terrain patch packets at the end of the edit. - m_justEditedTerrain = true; // Prevent terrain packet (Land layer) from being queued, make it unreliable if (OnModifyTerrain != null) { for (int i = 0; i < modify.ParcelData.Length; i++) @@ -6525,7 +6510,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } } - m_justEditedTerrain = false; // Queue terrain packet (Land layer) if necessary, make it reliable again } return true; -- cgit v1.1 From efc062b0ccfc0c1bbe305d7ce26b0521b53f1d74 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 28 Aug 2015 03:34:28 +0100 Subject: send land parcels overlay in cat Land not Task, or avatar freezes --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 69f001a..56069a3 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -4889,7 +4889,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP packet.ParcelData.Data = data; packet.ParcelData.SequenceID = sequence_id; packet.Header.Zerocoded = true; - OutPacket(packet, ThrottleOutPacketType.Task); +// OutPacket(packet, ThrottleOutPacketType.Task); + OutPacket(packet, ThrottleOutPacketType.Land); } public void SendLandProperties( -- cgit v1.1