Extend drop command to "debug lludp drop <in|out>..." to allow drop of inbound packets.
For test/debug purposes.bullet-2.82
parent
298376d5c7
commit
4e03d352c3
|
@ -12403,6 +12403,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
/// <param name="Pack">OpenMetaverse.packet</param>
|
||||
public void ProcessInPacket(Packet packet)
|
||||
{
|
||||
if (m_inPacketsToDrop != null)
|
||||
if (m_inPacketsToDrop.Contains(packet.Type.ToString()))
|
||||
return;
|
||||
|
||||
if (DebugPacketLevel > 0)
|
||||
{
|
||||
bool logPacket = true;
|
||||
|
@ -13150,5 +13154,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -698,9 +698,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
HandlePacketCommand);
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand(
|
||||
"Debug", false, "debug lludp drop out",
|
||||
"debug lludp drop out <add|remove> <packet-name>",
|
||||
"Drop all outbound packets that match the given name",
|
||||
"Debug", false, "debug lludp drop",
|
||||
"debug lludp drop <in|out> <add|remove> <packet-name>",
|
||||
"Drop all in or outbound packets that match the given name",
|
||||
"For test purposes.",
|
||||
HandleDropCommand);
|
||||
|
||||
|
@ -834,22 +834,27 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
if (direction == "in")
|
||||
llcv.AddInPacketToDropSet(packetName);
|
||||
else if (direction == "out")
|
||||
llcv.AddOutPacketToDropSet(packetName);
|
||||
}
|
||||
);
|
||||
|
@ -857,12 +862,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
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;
|
||||
|
||||
if (direction == "in")
|
||||
llcv.RemoveInPacketFromDropSet(packetName);
|
||||
else if (direction == "out")
|
||||
llcv.RemoveOutPacketFromDropSet(packetName);
|
||||
}
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue