diff options
author | Dalien Talbot | 2007-09-13 16:39:04 +0000 |
---|---|---|
committer | Dalien Talbot | 2007-09-13 16:39:04 +0000 |
commit | 1703cacaab91a980c96458f0f49284ab68168130 (patch) | |
tree | 233773070afd5b4018fe0c18438b20d95f2f7b06 /OpenSim | |
parent | llSetPos(), llGetPos(), llGetLocalPos() now implemented (diff) | |
download | opensim-SC-1703cacaab91a980c96458f0f49284ab68168130.zip opensim-SC-1703cacaab91a980c96458f0f49284ab68168130.tar.gz opensim-SC-1703cacaab91a980c96458f0f49284ab68168130.tar.bz2 opensim-SC-1703cacaab91a980c96458f0f49284ab68168130.tar.xz |
Added CLI "debug packet 0..255" to enable the in/out packet dumps with various verbosity
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Framework/General/Interfaces/IClientAPI.cs | 1 | ||||
-rw-r--r-- | OpenSim/Framework/General/NullClientAPI.cs | 1 | ||||
-rw-r--r-- | OpenSim/Region/Application/OpenSimMain.cs | 58 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs | 7 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/ClientView.cs | 34 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/ClientViewBase.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs | 1 |
7 files changed, 94 insertions, 10 deletions
diff --git a/OpenSim/Framework/General/Interfaces/IClientAPI.cs b/OpenSim/Framework/General/Interfaces/IClientAPI.cs index c162163..8155373 100644 --- a/OpenSim/Framework/General/Interfaces/IClientAPI.cs +++ b/OpenSim/Framework/General/Interfaces/IClientAPI.cs | |||
@@ -240,5 +240,6 @@ namespace OpenSim.Framework.Interfaces | |||
240 | 240 | ||
241 | void SendViewerTime(int phase); | 241 | void SendViewerTime(int phase); |
242 | void SendAvatarProperties(LLUUID avatarID, string aboutText, string bornOn, string charterMember, string flAbout, uint flags, LLUUID flImageID, LLUUID imageID, string profileURL, LLUUID partnerID); | 242 | void SendAvatarProperties(LLUUID avatarID, string aboutText, string bornOn, string charterMember, string flAbout, uint flags, LLUUID flImageID, LLUUID imageID, string profileURL, LLUUID partnerID); |
243 | void SetDebug(int newDebug); | ||
243 | } | 244 | } |
244 | } | 245 | } |
diff --git a/OpenSim/Framework/General/NullClientAPI.cs b/OpenSim/Framework/General/NullClientAPI.cs index ab89323..56faae2 100644 --- a/OpenSim/Framework/General/NullClientAPI.cs +++ b/OpenSim/Framework/General/NullClientAPI.cs | |||
@@ -166,6 +166,7 @@ namespace OpenSim.Framework | |||
166 | 166 | ||
167 | public void SendViewerTime(int phase) { } | 167 | public void SendViewerTime(int phase) { } |
168 | public void SendAvatarProperties(LLUUID avatarID, string aboutText, string bornOn, string charterMember, string flAbout, uint flags, LLUUID flImageID, LLUUID imageID, string profileURL, LLUUID partnerID) { } | 168 | public void SendAvatarProperties(LLUUID avatarID, string aboutText, string bornOn, string charterMember, string flAbout, uint flags, LLUUID flImageID, LLUUID imageID, string profileURL, LLUUID partnerID) { } |
169 | public void SetDebug(int newDebug) { } | ||
169 | } | 170 | } |
170 | } | 171 | } |
171 | 172 | ||
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index 9ac5117..8327e26 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs | |||
@@ -380,11 +380,20 @@ namespace OpenSim | |||
380 | { | 380 | { |
381 | switch (command) | 381 | switch (command) |
382 | { | 382 | { |
383 | case "debug": | ||
384 | if (cmdparams.Length > 0) | ||
385 | { | ||
386 | Debug(cmdparams); | ||
387 | } | ||
388 | break; | ||
389 | |||
383 | case "help": | 390 | case "help": |
384 | m_log.Error("alert - send alert to a designated user or all users."); | 391 | m_log.Error("alert - send alert to a designated user or all users."); |
385 | m_log.Error(" alert [First] [Last] [Message] - send an alert to a user. Case sensitive."); | 392 | m_log.Error(" alert [First] [Last] [Message] - send an alert to a user. Case sensitive."); |
386 | m_log.Error(" alert general [Message] - send an alert to all users."); | 393 | m_log.Error(" alert general [Message] - send an alert to all users."); |
387 | m_log.Error("backup - trigger a simulator backup"); | 394 | m_log.Error("backup - trigger a simulator backup"); |
395 | m_log.Error("debug - debugging commands"); | ||
396 | m_log.Error(" packet 0..255 - print incoming/outgoing packets (0=off)"); | ||
388 | m_log.Error("load-xml [filename] - load prims from XML"); | 397 | m_log.Error("load-xml [filename] - load prims from XML"); |
389 | m_log.Error("save-xml [filename] - save prims to XML"); | 398 | m_log.Error("save-xml [filename] - save prims to XML"); |
390 | m_log.Error("script - manually trigger scripts? or script commands?"); | 399 | m_log.Error("script - manually trigger scripts? or script commands?"); |
@@ -555,6 +564,55 @@ namespace OpenSim | |||
555 | } | 564 | } |
556 | } | 565 | } |
557 | 566 | ||
567 | private void DebugPacket(int newDebug) | ||
568 | { | ||
569 | for (int i = 0; i < m_localScenes.Count; i++) | ||
570 | { | ||
571 | Scene scene = m_localScenes[i]; | ||
572 | foreach (EntityBase entity in scene.Entities.Values) | ||
573 | { | ||
574 | if (entity is ScenePresence) | ||
575 | { | ||
576 | ScenePresence scenePrescence = entity as ScenePresence; | ||
577 | if (!scenePrescence.childAgent) | ||
578 | { | ||
579 | m_log.Error(String.Format("Packet debug for {0} {1} set to {2}", | ||
580 | scenePrescence.Firstname, scenePrescence.Lastname, | ||
581 | newDebug)); | ||
582 | scenePrescence.ControllingClient.SetDebug(newDebug); | ||
583 | } | ||
584 | } | ||
585 | } | ||
586 | } | ||
587 | } | ||
588 | public void Debug(string[] args) | ||
589 | { | ||
590 | switch(args[0]) | ||
591 | { | ||
592 | case "packet": | ||
593 | if (args.Length > 1) | ||
594 | { | ||
595 | int newDebug; | ||
596 | if (int.TryParse(args[1], out newDebug)) | ||
597 | { | ||
598 | DebugPacket(newDebug); | ||
599 | } | ||
600 | else | ||
601 | { | ||
602 | m_log.Error("packet debug should be 0..2"); | ||
603 | } | ||
604 | System.Console.WriteLine("New packet debug: " + newDebug.ToString()); | ||
605 | |||
606 | } | ||
607 | |||
608 | break; | ||
609 | default: | ||
610 | m_log.Error("Unknown debug"); | ||
611 | break; | ||
612 | } | ||
613 | |||
614 | } | ||
615 | |||
558 | /// <summary> | 616 | /// <summary> |
559 | /// Outputs to the console information about the region | 617 | /// Outputs to the console information about the region |
560 | /// </summary> | 618 | /// </summary> |
diff --git a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs index d2f311b..fab5433 100644 --- a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs +++ b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs | |||
@@ -62,13 +62,6 @@ namespace OpenSim.Region.ClientStack | |||
62 | protected override void ProcessInPacket(Packet Pack) | 62 | protected override void ProcessInPacket(Packet Pack) |
63 | { | 63 | { |
64 | ack_pack(Pack); | 64 | ack_pack(Pack); |
65 | if (debug) | ||
66 | { | ||
67 | if (Pack.Type != PacketType.AgentUpdate) | ||
68 | { | ||
69 | Console.WriteLine(CircuitCode + ":IN: " + Pack.Type.ToString()); | ||
70 | } | ||
71 | } | ||
72 | 65 | ||
73 | if (this.ProcessPacketMethod(Pack)) | 66 | if (this.ProcessPacketMethod(Pack)) |
74 | { | 67 | { |
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 | |||
70 | 70 | ||
71 | //private AgentAssetUpload UploadAssets; | 71 | //private AgentAssetUpload UploadAssets; |
72 | private LLUUID newAssetFolder = LLUUID.Zero; | 72 | private LLUUID newAssetFolder = LLUUID.Zero; |
73 | private bool debug = false; | 73 | private int debug = 0; |
74 | protected IScene m_scene; | 74 | protected IScene m_scene; |
75 | private Dictionary<uint, ClientView> m_clientThreads; | 75 | private Dictionary<uint, ClientView> m_clientThreads; |
76 | private AssetCache m_assetCache; | 76 | private AssetCache m_assetCache; |
@@ -116,6 +116,11 @@ namespace OpenSim.Region.ClientStack | |||
116 | ClientThread.Start(); | 116 | ClientThread.Start(); |
117 | } | 117 | } |
118 | 118 | ||
119 | public void SetDebug(int newDebug) | ||
120 | { | ||
121 | debug = newDebug; | ||
122 | } | ||
123 | |||
119 | # region Client Methods | 124 | # region Client Methods |
120 | 125 | ||
121 | public void KillClient() | 126 | public void KillClient() |
@@ -192,6 +197,31 @@ namespace OpenSim.Region.ClientStack | |||
192 | return result; | 197 | return result; |
193 | } | 198 | } |
194 | 199 | ||
200 | protected void DebugPacket(string direction, Packet packet) | ||
201 | { | ||
202 | if (debug > 0) { | ||
203 | string info; | ||
204 | if (debug < 255 && packet.Type == PacketType.AgentUpdate) | ||
205 | return; | ||
206 | if (debug < 254 && packet.Type == PacketType.ViewerEffect) | ||
207 | return; | ||
208 | if (debug < 253 && ( | ||
209 | packet.Type == PacketType.CompletePingCheck || | ||
210 | packet.Type == PacketType.StartPingCheck | ||
211 | ) ) | ||
212 | return; | ||
213 | if (debug < 252 && packet.Type == PacketType.PacketAck) | ||
214 | return; | ||
215 | |||
216 | if (debug > 1) { | ||
217 | info = packet.ToString(); | ||
218 | } else { | ||
219 | info = packet.Type.ToString(); | ||
220 | } | ||
221 | Console.WriteLine(CircuitCode + ":" + direction + ": " + info); | ||
222 | } | ||
223 | } | ||
224 | |||
195 | protected virtual void ClientLoop() | 225 | protected virtual void ClientLoop() |
196 | { | 226 | { |
197 | MainLog.Instance.Verbose("OpenSimClient.cs:ClientLoop() - Entered loop"); | 227 | MainLog.Instance.Verbose("OpenSimClient.cs:ClientLoop() - Entered loop"); |
@@ -205,11 +235,13 @@ namespace OpenSim.Region.ClientStack | |||
205 | { | 235 | { |
206 | packetsReceived++; | 236 | packetsReceived++; |
207 | } | 237 | } |
238 | DebugPacket("IN", nextPacket.Packet); | ||
208 | ProcessInPacket(nextPacket.Packet); | 239 | ProcessInPacket(nextPacket.Packet); |
209 | } | 240 | } |
210 | else | 241 | else |
211 | { | 242 | { |
212 | //is a out going packet | 243 | //is a out going packet |
244 | DebugPacket("OUT", nextPacket.Packet); | ||
213 | ProcessOutPacket(nextPacket.Packet); | 245 | ProcessOutPacket(nextPacket.Packet); |
214 | } | 246 | } |
215 | } | 247 | } |
diff --git a/OpenSim/Region/ClientStack/ClientViewBase.cs b/OpenSim/Region/ClientStack/ClientViewBase.cs index 8ff5a11..80d7e53 100644 --- a/OpenSim/Region/ClientStack/ClientViewBase.cs +++ b/OpenSim/Region/ClientStack/ClientViewBase.cs | |||
@@ -71,8 +71,6 @@ namespace OpenSim.Region.ClientStack | |||
71 | // Keep track of when this packet was sent out | 71 | // Keep track of when this packet was sent out |
72 | Pack.TickCount = System.Environment.TickCount; | 72 | Pack.TickCount = System.Environment.TickCount; |
73 | 73 | ||
74 | // Console.WriteLine(CircuitCode + ":OUT: " + Pack.Type.ToString()); | ||
75 | |||
76 | if (!Pack.Header.Resent) | 74 | if (!Pack.Header.Resent) |
77 | { | 75 | { |
78 | // Set the sequence number | 76 | // Set the sequence number |
diff --git a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs index 7053c84..7e6101c 100644 --- a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs | |||
@@ -227,5 +227,6 @@ namespace SimpleApp | |||
227 | 227 | ||
228 | public void SendViewerTime(int phase) { } | 228 | public void SendViewerTime(int phase) { } |
229 | public void SendAvatarProperties(LLUUID avatarID, string aboutText, string bornOn, string charterMember, string flAbout, uint flags, LLUUID flImageID, LLUUID imageID, string profileURL, LLUUID partnerID) { } | 229 | public void SendAvatarProperties(LLUUID avatarID, string aboutText, string bornOn, string charterMember, string flAbout, uint flags, LLUUID flImageID, LLUUID imageID, string profileURL, LLUUID partnerID) { } |
230 | public void SetDebug(int newDebug) { } | ||
230 | } | 231 | } |
231 | } | 232 | } |