diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 826a558b37..3e67d468b3 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -12265,6 +12265,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; @@ -13047,5 +13051,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 3c9bb1bd82..549573b048 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -697,6 +697,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP + "If an avatar name is given then only packets from that avatar are logged.", 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, @@ -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)