From aeb4ff02744573cb91e8991bf9df81412b80e156 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Mon, 17 Oct 2011 20:58:23 +0100 Subject: [PATCH] Allow an avatar to be explicitly named to the "debug packet" command --- OpenSim/Region/Application/OpenSim.cs | 12 ++++++++---- OpenSim/Region/Framework/Scenes/SceneManager.cs | 5 +++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 09958b1181..eea008b163 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -216,14 +216,15 @@ namespace OpenSim HandleForceUpdate); m_console.Commands.AddCommand("region", false, "debug packet", - "debug packet ", + "debug packet [ ]", "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; diff --git a/OpenSim/Region/Framework/Scenes/SceneManager.cs b/OpenSim/Region/Framework/Scenes/SceneManager.cs index c91744cfde..a58b87d9d1 100644 --- a/OpenSim/Region/Framework/Scenes/SceneManager.cs +++ b/OpenSim/Region/Framework/Scenes/SceneManager.cs @@ -452,14 +452,15 @@ namespace OpenSim.Region.Framework.Scenes /// console. /// /// - public void SetDebugPacketLevelOnCurrentScene(int newDebug) + /// Name of avatar to debug + 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,