aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-11-24 20:27:11 +0000
committerJustin Clark-Casey (justincc)2011-11-24 20:27:11 +0000
commit0174e326e3680ebc76dbd525191ad9b07634ec6d (patch)
tree38d0bbd98bdc095487b910b38384496d4191710f
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC_OLD-0174e326e3680ebc76dbd525191ad9b07634ec6d.zip
opensim-SC_OLD-0174e326e3680ebc76dbd525191ad9b07634ec6d.tar.gz
opensim-SC_OLD-0174e326e3680ebc76dbd525191ad9b07634ec6d.tar.bz2
opensim-SC_OLD-0174e326e3680ebc76dbd525191ad9b07634ec6d.tar.xz
Add a "debug eq" console command for debugging.
This will log outgoing event queue message names if turned on.
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs85
1 files changed, 79 insertions, 6 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs
index 7d73b3e..f5feb71 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs
@@ -39,6 +39,7 @@ using OpenMetaverse.Messages.Linden;
39using OpenMetaverse.Packets; 39using OpenMetaverse.Packets;
40using OpenMetaverse.StructuredData; 40using OpenMetaverse.StructuredData;
41using OpenSim.Framework; 41using OpenSim.Framework;
42using OpenSim.Framework.Console;
42using OpenSim.Framework.Servers; 43using OpenSim.Framework.Servers;
43using OpenSim.Framework.Servers.HttpServer; 44using OpenSim.Framework.Servers.HttpServer;
44using OpenSim.Region.Framework.Interfaces; 45using OpenSim.Region.Framework.Interfaces;
@@ -58,9 +59,15 @@ namespace OpenSim.Region.ClientStack.Linden
58 public class EventQueueGetModule : IEventQueue, IRegionModule 59 public class EventQueueGetModule : IEventQueue, IRegionModule
59 { 60 {
60 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 61 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
61 protected Scene m_scene = null; 62
63 /// <value>
64 /// Debug level.
65 /// </value>
66 public int DebugLevel { get; set; }
67
68 protected Scene m_scene;
62 private IConfigSource m_gConfig; 69 private IConfigSource m_gConfig;
63 bool enabledYN = false; 70 bool enabledYN;
64 71
65 private Dictionary<UUID, int> m_ids = new Dictionary<UUID, int>(); 72 private Dictionary<UUID, int> m_ids = new Dictionary<UUID, int>();
66 73
@@ -97,6 +104,15 @@ namespace OpenSim.Region.ClientStack.Linden
97 scene.EventManager.OnClientClosed += ClientClosed; 104 scene.EventManager.OnClientClosed += ClientClosed;
98 scene.EventManager.OnMakeChildAgent += MakeChildAgent; 105 scene.EventManager.OnMakeChildAgent += MakeChildAgent;
99 scene.EventManager.OnRegisterCaps += OnRegisterCaps; 106 scene.EventManager.OnRegisterCaps += OnRegisterCaps;
107
108 MainConsole.Instance.Commands.AddCommand(
109 "event queue",
110 false,
111 "debug eq",
112 "debug eq [0|1]",
113 "debug eq 1 will turn on event queue debugging. This will log all outgoing event queue messages to clients.\n"
114 + "debug eq 1 will turn off event queue debugging.",
115 HandleDebugEq);
100 } 116 }
101 else 117 else
102 { 118 {
@@ -128,6 +144,22 @@ namespace OpenSim.Region.ClientStack.Linden
128 } 144 }
129 #endregion 145 #endregion
130 146
147 protected void HandleDebugEq(string module, string[] args)
148 {
149 int debugLevel;
150
151 if (!(args.Length == 3 && int.TryParse(args[2], out debugLevel)))
152 {
153 MainConsole.Instance.OutputFormat("Usage: debug eq [0|1]");
154 }
155 else
156 {
157 DebugLevel = debugLevel;
158 MainConsole.Instance.OutputFormat(
159 "Set event queue debug level to {0} in {1}", DebugLevel, m_scene.RegionInfo.RegionName);
160 }
161 }
162
131 /// <summary> 163 /// <summary>
132 /// Always returns a valid queue 164 /// Always returns a valid queue
133 /// </summary> 165 /// </summary>
@@ -323,7 +355,9 @@ namespace OpenSim.Region.ClientStack.Linden
323 355
324 // This will persist this beyond the expiry of the caps handlers 356 // This will persist this beyond the expiry of the caps handlers
325 MainServer.Instance.AddPollServiceHTTPHandler( 357 MainServer.Instance.AddPollServiceHTTPHandler(
326 capsBase + EventQueueGetUUID.ToString() + "/", EventQueuePoll, new PollServiceEventArgs(null, HasEvents, GetEvents, NoEvents, agentID)); 358 capsBase + EventQueueGetUUID.ToString() + "/",
359 EventQueuePoll,
360 new PollServiceEventArgs(null, HasEvents, GetEvents, NoEvents, agentID));
327 361
328 Random rnd = new Random(Environment.TickCount); 362 Random rnd = new Random(Environment.TickCount);
329 lock (m_ids) 363 lock (m_ids)
@@ -370,12 +404,31 @@ namespace OpenSim.Region.ClientStack.Linden
370 } 404 }
371 else 405 else
372 { 406 {
407 if (DebugLevel > 0 && element is OSDMap)
408 {
409 OSDMap ev = (OSDMap)element;
410 m_log.DebugFormat(
411 "[EVENT QUEUE GET MODULE]: Eq OUT {0} to {1}",
412 ev["message"], m_scene.GetScenePresence(pAgentId).Name);
413 }
414
373 array.Add(element); 415 array.Add(element);
416
374 lock (queue) 417 lock (queue)
375 { 418 {
376 while (queue.Count > 0) 419 while (queue.Count > 0)
377 { 420 {
378 array.Add(queue.Dequeue()); 421 element = queue.Dequeue();
422
423 if (DebugLevel > 0 && element is OSDMap)
424 {
425 OSDMap ev = (OSDMap)element;
426 m_log.DebugFormat(
427 "[EVENT QUEUE GET MODULE]: Eq OUT {0} to {1}",
428 ev["message"], m_scene.GetScenePresence(pAgentId).Name);
429 }
430
431 array.Add(element);
379 thisID++; 432 thisID++;
380 } 433 }
381 } 434 }
@@ -471,11 +524,29 @@ namespace OpenSim.Region.ClientStack.Linden
471 { 524 {
472 array.Add(element); 525 array.Add(element);
473 526
527 if (element is OSDMap)
528 {
529 OSDMap ev = (OSDMap)element;
530 m_log.DebugFormat(
531 "[EVENT QUEUE GET MODULE]: Eq OUT {0} to {1}",
532 ev["message"], m_scene.GetScenePresence(agentID).Name);
533 }
534
474 lock (queue) 535 lock (queue)
475 { 536 {
476 while (queue.Count > 0) 537 while (queue.Count > 0)
477 { 538 {
478 array.Add(queue.Dequeue()); 539 element = queue.Dequeue();
540
541 if (element is OSDMap)
542 {
543 OSDMap ev = (OSDMap)element;
544 m_log.DebugFormat(
545 "[EVENT QUEUE GET MODULE]: Eq OUT {0} to {1}",
546 ev["message"], m_scene.GetScenePresence(agentID).Name);
547 }
548
549 array.Add(element);
479 thisID++; 550 thisID++;
480 } 551 }
481 } 552 }
@@ -494,7 +565,8 @@ namespace OpenSim.Region.ClientStack.Linden
494 responsedata["content_type"] = "application/xml"; 565 responsedata["content_type"] = "application/xml";
495 responsedata["keepalive"] = false; 566 responsedata["keepalive"] = false;
496 responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(events); 567 responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(events);
497 //m_log.DebugFormat("[EVENTQUEUE]: sending response for {0} in region {1}: {2}", agentID, m_scene.RegionInfo.RegionName, responsedata["str_response_string"]); 568
569 m_log.DebugFormat("[EVENTQUEUE]: sending response for {0} in region {1}: {2}", agentID, m_scene.RegionInfo.RegionName, responsedata["str_response_string"]);
498 570
499 return responsedata; 571 return responsedata;
500 } 572 }
@@ -717,6 +789,7 @@ namespace OpenSim.Region.ClientStack.Linden
717 OSD item = EventQueueHelper.GroupMembership(groupUpdate); 789 OSD item = EventQueueHelper.GroupMembership(groupUpdate);
718 Enqueue(item, avatarID); 790 Enqueue(item, avatarID);
719 } 791 }
792
720 public void QueryReply(PlacesReplyPacket groupUpdate, UUID avatarID) 793 public void QueryReply(PlacesReplyPacket groupUpdate, UUID avatarID)
721 { 794 {
722 OSD item = EventQueueHelper.PlacesQuery(groupUpdate); 795 OSD item = EventQueueHelper.PlacesQuery(groupUpdate);