From ccca0059695e0321ae1aa223c9e8b89cc141b58f Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 2 Jul 2013 13:29:44 -0700 Subject: HG: close a loophole by which if something was wrong with the ServiceURLs it resulted in never ending asset requests --- OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack/Linden') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs b/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs index a168bfe..4d0568d 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs @@ -421,7 +421,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // foreign user is visiting, we need to try again after the first fail to the local // asset service. string assetServerURL = string.Empty; - if (InventoryAccessModule.IsForeignUser(AgentID, out assetServerURL)) + if (InventoryAccessModule.IsForeignUser(AgentID, out assetServerURL) && !string.IsNullOrEmpty(assetServerURL)) { if (!assetServerURL.EndsWith("/") && !assetServerURL.EndsWith("=")) assetServerURL = assetServerURL + "/"; -- cgit v1.1 From 25889b2d7ef08b27591aa61ab4950bdbc856d7a5 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 4 Jul 2013 00:02:53 +0100 Subject: change "debug packet" command to "debug lludp packet" to conform with other "debug lludp" options also moves the implementing code into LLUDPServer.cs along with other debug commands from OpenSim.cs gets all debug lludp commands to only activate for the set scene if not root --- .../Region/ClientStack/Linden/UDP/LLUDPServer.cs | 59 ++++++++++++++++++++++ 1 file changed, 59 insertions(+) (limited to 'OpenSim/Region/ClientStack/Linden') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 8eb2e06..ff31ef5 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -513,6 +513,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP 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, "debug lludp start", @@ -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"); -- cgit v1.1 From 16f40c1a15454fd6b093ae901c307670f12602fe Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 4 Jul 2013 17:29:53 +0100 Subject: Add --default option to "debug lludp packet" command to allow packet logging to be performed immediately from client start --- .../Region/ClientStack/Linden/UDP/LLUDPServer.cs | 69 ++++++++++++++++------ 1 file changed, 52 insertions(+), 17 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index ff31ef5..82fad11 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -34,6 +34,7 @@ using System.Net.Sockets; using System.Reflection; using System.Threading; using log4net; +using NDesk.Options; using Nini.Config; using OpenMetaverse.Packets; using OpenSim.Framework; @@ -102,10 +103,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// public class LLUDPServer : OpenSimUDPBase { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + /// Maximum transmission unit, or UDP packet size, for the LLUDP protocol public const int MTU = 1400; - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + /// + /// Default packet debug level given to new clients + /// + public int DefaultClientPacketDebugLevel { get; set; } /// The measured resolution of Environment.TickCount public readonly float TickCountResolution; @@ -514,7 +520,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP MainConsole.Instance.Commands.AddCommand( "Debug", false, "debug lludp packet", - "debug lludp packet [ ]", + "debug lludp packet [--default] [ ]", "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" @@ -522,7 +528,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP + "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", + + "If --default is specified then the level becomes the default logging level for all subsequent agents.\n" + + "In this case, you cannot also specify an avatar name.\n" + + "If an avatar name is given then only packets from that avatar are logged.", HandlePacketCommand); MainConsole.Instance.Commands.AddCommand( @@ -571,31 +579,54 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_scene) return; + bool setAsDefaultLevel = false; + OptionSet optionSet = new OptionSet().Add("default", o => setAsDefaultLevel = o != null); + List filteredArgs = optionSet.Parse(args); + string name = null; - if (args.Length == 6) - name = string.Format("{0} {1}", args[4], args[5]); + if (filteredArgs.Count == 6) + { + if (!setAsDefaultLevel) + { + name = string.Format("{0} {1}", filteredArgs[4], filteredArgs[5]); + } + else + { + MainConsole.Instance.OutputFormat("ERROR: Cannot specify a user name when setting default logging level"); + return; + } + } - if (args.Length > 3) + if (filteredArgs.Count > 3) { int newDebug; - if (int.TryParse(args[3], out newDebug)) + if (int.TryParse(filteredArgs[3], out newDebug)) { - m_scene.ForEachScenePresence(sp => + if (setAsDefaultLevel) + { + DefaultClientPacketDebugLevel = newDebug; + MainConsole.Instance.OutputFormat( + "Debug packet debug for new clients set to {0}", DefaultClientPacketDebugLevel); + } + else { - if (name == null || sp.Name == name) + m_scene.ForEachScenePresence(sp => { - 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; - } - }); + if (name == null || sp.Name == name) + { + MainConsole.Instance.OutputFormat( + "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 [ ]"); + MainConsole.Instance.Output("Usage: debug lludp packet [--default] 0..255 [ ]"); } } } @@ -687,6 +718,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP "OUT LLUDP packet processing for {0} is {1}", m_scene.Name, IsRunningOutbound ? "enabled" : "disabled"); MainConsole.Instance.OutputFormat("LLUDP pools in {0} are {1}", m_scene.Name, UsePools ? "on" : "off"); + + MainConsole.Instance.OutputFormat( + "Packet debug level for new clients is {0}", DefaultClientPacketDebugLevel); } public bool HandlesRegion(Location x) @@ -1533,6 +1567,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP client = new LLClientView(m_scene, this, udpClient, sessionInfo, agentID, sessionID, circuitCode); client.OnLogout += LogoutHandler; + client.DebugPacketLevel = DefaultClientPacketDebugLevel; ((LLClientView)client).DisableFacelights = m_disableFacelights; -- cgit v1.1