diff options
author | Justin Clark-Casey (justincc) | 2014-09-24 23:42:57 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2014-09-24 23:44:55 +0100 |
commit | d3578e2662a90fd04b011a745c1149df68c0954a (patch) | |
tree | 09805061d0364d1123c2f14c9c9f90ab62b8c02e | |
parent | Update libopenmetaverse to 0f4b361. (diff) | |
download | opensim-SC-d3578e2662a90fd04b011a745c1149df68c0954a.zip opensim-SC-d3578e2662a90fd04b011a745c1149df68c0954a.tar.gz opensim-SC-d3578e2662a90fd04b011a745c1149df68c0954a.tar.bz2 opensim-SC-d3578e2662a90fd04b011a745c1149df68c0954a.tar.xz |
Add "debug lludp data out" console command for logging outgoing data just before it's put on the wire.
Unlike "debug lludp packet" which logs at the point where OpenSim first asks the clientstack to send a certain outgoing packet, this logs immediately before the actual send.
For low-level debugging purposes.
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs | 6 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 47 |
2 files changed, 52 insertions, 1 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index c34bafa..9dc9e0d 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs | |||
@@ -76,6 +76,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
76 | /// or removed, this number must also change</summary> | 76 | /// or removed, this number must also change</summary> |
77 | const int THROTTLE_CATEGORY_COUNT = 8; | 77 | const int THROTTLE_CATEGORY_COUNT = 8; |
78 | 78 | ||
79 | /// <summary> | ||
80 | /// Controls whether information is logged about each outbound packet immediately before it is sent. For debug purposes. | ||
81 | /// </summary> | ||
82 | /// <remarks>Any level above 0 will turn on logging.</remarks> | ||
83 | public int DebugDataOutLevel { get; set; } | ||
84 | |||
79 | /// <summary>Fired when updated networking stats are produced for this client</summary> | 85 | /// <summary>Fired when updated networking stats are produced for this client</summary> |
80 | public event PacketStats OnPacketStats; | 86 | public event PacketStats OnPacketStats; |
81 | /// <summary>Fired when the queue for a packet category is empty. This event can be | 87 | /// <summary>Fired when the queue for a packet category is empty. This event can be |
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index e879e76..0393a29 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | |||
@@ -686,7 +686,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
686 | MainConsole.Instance.Commands.AddCommand( | 686 | MainConsole.Instance.Commands.AddCommand( |
687 | "Debug", false, "debug lludp packet", | 687 | "Debug", false, "debug lludp packet", |
688 | "debug lludp packet [--default | --all] <level> [<avatar-first-name> <avatar-last-name>]", | 688 | "debug lludp packet [--default | --all] <level> [<avatar-first-name> <avatar-last-name>]", |
689 | "Turn on packet debugging", | 689 | "Turn on packet debugging. This logs information when the client stack hands a processed packet off to downstream code or when upstream code first requests that a certain packet be sent.", |
690 | "If level > 255 then all incoming and outgoing packets are logged.\n" | 690 | "If level > 255 then all incoming and outgoing packets are logged.\n" |
691 | + "If level <= 255 then incoming AgentUpdate and outgoing SimStats and SimulatorViewerTimeMessage packets are not logged.\n" | 691 | + "If level <= 255 then incoming AgentUpdate and outgoing SimStats and SimulatorViewerTimeMessage packets are not logged.\n" |
692 | + "If level <= 200 then incoming RequestImage and outgoing ImagePacket, ImageData, LayerData and CoarseLocationUpdate packets are not logged.\n" | 692 | + "If level <= 200 then incoming RequestImage and outgoing ImagePacket, ImageData, LayerData and CoarseLocationUpdate packets are not logged.\n" |
@@ -700,6 +700,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
700 | HandlePacketCommand); | 700 | HandlePacketCommand); |
701 | 701 | ||
702 | MainConsole.Instance.Commands.AddCommand( | 702 | MainConsole.Instance.Commands.AddCommand( |
703 | "Debug", false, "debug lludp data out", | ||
704 | "debug lludp data out <level> <avatar-first-name> <avatar-last-name>\"", | ||
705 | "Turn on debugging for final outgoing data to the given user's client.", | ||
706 | "This operates at a much lower level than the packet command and prints out available details when the data is actually sent.\n" | ||
707 | + "If level > 0 then information about all outgoing UDP data for this avatar is logged.\n" | ||
708 | + "If level <= 0 then no information about outgoing UDP data for this avatar is logged.", | ||
709 | HandleDataCommand); | ||
710 | |||
711 | MainConsole.Instance.Commands.AddCommand( | ||
703 | "Debug", false, "debug lludp drop", | 712 | "Debug", false, "debug lludp drop", |
704 | "debug lludp drop <in|out> <add|remove> <packet-name>", | 713 | "debug lludp drop <in|out> <add|remove> <packet-name>", |
705 | "Drop all in or outbound packets that match the given name", | 714 | "Drop all in or outbound packets that match the given name", |
@@ -755,6 +764,37 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
755 | HandleAgentUpdateCommand); | 764 | HandleAgentUpdateCommand); |
756 | } | 765 | } |
757 | 766 | ||
767 | private void HandleDataCommand(string module, string[] args) | ||
768 | { | ||
769 | if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != Scene) | ||
770 | return; | ||
771 | |||
772 | if (args.Length != 7) | ||
773 | { | ||
774 | MainConsole.Instance.OutputFormat("Usage: debug lludp data out <true|false> <avatar-first-name> <avatar-last-name>"); | ||
775 | return; | ||
776 | } | ||
777 | |||
778 | int level; | ||
779 | if (!ConsoleUtil.TryParseConsoleInt(MainConsole.Instance, args[4], out level)) | ||
780 | return; | ||
781 | |||
782 | string firstName = args[5]; | ||
783 | string lastName = args[6]; | ||
784 | |||
785 | Scene.ForEachScenePresence(sp => | ||
786 | { | ||
787 | if (sp.Firstname == firstName && sp.Lastname == lastName) | ||
788 | { | ||
789 | MainConsole.Instance.OutputFormat( | ||
790 | "Data debug for {0} ({1}) set to {2} in {3}", | ||
791 | sp.Name, sp.IsChildAgent ? "child" : "root", level, Scene.Name); | ||
792 | |||
793 | ((LLClientView)sp.ControllingClient).UDPClient.DebugDataOutLevel = level; | ||
794 | } | ||
795 | }); | ||
796 | } | ||
797 | |||
758 | private void HandlePacketCommand(string module, string[] args) | 798 | private void HandlePacketCommand(string module, string[] args) |
759 | { | 799 | { |
760 | if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != Scene) | 800 | if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != Scene) |
@@ -1360,6 +1400,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1360 | // is 100% correct | 1400 | // is 100% correct |
1361 | PacketsSentCount++; | 1401 | PacketsSentCount++; |
1362 | 1402 | ||
1403 | if (udpClient.DebugDataOutLevel > 0) | ||
1404 | m_log.DebugFormat( | ||
1405 | "[LLUDPSERVER]: Sending packet #{0} (rel: {1}, res: {2}) to {3} from {4}", | ||
1406 | outgoingPacket.SequenceNumber, isReliable, isResend, udpClient.AgentID, Scene.Name); | ||
1407 | |||
1363 | // Put the UDP payload on the wire | 1408 | // Put the UDP payload on the wire |
1364 | AsyncBeginSend(buffer); | 1409 | AsyncBeginSend(buffer); |
1365 | 1410 | ||