diff options
author | Justin Clark-Casey (justincc) | 2014-08-19 18:43:21 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2014-08-19 18:43:21 +0100 |
commit | 4e03d352c356ca9ebe22a1ac623dc85f4b7922e8 (patch) | |
tree | 58fa4db136d12d0fe0efc1d875df3268d5fbeef5 /OpenSim/Region/ClientStack/Linden | |
parent | Add "debug lludp drop out <add|remove> <packet-name>" console command for deb... (diff) | |
download | opensim-SC_OLD-4e03d352c356ca9ebe22a1ac623dc85f4b7922e8.zip opensim-SC_OLD-4e03d352c356ca9ebe22a1ac623dc85f4b7922e8.tar.gz opensim-SC_OLD-4e03d352c356ca9ebe22a1ac623dc85f4b7922e8.tar.bz2 opensim-SC_OLD-4e03d352c356ca9ebe22a1ac623dc85f4b7922e8.tar.xz |
Extend drop command to "debug lludp drop <in|out>..." to allow drop of inbound packets.
For test/debug purposes.
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 27 | ||||
-rw-r--r-- | OpenSim/Region/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 15a90af..c839c05 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -12403,6 +12403,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
12403 | /// <param name="Pack">OpenMetaverse.packet</param> | 12403 | /// <param name="Pack">OpenMetaverse.packet</param> |
12404 | public void ProcessInPacket(Packet packet) | 12404 | public void ProcessInPacket(Packet packet) |
12405 | { | 12405 | { |
12406 | if (m_inPacketsToDrop != null) | ||
12407 | if (m_inPacketsToDrop.Contains(packet.Type.ToString())) | ||
12408 | return; | ||
12409 | |||
12406 | if (DebugPacketLevel > 0) | 12410 | if (DebugPacketLevel > 0) |
12407 | { | 12411 | { |
12408 | bool logPacket = true; | 12412 | bool logPacket = true; |
@@ -13150,5 +13154,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
13150 | { | 13154 | { |
13151 | return new HashSet<string>(m_outPacketsToDrop); | 13155 | return new HashSet<string>(m_outPacketsToDrop); |
13152 | } | 13156 | } |
13157 | |||
13158 | private HashSet<string> m_inPacketsToDrop; | ||
13159 | |||
13160 | public bool AddInPacketToDropSet(string packetName) | ||
13161 | { | ||
13162 | if (m_inPacketsToDrop == null) | ||
13163 | m_inPacketsToDrop = new HashSet<string>(); | ||
13164 | |||
13165 | return m_inPacketsToDrop.Add(packetName); | ||
13166 | } | ||
13167 | |||
13168 | public bool RemoveInPacketFromDropSet(string packetName) | ||
13169 | { | ||
13170 | if (m_inPacketsToDrop == null) | ||
13171 | return false; | ||
13172 | |||
13173 | return m_inPacketsToDrop.Remove(packetName); | ||
13174 | } | ||
13175 | |||
13176 | public HashSet<string> GetInPacketDropSet() | ||
13177 | { | ||
13178 | return new HashSet<string>(m_inPacketsToDrop); | ||
13179 | } | ||
13153 | } | 13180 | } |
13154 | } | 13181 | } |
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 549573b..87aa37d 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 | |||
698 | HandlePacketCommand); | 698 | HandlePacketCommand); |
699 | 699 | ||
700 | MainConsole.Instance.Commands.AddCommand( | 700 | MainConsole.Instance.Commands.AddCommand( |
701 | "Debug", false, "debug lludp drop out", | 701 | "Debug", false, "debug lludp drop", |
702 | "debug lludp drop out <add|remove> <packet-name>", | 702 | "debug lludp drop <in|out> <add|remove> <packet-name>", |
703 | "Drop all outbound packets that match the given name", | 703 | "Drop all in or outbound packets that match the given name", |
704 | "For test purposes.", | 704 | "For test purposes.", |
705 | HandleDropCommand); | 705 | HandleDropCommand); |
706 | 706 | ||
@@ -834,36 +834,45 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
834 | 834 | ||
835 | if (args.Length != 6) | 835 | if (args.Length != 6) |
836 | { | 836 | { |
837 | MainConsole.Instance.Output("Usage: debug lludp drop out <add|remove> <packet-name>"); | 837 | MainConsole.Instance.Output("Usage: debug lludp drop <in|out> <add|remove> <packet-name>"); |
838 | return; | 838 | return; |
839 | } | 839 | } |
840 | 840 | ||
841 | string direction = args[3]; | ||
841 | string subCommand = args[4]; | 842 | string subCommand = args[4]; |
842 | string packetName = args[5]; | 843 | string packetName = args[5]; |
843 | 844 | ||
844 | if (subCommand == "add") | 845 | if (subCommand == "add") |
845 | { | 846 | { |
846 | MainConsole.Instance.OutputFormat( | 847 | MainConsole.Instance.OutputFormat( |
847 | "Adding packet {0} to out drop list for all connections in {1}", packetName, Scene.Name); | 848 | "Adding packet {0} to {1} drop list for all connections in {2}", direction, packetName, Scene.Name); |
848 | 849 | ||
849 | Scene.ForEachScenePresence( | 850 | Scene.ForEachScenePresence( |
850 | sp => | 851 | sp => |
851 | { | 852 | { |
852 | LLClientView llcv = (LLClientView)sp.ControllingClient; | 853 | LLClientView llcv = (LLClientView)sp.ControllingClient; |
853 | llcv.AddOutPacketToDropSet(packetName); | 854 | |
855 | if (direction == "in") | ||
856 | llcv.AddInPacketToDropSet(packetName); | ||
857 | else if (direction == "out") | ||
858 | llcv.AddOutPacketToDropSet(packetName); | ||
854 | } | 859 | } |
855 | ); | 860 | ); |
856 | } | 861 | } |
857 | else if (subCommand == "remove") | 862 | else if (subCommand == "remove") |
858 | { | 863 | { |
859 | MainConsole.Instance.OutputFormat( | 864 | MainConsole.Instance.OutputFormat( |
860 | "Removing packet {0} from out drop list for all connections in {1}", packetName, Scene.Name); | 865 | "Removing packet {0} from {1} drop list for all connections in {2}", direction, packetName, Scene.Name); |
861 | 866 | ||
862 | Scene.ForEachScenePresence( | 867 | Scene.ForEachScenePresence( |
863 | sp => | 868 | sp => |
864 | { | 869 | { |
865 | LLClientView llcv = (LLClientView)sp.ControllingClient; | 870 | LLClientView llcv = (LLClientView)sp.ControllingClient; |
866 | llcv.RemoveOutPacketFromDropSet(packetName); | 871 | |
872 | if (direction == "in") | ||
873 | llcv.RemoveInPacketFromDropSet(packetName); | ||
874 | else if (direction == "out") | ||
875 | llcv.RemoveOutPacketFromDropSet(packetName); | ||
867 | } | 876 | } |
868 | ); | 877 | ); |
869 | } | 878 | } |