From 5d61c4039dd4f22b20875a0a9dee72179642da9c Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 24 Oct 2013 00:33:14 +0100 Subject: Only set the data present event if we actually queued an outoing packet (not if we sent immediately) --- .../Region/ClientStack/Linden/UDP/LLUDPServer.cs | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 8d957dc..981f7ef 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -919,6 +919,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (packet.Type == PacketType.CoarseLocationUpdate && allowSplitting) allowSplitting = false; + bool packetQueued = false; + if (allowSplitting && packet.HasVariableBlocks) { byte[][] datas = packet.ToBytesMultiple(); @@ -930,18 +932,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP for (int i = 0; i < packetCount; i++) { byte[] data = datas[i]; - SendPacketData(udpClient, data, packet.Type, category, method); + + if (!SendPacketData(udpClient, data, packet.Type, category, method)) + packetQueued = true; } } else { byte[] data = packet.ToBytes(); - SendPacketData(udpClient, data, packet.Type, category, method); + packetQueued = SendPacketData(udpClient, data, packet.Type, category, method); } PacketPool.Instance.ReturnPacket(packet); - m_dataPresentEvent.Set(); + if (packetQueued) + m_dataPresentEvent.Set(); } /// @@ -955,7 +960,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// The method to call if the packet is not acked by the client. If null, then a standard /// resend of the packet is done. /// - public void SendPacketData( + /// true if the data was sent immediately, false if it was queued for sending + public bool SendPacketData( LLUDPClient udpClient, byte[] data, PacketType type, ThrottleOutPacketType category, UnackedPacketMethod method) { int dataLength = data.Length; @@ -1020,7 +1026,14 @@ 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)) + { SendPacketFinal(outgoingPacket); + return true; + } + else + { + return false; + } #endregion Queue or Send } -- cgit v1.1 From cccdfcb59eea7f8a43fe34ca55ff89b3317904f2 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 24 Oct 2013 00:37:49 +0100 Subject: Comment out LLUDPServer.BroadcastPacket() to reduce code complexity. Appears to be a never used method. --- .../Region/ClientStack/Linden/UDP/LLUDPServer.cs | 76 +++++++++++----------- 1 file changed, 38 insertions(+), 38 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 981f7ef..218c2b2 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -862,44 +862,44 @@ namespace OpenSim.Region.ClientStack.LindenUDP return x == m_location; } - public void BroadcastPacket(Packet packet, ThrottleOutPacketType category, bool sendToPausedAgents, bool allowSplitting) - { - // CoarseLocationUpdate and AvatarGroupsReply packets cannot be split in an automated way - if ((packet.Type == PacketType.CoarseLocationUpdate || packet.Type == PacketType.AvatarGroupsReply) && allowSplitting) - allowSplitting = false; - - if (allowSplitting && packet.HasVariableBlocks) - { - byte[][] datas = packet.ToBytesMultiple(); - int packetCount = datas.Length; - - if (packetCount < 1) - m_log.Error("[LLUDPSERVER]: Failed to split " + packet.Type + " with estimated length " + packet.Length); - - for (int i = 0; i < packetCount; i++) - { - byte[] data = datas[i]; - m_scene.ForEachClient( - delegate(IClientAPI client) - { - if (client is LLClientView) - SendPacketData(((LLClientView)client).UDPClient, data, packet.Type, category, null); - } - ); - } - } - else - { - byte[] data = packet.ToBytes(); - m_scene.ForEachClient( - delegate(IClientAPI client) - { - if (client is LLClientView) - SendPacketData(((LLClientView)client).UDPClient, data, packet.Type, category, null); - } - ); - } - } +// public void BroadcastPacket(Packet packet, ThrottleOutPacketType category, bool sendToPausedAgents, bool allowSplitting) +// { +// // CoarseLocationUpdate and AvatarGroupsReply packets cannot be split in an automated way +// if ((packet.Type == PacketType.CoarseLocationUpdate || packet.Type == PacketType.AvatarGroupsReply) && allowSplitting) +// allowSplitting = false; +// +// if (allowSplitting && packet.HasVariableBlocks) +// { +// byte[][] datas = packet.ToBytesMultiple(); +// int packetCount = datas.Length; +// +// if (packetCount < 1) +// m_log.Error("[LLUDPSERVER]: Failed to split " + packet.Type + " with estimated length " + packet.Length); +// +// for (int i = 0; i < packetCount; i++) +// { +// byte[] data = datas[i]; +// m_scene.ForEachClient( +// delegate(IClientAPI client) +// { +// if (client is LLClientView) +// SendPacketData(((LLClientView)client).UDPClient, data, packet.Type, category, null); +// } +// ); +// } +// } +// else +// { +// byte[] data = packet.ToBytes(); +// m_scene.ForEachClient( +// delegate(IClientAPI client) +// { +// if (client is LLClientView) +// SendPacketData(((LLClientView)client).UDPClient, data, packet.Type, category, null); +// } +// ); +// } +// } /// /// Start the process of sending a packet to the client. -- cgit v1.1 From df76e5231035c8d45b4e8a28c1f21a18b4974b67 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 24 Oct 2013 23:00:02 +0100 Subject: minor: Add commented out code for apparent passing of texture IDs in ObjectProperties UDP replies to viewer Not yet shown that this is used or resolves a bug where not all textures appear on objects with an "XML with textures" upload from singularity 1.8.3 Proper texture entries are actually present and appear properly on relog, but not on select from viewer until at least one face texture is changed. --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 6b58fb7..03cd2b4 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -4546,6 +4546,32 @@ namespace OpenSim.Region.ClientStack.LindenUDP SceneObjectPart root = sop.ParentGroup.RootPart; block.TouchName = Util.StringToBytes256(root.TouchName); + + // SL 3.3.4, at least, appears to read this information as a concatenated byte[] stream of UUIDs but + // it's not yet clear whether this is actually used. If this is done in the future then a pre-cached + // copy is really needed since it's less efficient to be constantly recreating this byte array. +// using (MemoryStream memStream = new MemoryStream()) +// { +// using (BinaryWriter binWriter = new BinaryWriter(memStream)) +// { +// for (int i = 0; i < sop.GetNumberOfSides(); i++) +// { +// Primitive.TextureEntryFace teFace = sop.Shape.Textures.FaceTextures[i]; +// +// UUID textureID; +// +// if (teFace != null) +// textureID = teFace.TextureID; +// else +// textureID = sop.Shape.Textures.DefaultTexture.TextureID; +// +// binWriter.Write(textureID.GetBytes()); +// } +// +// block.TextureID = memStream.ToArray(); +// } +// } + block.TextureID = new byte[0]; // TextureID ??? block.SitName = Util.StringToBytes256(root.SitName); block.OwnerMask = root.OwnerMask; -- cgit v1.1 From 3d5a7e9b194d9d6a73091935e316b56d5302dcbb Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 31 Oct 2013 23:45:52 +0000 Subject: Add OutgoingPacketsResentCount clientstack stat. This allows one to monitor the total number of messages resent to clients over time. A constantly increasing stat may indicate a general server network or overloading issue if a fairly high proportion of packets sent A smaller constantly increasing stat may indicate a problem with a particular client-server connection, would need to check "show queues" in this case. --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 6 ++++- .../Region/ClientStack/Linden/UDP/LLUDPServer.cs | 27 ++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 03cd2b4..5d3b5b5 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -3801,7 +3801,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP 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); + 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); diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 218c2b2..ca17771 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -147,6 +147,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP StatsManager.RegisterStat( new Stat( + "OutgoingPacketsResentCount", + "Number of packets resent because a client did not acknowledge receipt", + "", + "", + "clientstack", + scene.Name, + StatType.Pull, + MeasuresOfInterest.AverageChangeOverTime, + stat => stat.Value = m_udpServer.PacketsResentCount, + StatVerbosity.Debug)); + + StatsManager.RegisterStat( + new Stat( "AverageUDPProcessTime", "Average number of milliseconds taken to process each incoming UDP packet in a sample.", "This is for initial receive processing which is separate from the later client LL packet processing stage.", @@ -295,6 +308,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP public Socket Server { get { return null; } } /// + /// Record how many packets have been resent + /// + internal int PacketsResentCount { get; set; } + + /// + /// Record how many packets have been sent + /// + internal int PacketsSentCount { get; set; } + + /// /// Record how many inbound packets could not be recognized as LLUDP packets. /// public int IncomingMalformedPacketCount { get; private set; } @@ -1221,6 +1244,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Stats tracking Interlocked.Increment(ref udpClient.PacketsSent); + // We're not going to worry about interlock yet since its not currently critical that this total count + // is 100% correct + PacketsSentCount++; + // Put the UDP payload on the wire AsyncBeginSend(buffer); -- cgit v1.1 From 50794c90085438091b02123cd15aad77f90a2637 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 31 Oct 2013 23:51:01 +0000 Subject: minor: remove mono compiler warnings in AvatarPickerSearchModule and UploadBakedTextureModule --- OpenSim/Region/ClientStack/Linden/Caps/AvatarPickerSearchModule.cs | 7 ++----- OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs | 3 +-- 2 files changed, 3 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/AvatarPickerSearchModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/AvatarPickerSearchModule.cs index 10a4753..bbadc55 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/AvatarPickerSearchModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/AvatarPickerSearchModule.cs @@ -49,12 +49,10 @@ using OpenSim.Capabilities.Handlers; namespace OpenSim.Region.ClientStack.Linden { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "AvatarPickerSearchModule")] public class AvatarPickerSearchModule : INonSharedRegionModule { - private static readonly ILog m_log = - LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); +// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private Scene m_scene; private IPeople m_People; @@ -134,6 +132,5 @@ namespace OpenSim.Region.ClientStack.Linden caps.RegisterHandler("AvatarPickerSearch", m_URL); } } - } -} +} \ No newline at end of file diff --git a/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs index 79a935d..4501dd9 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs @@ -107,7 +107,7 @@ namespace OpenSim.Region.ClientStack.Linden public void RegisterCaps(UUID agentID, Caps caps) { - UUID capID = UUID.Random(); +// UUID capID = UUID.Random(); //caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture)); if (m_URL == "localhost") @@ -127,7 +127,6 @@ namespace OpenSim.Region.ClientStack.Linden { caps.RegisterHandler("UploadBakedTexture", m_URL); } - } } } \ No newline at end of file -- cgit v1.1 From 4c4a1cf71526aa39346f2a8af124a5bcb51e735d Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 31 Oct 2013 23:59:22 +0000 Subject: Start counting resent packets in the places that I missed when the stat was first added a few commits ago --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 4 ++++ OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 4 ++++ 2 files changed, 8 insertions(+) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 5d3b5b5..1a2d4de 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -4367,6 +4367,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP // 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 (ObjectPropertyUpdate update in updates) ResendPropertyUpdate(update); } diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index ca17771..3bd1ef1 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -1237,6 +1237,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP else { Interlocked.Increment(ref udpClient.PacketsResent); + + // We're not going to worry about interlock yet since its not currently critical that this total count + // is 100% correct + PacketsResentCount++; } #endregion Sequence Number Assignment -- cgit v1.1