From f89c2cac0fd3e9e1ae66552bbc2c3cc4bb17aaed Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Tue, 27 Oct 2009 14:16:01 -0700 Subject: Experimental test to rate limit the incoming packet handler and try to always leave a worker thread available for other tasks --- OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index e3233da..74d3262 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs @@ -801,6 +801,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP { IncomingPacket incomingPacket = null; + // HACK: This is a test to try and rate limit packet handling on Mono. + // If it works, a more elegant solution can be devised + if (Util.FireAndForgetCount() < 2) + { + //m_log.Debug("[LLUDPSERVER]: Incoming packet handler is sleeping"); + Thread.Sleep(30); + } + if (packetInbox.Dequeue(100, ref incomingPacket)) Util.FireAndForget(ProcessInPacket, incomingPacket); } -- cgit v1.1 From 8254256fe9eaa66c49ca981d3c8233bcc0c86eed Mon Sep 17 00:00:00 2001 From: Mikko Pallari Date: Tue, 27 Oct 2009 12:51:47 +0200 Subject: Modified visibilities of properties and methods. This is so that SL client based clients can use UDP server that is inherited from LLUDPServer. --- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 14 +++++++------- OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | 10 +++++----- 2 files changed, 12 insertions(+), 12 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index f6a7a0c..d6d1a95 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -314,14 +314,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP private readonly LLUDPClient m_udpClient; private readonly UUID m_sessionId; private readonly UUID m_secureSessionId; - private readonly UUID m_agentId; + protected readonly UUID m_agentId; private readonly uint m_circuitCode; private readonly byte[] m_channelVersion = Utils.EmptyBytes; private readonly Dictionary m_defaultAnimations = new Dictionary(); private readonly IGroupsModule m_GroupsModule; private int m_cachedTextureSerial; - private PriorityQueue m_avatarTerseUpdates; + protected PriorityQueue m_avatarTerseUpdates; private PriorityQueue m_primTerseUpdates; private PriorityQueue m_primFullUpdates; private int m_moneyBalance; @@ -3314,7 +3314,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP ProcessAvatarTerseUpdates(); } - private void ProcessAvatarTerseUpdates() + protected void ProcessAvatarTerseUpdates() { ImprovedTerseObjectUpdatePacket terse = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate); terse.Header.Reliable = false; @@ -5050,7 +5050,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// /// Packet to send /// Throttling category for the packet - private void OutPacket(Packet packet, ThrottleOutPacketType throttlePacketType) + protected void OutPacket(Packet packet, ThrottleOutPacketType throttlePacketType) { m_udpServer.SendPacket(m_udpClient, packet, throttlePacketType, true); } @@ -10236,7 +10236,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } #region PriorityQueue - private class PriorityQueue + public class PriorityQueue { internal delegate bool UpdatePriorityHandler(ref TPriority priority, uint local_id); @@ -10264,7 +10264,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP this.m_comparison = comparison; } - internal object SyncRoot { get { return this.m_syncRoot; } } + public object SyncRoot { get { return this.m_syncRoot; } } internal int Count { get @@ -10276,7 +10276,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } - internal bool Enqueue(TPriority priority, TValue value, uint local_id) + public bool Enqueue(TPriority priority, TValue value, uint local_id) { LookupItem item; diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index 74d3262..dc72939 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs @@ -118,13 +118,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// //private UDPClientCollection m_clients = new UDPClientCollection(); /// Bandwidth throttle for this UDP server - private TokenBucket m_throttle; + protected TokenBucket m_throttle; /// Bandwidth throttle rates for this UDP server - private ThrottleRates m_throttleRates; + protected ThrottleRates m_throttleRates; /// Manages authentication for agent circuits private AgentCircuitManager m_circuitManager; /// Reference to the scene this UDP server is attached to - private Scene m_scene; + 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 @@ -759,7 +759,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } - private void AddClient(uint circuitCode, UUID agentID, UUID sessionID, IPEndPoint remoteEndPoint, AuthenticateResponse sessionInfo) + protected virtual void AddClient(uint circuitCode, UUID agentID, UUID sessionID, IPEndPoint remoteEndPoint, AuthenticateResponse sessionInfo) { // Create the LLUDPClient LLUDPClient udpClient = new LLUDPClient(this, m_throttleRates, m_throttle, circuitCode, agentID, remoteEndPoint); @@ -976,7 +976,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } - private void LogoutHandler(IClientAPI client) + protected void LogoutHandler(IClientAPI client) { client.SendLogoutPacket(); if (client.IsActive) -- cgit v1.1 From 587c35f6b6e79636bd50f8e650de55239d424b37 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Wed, 28 Oct 2009 02:30:16 -0700 Subject: Marking ImprovedTerseObjectUpdate packets for avatars as unthrottled to test --- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index d6d1a95..97caf52 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -3335,7 +3335,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP terse.ObjectData[i] = m_avatarTerseUpdates.Dequeue(); } - OutPacket(terse, ThrottleOutPacketType.Task); + OutPacket(terse, ThrottleOutPacketType.Unknown); // HACK: Unthrottled for testing } public void SendCoarseLocationUpdate(List users, List CoarseLocations) -- cgit v1.1 From 1c9696a9d2665b72ecde45fdcc43c1cde2abad79 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Wed, 28 Oct 2009 15:11:01 -0700 Subject: Always send a time dilation of 1.0 while we debug rubberbanding issues --- .../Region/ClientStack/LindenUDP/LLClientView.cs | 101 --------------------- 1 file changed, 101 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 97caf52..1ff18d4 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -3168,107 +3168,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP #endregion - #region Prim/Avatar Updates - - /*void SendObjectUpdate(SceneObjectPart obj, PrimFlags creatorFlags, PrimUpdateFlags updateFlags) - { - bool canUseCompressed, canUseImproved; - UpdateFlagsToPacketType(creatorFlags, updateFlags, out canUseCompressed, out canUseImproved); - - if (!canUseImproved && !canUseCompressed) - SendFullObjectUpdate(obj, creatorFlags, updateFlags); - else if (!canUseImproved) - SendObjectUpdateCompressed(obj, creatorFlags, updateFlags); - else - SendImprovedTerseObjectUpdate(obj, creatorFlags, updateFlags); - } - - void SendFullObjectUpdate(SceneObjectPart obj, PrimFlags creatorFlags, PrimUpdateFlags updateFlags) - { - IClientAPI owner; - if (m_scene.ClientManager.TryGetValue(obj.OwnerID, out owner) && owner is LLClientView) - { - LLClientView llOwner = (LLClientView)owner; - - // Send an update out to the owner - ObjectUpdatePacket updateToOwner = new ObjectUpdatePacket(); - updateToOwner.RegionData.RegionHandle = obj.RegionHandle; - //updateToOwner.RegionData.TimeDilation = (ushort)(timeDilation * (float)UInt16.MaxValue); - updateToOwner.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; - updateToOwner.ObjectData[0] = BuildUpdateBlock(obj, obj.Flags | creatorFlags | PrimFlags.ObjectYouOwner, 0); - - m_udpServer.SendPacket(llOwner.UDPClient, updateToOwner, ThrottleOutPacketType.State, true); - } - - // Send an update out to everyone else - ObjectUpdatePacket updateToOthers = new ObjectUpdatePacket(); - updateToOthers.RegionData.RegionHandle = obj.RegionHandle; - //updateToOthers.RegionData.TimeDilation = (ushort)(timeDilation * (float)UInt16.MaxValue); - updateToOthers.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; - updateToOthers.ObjectData[0] = BuildUpdateBlock(obj, obj.Flags, 0); - - m_scene.ClientManager.ForEach( - delegate(IClientAPI client) - { - if (client.AgentId != obj.OwnerID && client is LLClientView) - { - LLClientView llClient = (LLClientView)client; - m_udpServer.SendPacket(llClient.UDPClient, updateToOthers, ThrottleOutPacketType.State, true); - } - } - ); - } - - void SendObjectUpdateCompressed(SceneObjectPart obj, PrimFlags creatorFlags, PrimUpdateFlags updateFlags) - { - } - - void SendImprovedTerseObjectUpdate(SceneObjectPart obj, PrimFlags creatorFlags, PrimUpdateFlags updateFlags) - { - } - - void UpdateFlagsToPacketType(PrimFlags creatorFlags, PrimUpdateFlags updateFlags, out bool canUseCompressed, out bool canUseImproved) - { - canUseCompressed = true; - canUseImproved = true; - - if ((updateFlags & PrimUpdateFlags.FullUpdate) == PrimUpdateFlags.FullUpdate || creatorFlags != PrimFlags.None) - { - canUseCompressed = false; - canUseImproved = false; - } - else - { - if ((updateFlags & PrimUpdateFlags.Velocity) != 0 || - (updateFlags & PrimUpdateFlags.Acceleration) != 0 || - (updateFlags & PrimUpdateFlags.CollisionPlane) != 0 || - (updateFlags & PrimUpdateFlags.Joint) != 0) - { - canUseCompressed = false; - } - - if ((updateFlags & PrimUpdateFlags.PrimFlags) != 0 || - (updateFlags & PrimUpdateFlags.ParentID) != 0 || - (updateFlags & PrimUpdateFlags.Scale) != 0 || - (updateFlags & PrimUpdateFlags.PrimData) != 0 || - (updateFlags & PrimUpdateFlags.Text) != 0 || - (updateFlags & PrimUpdateFlags.NameValue) != 0 || - (updateFlags & PrimUpdateFlags.ExtraData) != 0 || - (updateFlags & PrimUpdateFlags.TextureAnim) != 0 || - (updateFlags & PrimUpdateFlags.Sound) != 0 || - (updateFlags & PrimUpdateFlags.Particles) != 0 || - (updateFlags & PrimUpdateFlags.Material) != 0 || - (updateFlags & PrimUpdateFlags.ClickAction) != 0 || - (updateFlags & PrimUpdateFlags.MediaURL) != 0 || - (updateFlags & PrimUpdateFlags.Joint) != 0) - { - canUseImproved = false; - } - } - }*/ - - #endregion Prim/Avatar Updates - #region Avatar Packet/Data Sending Methods /// -- cgit v1.1 From 2913c24c8a5a4a50e9267aa125abcc7956a388d1 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Thu, 29 Oct 2009 15:24:31 -0700 Subject: * Commented out two noisy debug lines in the LLUDP server * Misc. cleanup in ScenePresence.HandleAgentUpdate() --- OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index dc72939..a211508 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs @@ -429,7 +429,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (expiredPackets != null) { - m_log.Debug("[LLUDPSERVER]: Resending " + expiredPackets.Count + " packets to " + udpClient.AgentID + ", RTO=" + udpClient.RTO); + //m_log.Debug("[LLUDPSERVER]: Resending " + expiredPackets.Count + " packets to " + udpClient.AgentID + ", RTO=" + udpClient.RTO); // Exponential backoff of the retransmission timeout udpClient.BackoffRTO(); @@ -585,7 +585,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 a05c67bebb8a504858706619335c035948907158 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Fri, 30 Oct 2009 00:08:41 -0700 Subject: * Fixes issue #4329 "llDialog fails silently" by updating OpenMetaverse.dll * Prints a warning for any future packet splitting failures --- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 12 ++++++------ OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 1ff18d4..992d06f 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -4329,11 +4329,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// protected virtual void RegisterLocalPacketHandlers() { - AddLocalPacketHandler(PacketType.LogoutRequest, Logout); + AddLocalPacketHandler(PacketType.LogoutRequest, HandleLogout); AddLocalPacketHandler(PacketType.AgentUpdate, HandleAgentUpdate); AddLocalPacketHandler(PacketType.ViewerEffect, HandleViewerEffect); - AddLocalPacketHandler(PacketType.AgentCachedTexture, AgentTextureCached); - AddLocalPacketHandler(PacketType.MultipleObjectUpdate, MultipleObjUpdate); + AddLocalPacketHandler(PacketType.AgentCachedTexture, HandleAgentTextureCached); + AddLocalPacketHandler(PacketType.MultipleObjectUpdate, HandleMultipleObjUpdate); AddLocalPacketHandler(PacketType.MoneyTransferRequest, HandleMoneyTransferRequest); AddLocalPacketHandler(PacketType.ParcelBuy, HandleParcelBuyRequest); AddLocalPacketHandler(PacketType.UUIDGroupNameRequest, HandleUUIDGroupNameRequest); @@ -4602,7 +4602,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// /// /// - protected virtual bool Logout(IClientAPI client, Packet packet) + protected virtual bool HandleLogout(IClientAPI client, Packet packet) { if (packet.Type == PacketType.LogoutRequest) { @@ -4640,7 +4640,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// /// /// - protected bool AgentTextureCached(IClientAPI simclient, Packet packet) + protected bool HandleAgentTextureCached(IClientAPI simclient, Packet packet) { //m_log.Debug("texture cached: " + packet.ToString()); AgentCachedTexturePacket cachedtex = (AgentCachedTexturePacket)packet; @@ -4670,7 +4670,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP return true; } - protected bool MultipleObjUpdate(IClientAPI simClient, Packet packet) + protected bool HandleMultipleObjUpdate(IClientAPI simClient, Packet packet) { MultipleObjectUpdatePacket multipleupdate = (MultipleObjectUpdatePacket)packet; if (multipleupdate.AgentData.SessionID != SessionId) return false; diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index a211508..9792bcd 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs @@ -256,8 +256,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP byte[][] datas = packet.ToBytesMultiple(); int packetCount = datas.Length; - //if (packetCount > 1) - // m_log.Debug("[LLUDPSERVER]: Split " + packet.Type + " packet into " + packetCount + " packets"); + if (packetCount < 1) + m_log.Error("[LLUDPSERVER]: Failed to split " + packet.Type + " with estimated length " + packet.Length); for (int i = 0; i < packetCount; i++) { @@ -295,8 +295,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP byte[][] datas = packet.ToBytesMultiple(); int packetCount = datas.Length; - //if (packetCount > 1) - // m_log.Debug("[LLUDPSERVER]: Split " + packet.Type + " packet into " + packetCount + " packets"); + if (packetCount < 1) + m_log.Error("[LLUDPSERVER]: Failed to split " + packet.Type + " with estimated length " + packet.Length); for (int i = 0; i < packetCount; i++) { -- cgit v1.1 From 7965b6eb611be5f1a3cc75b2f8e3f3b76c87ffa0 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Fri, 30 Oct 2009 00:43:46 -0700 Subject: * Moving parcel media and avatar update packets from the unthrottled category to task * Fixing a bug where the max burst rate for the state category was being set as unlimited, causing connections to child agents to saturate bandwidth * Upped the example default drip rates to 1000 bytes/sec, the minimum granularity for the token buckets --- .../Region/ClientStack/LindenUDP/LLClientView.cs | 11 +++++++---- OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs | 3 --- OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | 12 ++++++++---- .../Region/ClientStack/LindenUDP/ThrottleRates.cs | 21 ++++++++++----------- 4 files changed, 25 insertions(+), 22 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 992d06f..b8c99cf 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -1856,7 +1856,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP economyData.Info.TeleportMinPrice = TeleportMinPrice; economyData.Info.TeleportPriceExponent = TeleportPriceExponent; economyData.Header.Reliable = true; - OutPacket(economyData, ThrottleOutPacketType.Unknown); + OutPacket(economyData, ThrottleOutPacketType.Task); } public void SendAvatarPickerReply(AvatarPickerReplyAgentDataArgs AgentData, List Data) @@ -3234,7 +3234,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP terse.ObjectData[i] = m_avatarTerseUpdates.Dequeue(); } - OutPacket(terse, ThrottleOutPacketType.Unknown); // HACK: Unthrottled for testing + // HACK: Using the task category until the tiered reprioritization code is in + OutPacket(terse, ThrottleOutPacketType.Task); } public void SendCoarseLocationUpdate(List users, List CoarseLocations) @@ -4951,6 +4952,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// Throttling category for the packet protected void OutPacket(Packet packet, ThrottleOutPacketType throttlePacketType) { + if (ChildAgentStatus()) + Thread.Sleep(200); m_udpServer.SendPacket(m_udpClient, packet, throttlePacketType, true); } @@ -9843,7 +9846,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP commandMessagePacket.CommandBlock.Command = (uint)command; commandMessagePacket.CommandBlock.Time = time; - OutPacket(commandMessagePacket, ThrottleOutPacketType.Unknown); + OutPacket(commandMessagePacket, ThrottleOutPacketType.Task); } public void SendParcelMediaUpdate(string mediaUrl, UUID mediaTextureID, @@ -9861,7 +9864,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP updatePacket.DataBlockExtended.MediaHeight = mediaHeight; updatePacket.DataBlockExtended.MediaLoop = mediaLoop; - OutPacket(updatePacket, ThrottleOutPacketType.Unknown); + OutPacket(updatePacket, ThrottleOutPacketType.Task); } #endregion diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs index 84a4959..6619dcb 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs @@ -135,8 +135,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP private readonly TokenBucket m_throttle; /// Throttle buckets for each packet category private readonly TokenBucket[] m_throttleCategories; - /// Throttle rate defaults and limits - private readonly ThrottleRates m_defaultThrottleRates; /// Outgoing queues for throttled packets private readonly OpenSim.Framework.LocklessQueue[] m_packetOutboxes = new OpenSim.Framework.LocklessQueue[THROTTLE_CATEGORY_COUNT]; /// A container that can hold one packet for each outbox, used to store @@ -161,7 +159,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP RemoteEndPoint = remoteEndPoint; CircuitCode = circuitCode; m_udpServer = server; - m_defaultThrottleRates = rates; // Create a token bucket throttle for this client that has the scene token bucket as a parent m_throttle = new TokenBucket(parentThrottle, rates.TotalLimit, rates.Total); // Create an array of token buckets for this clients different throttle categories diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index 9792bcd..cc06a85 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs @@ -409,6 +409,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP SendPacket(udpClient, pc, ThrottleOutPacketType.Unknown, false); } + public void CompletePing(LLUDPClient udpClient, byte pingID) + { + CompletePingCheckPacket completePing = new CompletePingCheckPacket(); + completePing.PingID.PingID = pingID; + SendPacket(udpClient, completePing, ThrottleOutPacketType.Unknown, false); + } + public void ResendUnacked(LLUDPClient udpClient) { if (!udpClient.IsConnected) @@ -669,10 +676,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { // We don't need to do anything else with ping checks StartPingCheckPacket startPing = (StartPingCheckPacket)packet; - - CompletePingCheckPacket completePing = new CompletePingCheckPacket(); - completePing.PingID.PingID = startPing.PingID.PingID; - SendPacket(udpClient, completePing, ThrottleOutPacketType.Unknown, false); + CompletePing(udpClient, startPing.PingID.PingID); return; } else if (packet.Type == PacketType.CompletePingCheck) diff --git a/OpenSim/Region/ClientStack/LindenUDP/ThrottleRates.cs b/OpenSim/Region/ClientStack/LindenUDP/ThrottleRates.cs index 008d827..aaf6e26 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/ThrottleRates.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/ThrottleRates.cs @@ -87,15 +87,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP IConfig throttleConfig = config.Configs["ClientStack.LindenUDP"]; Resend = throttleConfig.GetInt("resend_default", 12500); - Land = throttleConfig.GetInt("land_default", 500); - Wind = throttleConfig.GetInt("wind_default", 500); - Cloud = throttleConfig.GetInt("cloud_default", 500); - Task = throttleConfig.GetInt("task_default", 500); - Texture = throttleConfig.GetInt("texture_default", 500); - Asset = throttleConfig.GetInt("asset_default", 500); - State = throttleConfig.GetInt("state_default", 500); - - Total = throttleConfig.GetInt("client_throttle_max_bps", 0); + Land = throttleConfig.GetInt("land_default", 1000); + Wind = throttleConfig.GetInt("wind_default", 1000); + Cloud = throttleConfig.GetInt("cloud_default", 1000); + Task = throttleConfig.GetInt("task_default", 1000); + Texture = throttleConfig.GetInt("texture_default", 1000); + Asset = throttleConfig.GetInt("asset_default", 1000); + State = throttleConfig.GetInt("state_default", 1000); ResendLimit = throttleConfig.GetInt("resend_limit", 18750); LandLimit = throttleConfig.GetInt("land_limit", 29750); @@ -104,9 +102,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP TaskLimit = throttleConfig.GetInt("task_limit", 18750); TextureLimit = throttleConfig.GetInt("texture_limit", 55750); AssetLimit = throttleConfig.GetInt("asset_limit", 27500); - State = throttleConfig.GetInt("state_limit", 37000); + StateLimit = throttleConfig.GetInt("state_limit", 37000); - TotalLimit = throttleConfig.GetInt("client_throttle_max_bps", 0); + Total = throttleConfig.GetInt("client_throttle_max_bps", 0); + TotalLimit = Total; } catch (Exception) { } } -- cgit v1.1 From 8a73dc0f8a3a8606439b6f7217d2d14c22bfd43e Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Fri, 30 Oct 2009 03:01:15 -0700 Subject: * Fix for a potential race condition in ScenePresence.AbsolutePosition * Unified the way region handles are stored and used in ScenePresence * Fixed camera position for child agents * CheckForSignificantMovement now checks avatar and camera position (both are important for scene prioritization) * Removing debug code from the previous commit --- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 2 -- 1 file changed, 2 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index b8c99cf..bd75f0c 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -4952,8 +4952,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// Throttling category for the packet protected void OutPacket(Packet packet, ThrottleOutPacketType throttlePacketType) { - if (ChildAgentStatus()) - Thread.Sleep(200); m_udpServer.SendPacket(m_udpClient, packet, throttlePacketType, true); } -- cgit v1.1 From 5d5d0e699af34b9300ed2f60c0c59b256be3dd89 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Fri, 30 Oct 2009 11:12:32 -0700 Subject: * Disables automatic packet splitting on AvatarGroupsReply packets. This packet is a mess and shouldn't be used at all (in favor of the event queue message) * Clean up the way we send AvatarGroupsReply packets, including clamping the group name and group title --- .../Region/ClientStack/LindenUDP/LLClientView.cs | 26 ++++++++++++---------- .../Region/ClientStack/LindenUDP/LLUDPServer.cs | 4 ++-- 2 files changed, 16 insertions(+), 14 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index bd75f0c..f33d2fa 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -2793,20 +2793,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP p.AgentData.AvatarID = avatarID; p.GroupData = new AvatarGroupsReplyPacket.GroupDataBlock[data.Length]; - int i = 0; - foreach (GroupMembershipData m in data) - { - p.GroupData[i] = new AvatarGroupsReplyPacket.GroupDataBlock(); - p.GroupData[i].GroupPowers = m.GroupPowers; - p.GroupData[i].AcceptNotices = m.AcceptNotices; - p.GroupData[i].GroupTitle = Utils.StringToBytes(m.GroupTitle); - p.GroupData[i].GroupID = m.GroupID; - p.GroupData[i].GroupName = Utils.StringToBytes(m.GroupName); - p.GroupData[i].GroupInsigniaID = m.GroupPicture; - i++; + + for (int i = 0; i < data.Length; i++) + { + GroupMembershipData m = data[i]; + + AvatarGroupsReplyPacket.GroupDataBlock block = new AvatarGroupsReplyPacket.GroupDataBlock(); + block.GroupPowers = m.GroupPowers; + block.AcceptNotices = m.AcceptNotices; + block.GroupTitle = Util.StringToBytes256(m.GroupTitle.Substring(0, 20)); + block.GroupID = m.GroupID; + block.GroupName = Util.StringToBytes256(m.GroupName.Substring(0, 35)); + block.GroupInsigniaID = m.GroupPicture; + + p.GroupData[i] = block; } - p.NewGroupData = new AvatarGroupsReplyPacket.NewGroupDataBlock(); p.NewGroupData.ListInProfile = true; OutPacket(p, ThrottleOutPacketType.Task); diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index cc06a85..6f94921 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs @@ -247,8 +247,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP public void BroadcastPacket(Packet packet, ThrottleOutPacketType category, bool sendToPausedAgents, bool allowSplitting) { - // CoarseLocationUpdate packets cannot be split in an automated way - if (packet.Type == PacketType.CoarseLocationUpdate && 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) -- cgit v1.1 From cb1492aaf0aae074753d0d4f5766fa4cd1292536 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Fri, 30 Oct 2009 13:18:18 -0700 Subject: Fixed a regression in SendAvatarGroupsReply() --- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index f33d2fa..e513249 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -2801,9 +2801,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP AvatarGroupsReplyPacket.GroupDataBlock block = new AvatarGroupsReplyPacket.GroupDataBlock(); block.GroupPowers = m.GroupPowers; block.AcceptNotices = m.AcceptNotices; - block.GroupTitle = Util.StringToBytes256(m.GroupTitle.Substring(0, 20)); + block.GroupTitle = Util.StringToBytes256(m.GroupTitle.Length > 20 ? m.GroupTitle.Substring(0, 20) : m.GroupTitle); block.GroupID = m.GroupID; - block.GroupName = Util.StringToBytes256(m.GroupName.Substring(0, 35)); + block.GroupName = Util.StringToBytes256(m.GroupName.Length > 35 ? m.GroupName.Substring(0, 35) : m.GroupName); block.GroupInsigniaID = m.GroupPicture; p.GroupData[i] = block; -- cgit v1.1 From 39f95e8cf0b18c25c4225336619048ef9fee9707 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 30 Oct 2009 19:44:01 +0000 Subject: Add a using for OSD to the client view --- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index e513249..83b763e 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -37,6 +37,7 @@ using System.Xml; using log4net; using OpenMetaverse; using OpenMetaverse.Packets; +using OpenMetaverse.StructuredData; using OpenSim.Framework; using OpenSim.Framework.Client; using OpenSim.Framework.Communications.Cache; -- cgit v1.1 From 92f4835ba612a184cd46462f7eac76d4dd19ae7f Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 30 Oct 2009 19:54:56 +0000 Subject: Convert the AvatarGroupsReply message to the event queue. --- .../Region/ClientStack/LindenUDP/LLClientView.cs | 65 +++++++++++++--------- 1 file changed, 39 insertions(+), 26 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 83b763e..db0c3b8 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -2787,32 +2787,37 @@ namespace OpenSim.Region.ClientStack.LindenUDP public void SendAvatarGroupsReply(UUID avatarID, GroupMembershipData[] data) { - AvatarGroupsReplyPacket p = (AvatarGroupsReplyPacket)PacketPool.Instance.GetPacket(PacketType.AvatarGroupsReply); - - p.AgentData = new AvatarGroupsReplyPacket.AgentDataBlock(); - p.AgentData.AgentID = AgentId; - p.AgentData.AvatarID = avatarID; - - p.GroupData = new AvatarGroupsReplyPacket.GroupDataBlock[data.Length]; - - for (int i = 0; i < data.Length; i++) - { - GroupMembershipData m = data[i]; - - AvatarGroupsReplyPacket.GroupDataBlock block = new AvatarGroupsReplyPacket.GroupDataBlock(); - block.GroupPowers = m.GroupPowers; - block.AcceptNotices = m.AcceptNotices; - block.GroupTitle = Util.StringToBytes256(m.GroupTitle.Length > 20 ? m.GroupTitle.Substring(0, 20) : m.GroupTitle); - block.GroupID = m.GroupID; - block.GroupName = Util.StringToBytes256(m.GroupName.Length > 35 ? m.GroupName.Substring(0, 35) : m.GroupName); - block.GroupInsigniaID = m.GroupPicture; - - p.GroupData[i] = block; - } - - p.NewGroupData.ListInProfile = true; - - OutPacket(p, ThrottleOutPacketType.Task); + OSDMap llsd = new OSDMap(3); + OSDArray AgentData = new OSDArray(1); + OSDMap AgentDataMap = new OSDMap(1); + AgentDataMap.Add("AgentID", OSD.FromUUID(this.AgentId)); + AgentDataMap.Add("AvatarID", OSD.FromUUID(avatarID)); + AgentData.Add(AgentDataMap); + llsd.Add("AgentData", AgentData); + OSDArray GroupData = new OSDArray(data.Length); + OSDArray NewGroupData = new OSDArray(data.Length); + foreach (GroupMembershipData m in data) + { + OSDMap GroupDataMap = new OSDMap(6); + OSDMap NewGroupDataMap = new OSDMap(1); + GroupDataMap.Add("GroupPowers", OSD.FromBinary(m.GroupPowers)); + GroupDataMap.Add("AcceptNotices", OSD.FromBoolean(m.AcceptNotices)); + GroupDataMap.Add("GroupTitle", OSD.FromString(m.GroupTitle)); + GroupDataMap.Add("GroupID", OSD.FromUUID(m.GroupID)); + GroupDataMap.Add("GroupName", OSD.FromString(m.GroupName)); + GroupDataMap.Add("GroupInsigniaID", OSD.FromUUID(m.GroupPicture)); + NewGroupDataMap.Add("ListInProfile", OSD.FromBoolean(m.ListInProfile)); + GroupData.Add(GroupDataMap); + NewGroupData.Add(NewGroupDataMap); + } + llsd.Add("GroupData", GroupData); + llsd.Add("NewGroupData", NewGroupData); + + IEventQueue eq = this.Scene.RequestModuleInterface(); + if (eq != null) + { + eq.Enqueue(BuildEvent("AvatarGroupsReply", llsd), this.AgentId); + } } public void SendJoinGroupReply(UUID groupID, bool success) @@ -10299,5 +10304,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP } #endregion + public static OSD BuildEvent(string eventName, OSD eventBody) + { + OSDMap osdEvent = new OSDMap(2); + osdEvent.Add("message", new OSDString(eventName)); + osdEvent.Add("body", eventBody); + + return osdEvent; + } } } -- cgit v1.1 From c6246050d9237293cc6b72e3adf6267617603259 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 30 Oct 2009 22:07:56 +0000 Subject: Make the default and max RTO configurable int he linden client stack --- OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs | 16 ++++++++++++---- OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | 8 +++++++- 2 files changed, 19 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs index 6619dcb..9856a1c 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs @@ -143,6 +143,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// A reference to the LLUDPServer that is managing this client private readonly LLUDPServer m_udpServer; + private int m_defaultRTO = 3000; + private int m_maxRTO = 60000; + /// /// Default constructor /// @@ -153,12 +156,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// Circuit code for this connection /// AgentID for the connected agent /// Remote endpoint for this connection - public LLUDPClient(LLUDPServer server, ThrottleRates rates, TokenBucket parentThrottle, uint circuitCode, UUID agentID, IPEndPoint remoteEndPoint) + public LLUDPClient(LLUDPServer server, ThrottleRates rates, TokenBucket parentThrottle, uint circuitCode, UUID agentID, IPEndPoint remoteEndPoint, int defaultRTO, int maxRTO) { AgentID = agentID; RemoteEndPoint = remoteEndPoint; CircuitCode = circuitCode; m_udpServer = server; + if (defaultRTO != 0) + m_defaultRTO = defaultRTO; + if (maxRTO != 0) + m_maxRTO = maxRTO; + // Create a token bucket throttle for this client that has the scene token bucket as a parent m_throttle = new TokenBucket(parentThrottle, rates.TotalLimit, rates.Total); // Create an array of token buckets for this clients different throttle categories @@ -175,7 +183,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } // Default the retransmission timeout to three seconds - RTO = 3000; + RTO = m_defaultRTO; // Initialize this to a sane value to prevent early disconnects TickLastPacketReceived = Environment.TickCount & Int32.MaxValue; @@ -497,7 +505,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP int rto = (int)(SRTT + Math.Max(m_udpServer.TickCountResolution, K * RTTVAR)); // Clamp the retransmission timeout to manageable values - rto = Utils.Clamp(RTO, 3000, 60000); + rto = Utils.Clamp(RTO, m_defaultRTO, m_maxRTO); RTO = rto; @@ -517,7 +525,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP RTTVAR = 0.0f; // Double the retransmission timeout - RTO = Math.Min(RTO * 2, 60000); + RTO = Math.Min(RTO * 2, m_maxRTO); } /// diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index 6f94921..93946ae 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs @@ -153,6 +153,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// Flag to signal when clients should send pings private bool m_sendPing; + private int m_defaultRTO = 0; + private int m_maxRTO = 0; + public Socket Server { get { return null; } } public LLUDPServer(IPAddress listenIP, ref uint port, int proxyPortOffsetParm, bool allow_alternate_port, IConfigSource configSource, AgentCircuitManager circuitManager) @@ -189,6 +192,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP AvatarTerseUpdatesPerPacket = config.GetInt("AvatarTerseUpdatesPerPacket", 10); PrimFullUpdatesPerPacket = config.GetInt("PrimFullUpdatesPerPacket", 100); TextureSendLimit = config.GetInt("TextureSendLimit", 20); + + m_defaultRTO = config.GetInt("DefaultRTO", 0); + m_maxRTO = config.GetInt("MaxRTO", 0); } else { @@ -766,7 +772,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP protected virtual void AddClient(uint circuitCode, UUID agentID, UUID sessionID, IPEndPoint remoteEndPoint, AuthenticateResponse sessionInfo) { // Create the LLUDPClient - LLUDPClient udpClient = new LLUDPClient(this, m_throttleRates, m_throttle, circuitCode, agentID, remoteEndPoint); + LLUDPClient udpClient = new LLUDPClient(this, m_throttleRates, m_throttle, circuitCode, agentID, remoteEndPoint, m_defaultRTO, m_maxRTO); IClientAPI existingClient; if (!m_scene.TryGetClient(agentID, out existingClient)) -- cgit v1.1