From 30e04ee79ceb4c90b6ee7fc5f3c17e946a7343b5 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 19 Aug 2014 18:43:21 +0100 Subject: [PATCH] Extend drop command to "debug lludp drop ..." to allow drop of inbound packets. For test/debug purposes. --- .../ClientStack/Linden/UDP/LLClientView.cs | 27 +++++++++++++++++++ .../ClientStack/Linden/UDP/LLUDPServer.cs | 25 +++++++++++------ 2 files changed, 44 insertions(+), 8 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 3e67d468b3..e0d57b7013 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -12327,6 +12327,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// OpenMetaverse.packet public void ProcessInPacket(Packet packet) { + if (m_inPacketsToDrop != null) + if (m_inPacketsToDrop.Contains(packet.Type.ToString())) + return; + if (DebugPacketLevel > 0) { bool logPacket = true; @@ -13074,5 +13078,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP { return new HashSet(m_outPacketsToDrop); } + + private HashSet m_inPacketsToDrop; + + public bool AddInPacketToDropSet(string packetName) + { + if (m_inPacketsToDrop == null) + m_inPacketsToDrop = new HashSet(); + + return m_inPacketsToDrop.Add(packetName); + } + + public bool RemoveInPacketFromDropSet(string packetName) + { + if (m_inPacketsToDrop == null) + return false; + + return m_inPacketsToDrop.Remove(packetName); + } + + public HashSet GetInPacketDropSet() + { + return new HashSet(m_inPacketsToDrop); + } } } diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 549573b048..87aa37dad1 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -698,9 +698,9 @@ 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", + "Debug", false, "debug lludp drop", + "debug lludp drop ", + "Drop all in or outbound packets that match the given name", "For test purposes.", HandleDropCommand); @@ -834,36 +834,45 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (args.Length != 6) { - MainConsole.Instance.Output("Usage: debug lludp drop out "); + MainConsole.Instance.Output("Usage: debug lludp drop "); return; } + string direction = args[3]; 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); + "Adding packet {0} to {1} drop list for all connections in {2}", direction, packetName, Scene.Name); Scene.ForEachScenePresence( sp => { LLClientView llcv = (LLClientView)sp.ControllingClient; - llcv.AddOutPacketToDropSet(packetName); + + if (direction == "in") + llcv.AddInPacketToDropSet(packetName); + else if (direction == "out") + 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); + "Removing packet {0} from {1} drop list for all connections in {2}", direction, packetName, Scene.Name); Scene.ForEachScenePresence( sp => { LLClientView llcv = (LLClientView)sp.ControllingClient; - llcv.RemoveOutPacketFromDropSet(packetName); + + if (direction == "in") + llcv.RemoveInPacketFromDropSet(packetName); + else if (direction == "out") + llcv.RemoveOutPacketFromDropSet(packetName); } ); }