Allow an avatar to be explicitly named to the "debug packet" command

0.7.2-post-fixes
Justin Clark-Casey (justincc) 2011-10-17 20:58:23 +01:00
parent 31ac7571f4
commit c06cd3b2b9
2 changed files with 11 additions and 6 deletions

View File

@ -216,14 +216,15 @@ namespace OpenSim
HandleForceUpdate);
m_console.Commands.AddCommand("region", false, "debug packet",
"debug packet <level>",
"debug packet <level> [<avatar-first-name> <avatar-last-name>]",
"Turn on packet debugging",
"If level > 255 then all incoming and outgoing packets are logged.\n"
+ "If level <= 255 then incoming AgentUpdate and outgoing SimStats and SimulatorViewerTimeMessage packets are not logged.\n"
+ "If level <= 200 then incoming RequestImage and outgoing ImagePacket, ImageData, LayerData and CoarseLocationUpdate packets are not logged.\n"
+ "If level <= 100 then incoming ViewerEffect and AgentAnimation and outgoing ViewerEffect and AvatarAnimation packets are not logged.\n"
+ "If level <= 50 then outgoing ImprovedTerseObjectUpdate packets are not logged.\n"
+ "If level <= 0 then no packets are logged.",
+ "If level <= 0 then no packets are logged.\n"
+ "If an avatar name is given then only packets from that avatar are logged",
Debug);
m_console.Commands.AddCommand("region", false, "debug scene",
@ -845,18 +846,21 @@ namespace OpenSim
switch (args[1])
{
case "packet":
string name = null;
if (args.Length == 5)
name = string.Format("{0} {1}", args[3], args[4]);
if (args.Length > 2)
{
int newDebug;
if (int.TryParse(args[2], out newDebug))
{
m_sceneManager.SetDebugPacketLevelOnCurrentScene(newDebug);
m_sceneManager.SetDebugPacketLevelOnCurrentScene(newDebug, name);
}
else
{
MainConsole.Instance.Output("packet debug should be 0..255");
}
MainConsole.Instance.Output(String.Format("New packet debug: {0}", newDebug));
}
break;

View File

@ -452,14 +452,15 @@ namespace OpenSim.Region.Framework.Scenes
/// console.
/// </summary>
/// <param name="newDebug"></param>
public void SetDebugPacketLevelOnCurrentScene(int newDebug)
/// <param name="name">Name of avatar to debug</param>
public void SetDebugPacketLevelOnCurrentScene(int newDebug, string name)
{
ForEachCurrentScene(
delegate(Scene scene)
{
scene.ForEachScenePresence(delegate(ScenePresence scenePresence)
{
if (!scenePresence.IsChildAgent)
if (!scenePresence.IsChildAgent && (name == null || scenePresence.Name == name))
{
m_log.DebugFormat("Packet debug for {0} {1} set to {2}",
scenePresence.Firstname,