Extend drop command to "debug lludp drop <in|out>..." to allow drop of inbound packets.

For test/debug purposes.
bullet-2.82
Justin Clark-Casey (justincc) 2014-08-19 18:43:21 +01:00
parent 298376d5c7
commit 4e03d352c3
2 changed files with 44 additions and 8 deletions

View File

@ -12403,6 +12403,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// <param name="Pack">OpenMetaverse.packet</param> /// <param name="Pack">OpenMetaverse.packet</param>
public void ProcessInPacket(Packet packet) public void ProcessInPacket(Packet packet)
{ {
if (m_inPacketsToDrop != null)
if (m_inPacketsToDrop.Contains(packet.Type.ToString()))
return;
if (DebugPacketLevel > 0) if (DebugPacketLevel > 0)
{ {
bool logPacket = true; bool logPacket = true;
@ -13150,5 +13154,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{ {
return new HashSet<string>(m_outPacketsToDrop); return new HashSet<string>(m_outPacketsToDrop);
} }
private HashSet<string> m_inPacketsToDrop;
public bool AddInPacketToDropSet(string packetName)
{
if (m_inPacketsToDrop == null)
m_inPacketsToDrop = new HashSet<string>();
return m_inPacketsToDrop.Add(packetName);
}
public bool RemoveInPacketFromDropSet(string packetName)
{
if (m_inPacketsToDrop == null)
return false;
return m_inPacketsToDrop.Remove(packetName);
}
public HashSet<string> GetInPacketDropSet()
{
return new HashSet<string>(m_inPacketsToDrop);
}
} }
} }

View File

@ -698,9 +698,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
HandlePacketCommand); HandlePacketCommand);
MainConsole.Instance.Commands.AddCommand( MainConsole.Instance.Commands.AddCommand(
"Debug", false, "debug lludp drop out", "Debug", false, "debug lludp drop",
"debug lludp drop out <add|remove> <packet-name>", "debug lludp drop <in|out> <add|remove> <packet-name>",
"Drop all outbound packets that match the given name", "Drop all in or outbound packets that match the given name",
"For test purposes.", "For test purposes.",
HandleDropCommand); HandleDropCommand);
@ -834,22 +834,27 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (args.Length != 6) if (args.Length != 6)
{ {
MainConsole.Instance.Output("Usage: debug lludp drop out <add|remove> <packet-name>"); MainConsole.Instance.Output("Usage: debug lludp drop <in|out> <add|remove> <packet-name>");
return; return;
} }
string direction = args[3];
string subCommand = args[4]; string subCommand = args[4];
string packetName = args[5]; string packetName = args[5];
if (subCommand == "add") if (subCommand == "add")
{ {
MainConsole.Instance.OutputFormat( 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( Scene.ForEachScenePresence(
sp => sp =>
{ {
LLClientView llcv = (LLClientView)sp.ControllingClient; LLClientView llcv = (LLClientView)sp.ControllingClient;
if (direction == "in")
llcv.AddInPacketToDropSet(packetName);
else if (direction == "out")
llcv.AddOutPacketToDropSet(packetName); llcv.AddOutPacketToDropSet(packetName);
} }
); );
@ -857,12 +862,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
else if (subCommand == "remove") else if (subCommand == "remove")
{ {
MainConsole.Instance.OutputFormat( 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( Scene.ForEachScenePresence(
sp => sp =>
{ {
LLClientView llcv = (LLClientView)sp.ControllingClient; LLClientView llcv = (LLClientView)sp.ControllingClient;
if (direction == "in")
llcv.RemoveInPacketFromDropSet(packetName);
else if (direction == "out")
llcv.RemoveOutPacketFromDropSet(packetName); llcv.RemoveOutPacketFromDropSet(packetName);
} }
); );