From 1703cacaab91a980c96458f0f49284ab68168130 Mon Sep 17 00:00:00 2001 From: Dalien Talbot Date: Thu, 13 Sep 2007 16:39:04 +0000 Subject: Added CLI "debug packet 0..255" to enable the in/out packet dumps with various verbosity --- OpenSim/Region/ClientStack/ClientView.cs | 34 +++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack/ClientView.cs') diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs index 4d7dbda..54c9a0d 100644 --- a/OpenSim/Region/ClientStack/ClientView.cs +++ b/OpenSim/Region/ClientStack/ClientView.cs @@ -70,7 +70,7 @@ namespace OpenSim.Region.ClientStack //private AgentAssetUpload UploadAssets; private LLUUID newAssetFolder = LLUUID.Zero; - private bool debug = false; + private int debug = 0; protected IScene m_scene; private Dictionary m_clientThreads; private AssetCache m_assetCache; @@ -116,6 +116,11 @@ namespace OpenSim.Region.ClientStack ClientThread.Start(); } + public void SetDebug(int newDebug) + { + debug = newDebug; + } + # region Client Methods public void KillClient() @@ -192,6 +197,31 @@ namespace OpenSim.Region.ClientStack return result; } + protected void DebugPacket(string direction, Packet packet) + { + if (debug > 0) { + string info; + if (debug < 255 && packet.Type == PacketType.AgentUpdate) + return; + if (debug < 254 && packet.Type == PacketType.ViewerEffect) + return; + if (debug < 253 && ( + packet.Type == PacketType.CompletePingCheck || + packet.Type == PacketType.StartPingCheck + ) ) + return; + if (debug < 252 && packet.Type == PacketType.PacketAck) + return; + + if (debug > 1) { + info = packet.ToString(); + } else { + info = packet.Type.ToString(); + } + Console.WriteLine(CircuitCode + ":" + direction + ": " + info); + } + } + protected virtual void ClientLoop() { MainLog.Instance.Verbose("OpenSimClient.cs:ClientLoop() - Entered loop"); @@ -205,11 +235,13 @@ namespace OpenSim.Region.ClientStack { packetsReceived++; } + DebugPacket("IN", nextPacket.Packet); ProcessInPacket(nextPacket.Packet); } else { //is a out going packet + DebugPacket("OUT", nextPacket.Packet); ProcessOutPacket(nextPacket.Packet); } } -- cgit v1.1