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.
0.8-extended
Justin Clark-Casey (justincc) 2014-08-19 18:34:17 +01:00 committed by Justin Clark-Casey
parent 4f12d5a3f1
commit e0cb3ef959
2 changed files with 76 additions and 0 deletions

View File

@ -12265,6 +12265,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// provide your own method.</param> /// provide your own method.</param>
protected void OutPacket(Packet packet, ThrottleOutPacketType throttlePacketType, bool doAutomaticSplitting, UnackedPacketMethod 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) if (DebugPacketLevel > 0)
{ {
bool logPacket = true; bool logPacket = true;
@ -13047,5 +13051,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP
eq.Enqueue(BuildEvent("BulkUpdateInventory", eq.Enqueue(BuildEvent("BulkUpdateInventory",
llsd), AgentId); llsd), AgentId);
} }
private HashSet<string> m_outPacketsToDrop;
public bool AddOutPacketToDropSet(string packetName)
{
if (m_outPacketsToDrop == null)
m_outPacketsToDrop = new HashSet<string>();
return m_outPacketsToDrop.Add(packetName);
}
public bool RemoveOutPacketFromDropSet(string packetName)
{
if (m_outPacketsToDrop == null)
return false;
return m_outPacketsToDrop.Remove(packetName);
}
public HashSet<string> GetOutPacketDropSet()
{
return new HashSet<string>(m_outPacketsToDrop);
}
} }
} }

View File

@ -697,6 +697,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
+ "If an avatar name is given then only packets from that avatar are logged.", + "If an avatar name is given then only packets from that avatar are logged.",
HandlePacketCommand); 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",
"For test purposes.",
HandleDropCommand);
MainConsole.Instance.Commands.AddCommand( MainConsole.Instance.Commands.AddCommand(
"Debug", "Debug",
false, 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 <add|remove> <packet-name>");
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) private void HandleStartCommand(string module, string[] args)
{ {
if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != Scene) if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != Scene)