diff options
Diffstat (limited to 'OpenSim/Region/ClientStack')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 69 |
1 files changed, 52 insertions, 17 deletions
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; | |||
34 | using System.Reflection; | 34 | using System.Reflection; |
35 | using System.Threading; | 35 | using System.Threading; |
36 | using log4net; | 36 | using log4net; |
37 | using NDesk.Options; | ||
37 | using Nini.Config; | 38 | using Nini.Config; |
38 | using OpenMetaverse.Packets; | 39 | using OpenMetaverse.Packets; |
39 | using OpenSim.Framework; | 40 | using OpenSim.Framework; |
@@ -102,10 +103,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
102 | /// </summary> | 103 | /// </summary> |
103 | public class LLUDPServer : OpenSimUDPBase | 104 | public class LLUDPServer : OpenSimUDPBase |
104 | { | 105 | { |
106 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
107 | |||
105 | /// <summary>Maximum transmission unit, or UDP packet size, for the LLUDP protocol</summary> | 108 | /// <summary>Maximum transmission unit, or UDP packet size, for the LLUDP protocol</summary> |
106 | public const int MTU = 1400; | 109 | public const int MTU = 1400; |
107 | 110 | ||
108 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 111 | /// <summary> |
112 | /// Default packet debug level given to new clients | ||
113 | /// </summary> | ||
114 | public int DefaultClientPacketDebugLevel { get; set; } | ||
109 | 115 | ||
110 | /// <summary>The measured resolution of Environment.TickCount</summary> | 116 | /// <summary>The measured resolution of Environment.TickCount</summary> |
111 | public readonly float TickCountResolution; | 117 | public readonly float TickCountResolution; |
@@ -514,7 +520,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
514 | 520 | ||
515 | MainConsole.Instance.Commands.AddCommand( | 521 | MainConsole.Instance.Commands.AddCommand( |
516 | "Debug", false, "debug lludp packet", | 522 | "Debug", false, "debug lludp packet", |
517 | "debug lludp packet <level> [<avatar-first-name> <avatar-last-name>]", | 523 | "debug lludp packet [--default] <level> [<avatar-first-name> <avatar-last-name>]", |
518 | "Turn on packet debugging", | 524 | "Turn on packet debugging", |
519 | "If level > 255 then all incoming and outgoing packets are logged.\n" | 525 | "If level > 255 then all incoming and outgoing packets are logged.\n" |
520 | + "If level <= 255 then incoming AgentUpdate and outgoing SimStats and SimulatorViewerTimeMessage packets are not logged.\n" | 526 | + "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 | |||
522 | + "If level <= 100 then incoming ViewerEffect and AgentAnimation and outgoing ViewerEffect and AvatarAnimation packets are not logged.\n" | 528 | + "If level <= 100 then incoming ViewerEffect and AgentAnimation and outgoing ViewerEffect and AvatarAnimation packets are not logged.\n" |
523 | + "If level <= 50 then outgoing ImprovedTerseObjectUpdate packets are not logged.\n" | 529 | + "If level <= 50 then outgoing ImprovedTerseObjectUpdate packets are not logged.\n" |
524 | + "If level <= 0 then no packets are logged.\n" | 530 | + "If level <= 0 then no packets are logged.\n" |
525 | + "If an avatar name is given then only packets from that avatar are logged", | 531 | + "If --default is specified then the level becomes the default logging level for all subsequent agents.\n" |
532 | + "In this case, you cannot also specify an avatar name.\n" | ||
533 | + "If an avatar name is given then only packets from that avatar are logged.", | ||
526 | HandlePacketCommand); | 534 | HandlePacketCommand); |
527 | 535 | ||
528 | MainConsole.Instance.Commands.AddCommand( | 536 | MainConsole.Instance.Commands.AddCommand( |
@@ -571,31 +579,54 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
571 | if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_scene) | 579 | if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_scene) |
572 | return; | 580 | return; |
573 | 581 | ||
582 | bool setAsDefaultLevel = false; | ||
583 | OptionSet optionSet = new OptionSet().Add("default", o => setAsDefaultLevel = o != null); | ||
584 | List<string> filteredArgs = optionSet.Parse(args); | ||
585 | |||
574 | string name = null; | 586 | string name = null; |
575 | 587 | ||
576 | if (args.Length == 6) | 588 | if (filteredArgs.Count == 6) |
577 | name = string.Format("{0} {1}", args[4], args[5]); | 589 | { |
590 | if (!setAsDefaultLevel) | ||
591 | { | ||
592 | name = string.Format("{0} {1}", filteredArgs[4], filteredArgs[5]); | ||
593 | } | ||
594 | else | ||
595 | { | ||
596 | MainConsole.Instance.OutputFormat("ERROR: Cannot specify a user name when setting default logging level"); | ||
597 | return; | ||
598 | } | ||
599 | } | ||
578 | 600 | ||
579 | if (args.Length > 3) | 601 | if (filteredArgs.Count > 3) |
580 | { | 602 | { |
581 | int newDebug; | 603 | int newDebug; |
582 | if (int.TryParse(args[3], out newDebug)) | 604 | if (int.TryParse(filteredArgs[3], out newDebug)) |
583 | { | 605 | { |
584 | m_scene.ForEachScenePresence(sp => | 606 | if (setAsDefaultLevel) |
607 | { | ||
608 | DefaultClientPacketDebugLevel = newDebug; | ||
609 | MainConsole.Instance.OutputFormat( | ||
610 | "Debug packet debug for new clients set to {0}", DefaultClientPacketDebugLevel); | ||
611 | } | ||
612 | else | ||
585 | { | 613 | { |
586 | if (name == null || sp.Name == name) | 614 | m_scene.ForEachScenePresence(sp => |
587 | { | 615 | { |
588 | m_log.DebugFormat( | 616 | if (name == null || sp.Name == name) |
589 | "Packet debug for {0} ({1}) set to {2} in {3}", | 617 | { |
590 | sp.Name, sp.IsChildAgent ? "child" : "root", newDebug, m_scene.Name); | 618 | MainConsole.Instance.OutputFormat( |
591 | 619 | "Packet debug for {0} ({1}) set to {2} in {3}", | |
592 | sp.ControllingClient.DebugPacketLevel = newDebug; | 620 | sp.Name, sp.IsChildAgent ? "child" : "root", newDebug, m_scene.Name); |
593 | } | 621 | |
594 | }); | 622 | sp.ControllingClient.DebugPacketLevel = newDebug; |
623 | } | ||
624 | }); | ||
625 | } | ||
595 | } | 626 | } |
596 | else | 627 | else |
597 | { | 628 | { |
598 | MainConsole.Instance.Output("Usage: debug lludp packet 0..255 [<first-name> <last-name>]"); | 629 | MainConsole.Instance.Output("Usage: debug lludp packet [--default] 0..255 [<first-name> <last-name>]"); |
599 | } | 630 | } |
600 | } | 631 | } |
601 | } | 632 | } |
@@ -687,6 +718,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
687 | "OUT LLUDP packet processing for {0} is {1}", m_scene.Name, IsRunningOutbound ? "enabled" : "disabled"); | 718 | "OUT LLUDP packet processing for {0} is {1}", m_scene.Name, IsRunningOutbound ? "enabled" : "disabled"); |
688 | 719 | ||
689 | MainConsole.Instance.OutputFormat("LLUDP pools in {0} are {1}", m_scene.Name, UsePools ? "on" : "off"); | 720 | MainConsole.Instance.OutputFormat("LLUDP pools in {0} are {1}", m_scene.Name, UsePools ? "on" : "off"); |
721 | |||
722 | MainConsole.Instance.OutputFormat( | ||
723 | "Packet debug level for new clients is {0}", DefaultClientPacketDebugLevel); | ||
690 | } | 724 | } |
691 | 725 | ||
692 | public bool HandlesRegion(Location x) | 726 | public bool HandlesRegion(Location x) |
@@ -1533,6 +1567,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1533 | 1567 | ||
1534 | client = new LLClientView(m_scene, this, udpClient, sessionInfo, agentID, sessionID, circuitCode); | 1568 | client = new LLClientView(m_scene, this, udpClient, sessionInfo, agentID, sessionID, circuitCode); |
1535 | client.OnLogout += LogoutHandler; | 1569 | client.OnLogout += LogoutHandler; |
1570 | client.DebugPacketLevel = DefaultClientPacketDebugLevel; | ||
1536 | 1571 | ||
1537 | ((LLClientView)client).DisableFacelights = m_disableFacelights; | 1572 | ((LLClientView)client).DisableFacelights = m_disableFacelights; |
1538 | 1573 | ||