From 298376d5c7a8207f3c42f950cf9c212950038477 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 19 Aug 2014 18:34:17 +0100 Subject: Add "debug lludp drop out " console command for debug/test purposes. This drops all outbound packets that match a given packet name. Can currently only be applied to all connections in a scene. --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 27 ++++++++++++ .../Region/ClientStack/Linden/UDP/LLUDPServer.cs | 49 ++++++++++++++++++++++ 2 files changed, 76 insertions(+) (limited to 'OpenSim') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 9d6085d..15a90af 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -12341,6 +12341,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// provide your own method. protected void OutPacket(Packet packet, ThrottleOutPacketType throttlePacketType, bool doAutomaticSplitting, UnackedPacketMethod method) { + if (m_outPacketsToDrop != null) + if (m_outPacketsToDrop.Contains(packet.Type.ToString())) + return; + if (DebugPacketLevel > 0) { bool logPacket = true; @@ -13123,5 +13127,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP eq.Enqueue(BuildEvent("BulkUpdateInventory", llsd), AgentId); } + + private HashSet m_outPacketsToDrop; + + public bool AddOutPacketToDropSet(string packetName) + { + if (m_outPacketsToDrop == null) + m_outPacketsToDrop = new HashSet(); + + return m_outPacketsToDrop.Add(packetName); + } + + public bool RemoveOutPacketFromDropSet(string packetName) + { + if (m_outPacketsToDrop == null) + return false; + + return m_outPacketsToDrop.Remove(packetName); + } + + public HashSet GetOutPacketDropSet() + { + return new HashSet(m_outPacketsToDrop); + } } } diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 3c9bb1b..549573b 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -698,6 +698,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP HandlePacketCommand); MainConsole.Instance.Commands.AddCommand( + "Debug", false, "debug lludp drop out", + "debug lludp drop out ", + "Drop all outbound packets that match the given name", + "For test purposes.", + HandleDropCommand); + + MainConsole.Instance.Commands.AddCommand( "Debug", false, "debug lludp start", @@ -820,6 +827,48 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } + private void HandleDropCommand(string module, string[] args) + { + if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != Scene) + return; + + if (args.Length != 6) + { + MainConsole.Instance.Output("Usage: debug lludp drop out "); + return; + } + + string subCommand = args[4]; + string packetName = args[5]; + + if (subCommand == "add") + { + MainConsole.Instance.OutputFormat( + "Adding packet {0} to out drop list for all connections in {1}", packetName, Scene.Name); + + Scene.ForEachScenePresence( + sp => + { + LLClientView llcv = (LLClientView)sp.ControllingClient; + llcv.AddOutPacketToDropSet(packetName); + } + ); + } + else if (subCommand == "remove") + { + MainConsole.Instance.OutputFormat( + "Removing packet {0} from out drop list for all connections in {1}", packetName, Scene.Name); + + Scene.ForEachScenePresence( + sp => + { + LLClientView llcv = (LLClientView)sp.ControllingClient; + llcv.RemoveOutPacketFromDropSet(packetName); + } + ); + } + } + private void HandleStartCommand(string module, string[] args) { if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != Scene) -- cgit v1.1