diff options
author | Justin Clark-Casey (justincc) | 2014-08-19 18:34:17 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2014-08-19 18:34:17 +0100 |
commit | 298376d5c7a8207f3c42f950cf9c212950038477 (patch) | |
tree | 87a1bbb16b146ec03a9fa57c03940f44c4fb9a77 | |
parent | minor:Give console feedback when we sit or stand pCampbot bots. (diff) | |
download | opensim-SC-298376d5c7a8207f3c42f950cf9c212950038477.zip opensim-SC-298376d5c7a8207f3c42f950cf9c212950038477.tar.gz opensim-SC-298376d5c7a8207f3c42f950cf9c212950038477.tar.bz2 opensim-SC-298376d5c7a8207f3c42f950cf9c212950038477.tar.xz |
Add "debug lludp drop out <add|remove> <packet-name>" 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.
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 27 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 49 |
2 files changed, 76 insertions, 0 deletions
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 | |||
12341 | /// provide your own method.</param> | 12341 | /// provide your own method.</param> |
12342 | protected void OutPacket(Packet packet, ThrottleOutPacketType throttlePacketType, bool doAutomaticSplitting, UnackedPacketMethod method) | 12342 | protected void OutPacket(Packet packet, ThrottleOutPacketType throttlePacketType, bool doAutomaticSplitting, UnackedPacketMethod method) |
12343 | { | 12343 | { |
12344 | if (m_outPacketsToDrop != null) | ||
12345 | if (m_outPacketsToDrop.Contains(packet.Type.ToString())) | ||
12346 | return; | ||
12347 | |||
12344 | if (DebugPacketLevel > 0) | 12348 | if (DebugPacketLevel > 0) |
12345 | { | 12349 | { |
12346 | bool logPacket = true; | 12350 | bool logPacket = true; |
@@ -13123,5 +13127,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
13123 | eq.Enqueue(BuildEvent("BulkUpdateInventory", | 13127 | eq.Enqueue(BuildEvent("BulkUpdateInventory", |
13124 | llsd), AgentId); | 13128 | llsd), AgentId); |
13125 | } | 13129 | } |
13130 | |||
13131 | private HashSet<string> m_outPacketsToDrop; | ||
13132 | |||
13133 | public bool AddOutPacketToDropSet(string packetName) | ||
13134 | { | ||
13135 | if (m_outPacketsToDrop == null) | ||
13136 | m_outPacketsToDrop = new HashSet<string>(); | ||
13137 | |||
13138 | return m_outPacketsToDrop.Add(packetName); | ||
13139 | } | ||
13140 | |||
13141 | public bool RemoveOutPacketFromDropSet(string packetName) | ||
13142 | { | ||
13143 | if (m_outPacketsToDrop == null) | ||
13144 | return false; | ||
13145 | |||
13146 | return m_outPacketsToDrop.Remove(packetName); | ||
13147 | } | ||
13148 | |||
13149 | public HashSet<string> GetOutPacketDropSet() | ||
13150 | { | ||
13151 | return new HashSet<string>(m_outPacketsToDrop); | ||
13152 | } | ||
13126 | } | 13153 | } |
13127 | } | 13154 | } |
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 | |||
698 | HandlePacketCommand); | 698 | HandlePacketCommand); |
699 | 699 | ||
700 | MainConsole.Instance.Commands.AddCommand( | 700 | MainConsole.Instance.Commands.AddCommand( |
701 | "Debug", false, "debug lludp drop out", | ||
702 | "debug lludp drop out <add|remove> <packet-name>", | ||
703 | "Drop all outbound packets that match the given name", | ||
704 | "For test purposes.", | ||
705 | HandleDropCommand); | ||
706 | |||
707 | MainConsole.Instance.Commands.AddCommand( | ||
701 | "Debug", | 708 | "Debug", |
702 | false, | 709 | false, |
703 | "debug lludp start", | 710 | "debug lludp start", |
@@ -820,6 +827,48 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
820 | } | 827 | } |
821 | } | 828 | } |
822 | 829 | ||
830 | private void HandleDropCommand(string module, string[] args) | ||
831 | { | ||
832 | if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != Scene) | ||
833 | return; | ||
834 | |||
835 | if (args.Length != 6) | ||
836 | { | ||
837 | MainConsole.Instance.Output("Usage: debug lludp drop out <add|remove> <packet-name>"); | ||
838 | return; | ||
839 | } | ||
840 | |||
841 | string subCommand = args[4]; | ||
842 | string packetName = args[5]; | ||
843 | |||
844 | if (subCommand == "add") | ||
845 | { | ||
846 | MainConsole.Instance.OutputFormat( | ||
847 | "Adding packet {0} to out drop list for all connections in {1}", packetName, Scene.Name); | ||
848 | |||
849 | Scene.ForEachScenePresence( | ||
850 | sp => | ||
851 | { | ||
852 | LLClientView llcv = (LLClientView)sp.ControllingClient; | ||
853 | llcv.AddOutPacketToDropSet(packetName); | ||
854 | } | ||
855 | ); | ||
856 | } | ||
857 | else if (subCommand == "remove") | ||
858 | { | ||
859 | MainConsole.Instance.OutputFormat( | ||
860 | "Removing packet {0} from out drop list for all connections in {1}", packetName, Scene.Name); | ||
861 | |||
862 | Scene.ForEachScenePresence( | ||
863 | sp => | ||
864 | { | ||
865 | LLClientView llcv = (LLClientView)sp.ControllingClient; | ||
866 | llcv.RemoveOutPacketFromDropSet(packetName); | ||
867 | } | ||
868 | ); | ||
869 | } | ||
870 | } | ||
871 | |||
823 | private void HandleStartCommand(string module, string[] args) | 872 | private void HandleStartCommand(string module, string[] args) |
824 | { | 873 | { |
825 | if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != Scene) | 874 | if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != Scene) |