diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 9325b12220..6ff7f012fa 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -226,18 +226,6 @@ namespace OpenSim "Force the update of all objects on clients", HandleForceUpdate); - m_console.Commands.AddCommand("Debug", false, "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.\n" - + "If an avatar name is given then only packets from that avatar are logged", - Debug); - m_console.Commands.AddCommand("General", false, "change region", "change region ", "Change current console region", ChangeSelectedRegion); @@ -701,45 +689,6 @@ namespace OpenSim RefreshPrompt(); } - /// - /// Turn on some debugging values for OpenSim. - /// - /// - protected void Debug(string module, string[] args) - { - if (args.Length == 1) - return; - - 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)) - { - SceneManager.SetDebugPacketLevelOnCurrentScene(newDebug, name); - // We provide user information elsewhere if any clients had their debug level set. -// MainConsole.Instance.OutputFormat("Debug packet level set to {0}", newDebug); - } - else - { - MainConsole.Instance.Output("Usage: debug packet 0..255"); - } - } - - break; - - default: - MainConsole.Instance.Output("Unknown debug command"); - break; - } - } - // see BaseOpenSimServer /// /// Many commands list objects for debugging. Some of the types are listed here diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 8eb2e066aa..ff31ef541b 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -512,6 +512,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (UsePools) EnablePoolStats(); + MainConsole.Instance.Commands.AddCommand( + "Debug", false, "debug lludp packet", + "debug lludp 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.\n" + + "If an avatar name is given then only packets from that avatar are logged", + HandlePacketCommand); + MainConsole.Instance.Commands.AddCommand( "Debug", false, @@ -553,8 +566,45 @@ namespace OpenSim.Region.ClientStack.LindenUDP HandleStatusCommand); } + private void HandlePacketCommand(string module, string[] args) + { + if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_scene) + return; + + string name = null; + + if (args.Length == 6) + name = string.Format("{0} {1}", args[4], args[5]); + + if (args.Length > 3) + { + int newDebug; + if (int.TryParse(args[3], out newDebug)) + { + m_scene.ForEachScenePresence(sp => + { + if (name == null || sp.Name == name) + { + m_log.DebugFormat( + "Packet debug for {0} ({1}) set to {2} in {3}", + sp.Name, sp.IsChildAgent ? "child" : "root", newDebug, m_scene.Name); + + sp.ControllingClient.DebugPacketLevel = newDebug; + } + }); + } + else + { + MainConsole.Instance.Output("Usage: debug lludp packet 0..255 [ ]"); + } + } + } + private void HandleStartCommand(string module, string[] args) { + if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_scene) + return; + if (args.Length != 4) { MainConsole.Instance.Output("Usage: debug lludp start "); @@ -572,6 +622,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP private void HandleStopCommand(string module, string[] args) { + if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_scene) + return; + if (args.Length != 4) { MainConsole.Instance.Output("Usage: debug lludp stop "); @@ -589,6 +642,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP private void HandlePoolCommand(string module, string[] args) { + if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_scene) + return; + if (args.Length != 4) { MainConsole.Instance.Output("Usage: debug lludp pool "); @@ -621,6 +677,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP private void HandleStatusCommand(string module, string[] args) { + if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_scene) + return; + MainConsole.Instance.OutputFormat( "IN LLUDP packet processing for {0} is {1}", m_scene.Name, IsRunningInbound ? "enabled" : "disabled"); diff --git a/OpenSim/Region/Framework/Scenes/SceneManager.cs b/OpenSim/Region/Framework/Scenes/SceneManager.cs index 780bd01756..28f7896c33 100644 --- a/OpenSim/Region/Framework/Scenes/SceneManager.cs +++ b/OpenSim/Region/Framework/Scenes/SceneManager.cs @@ -477,29 +477,6 @@ namespace OpenSim.Region.Framework.Scenes return false; } - /// - /// Set the debug packet level on each current scene. This level governs which packets are printed out to the - /// console. - /// - /// - /// Name of avatar to debug - public void SetDebugPacketLevelOnCurrentScene(int newDebug, string name) - { - ForEachSelectedScene(scene => - scene.ForEachScenePresence(sp => - { - if (name == null || sp.Name == name) - { - m_log.DebugFormat( - "Packet debug for {0} ({1}) set to {2}", - sp.Name, sp.IsChildAgent ? "child" : "root", newDebug); - - sp.ControllingClient.DebugPacketLevel = newDebug; - } - }) - ); - } - public List GetCurrentSceneAvatars() { List avatars = new List();