aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-01-19 19:49:06 +0000
committerJustin Clark-Casey (justincc)2012-01-19 19:49:06 +0000
commitc92a9a664035ad4c36a0ac905751d105770dca51 (patch)
tree47b9d9cfaf3fb1a0646323099add0e73b5dea627
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC_OLD-c92a9a664035ad4c36a0ac905751d105770dca51.zip
opensim-SC_OLD-c92a9a664035ad4c36a0ac905751d105770dca51.tar.gz
opensim-SC_OLD-c92a9a664035ad4c36a0ac905751d105770dca51.tar.bz2
opensim-SC_OLD-c92a9a664035ad4c36a0ac905751d105770dca51.tar.xz
Add "image queues clear <first-name> <last-name>" console command
This allows a way to manually clear pending image queue requests for debug purposes
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs20
-rw-r--r--OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs75
2 files changed, 80 insertions, 15 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs
index 30d3712..7bfb844 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs
@@ -246,6 +246,26 @@ namespace OpenSim.Region.ClientStack.LindenUDP
246 } 246 }
247 247
248 /// <summary> 248 /// <summary>
249 /// Clear the image queue.
250 /// </summary>
251 /// <returns>The number of requests cleared.</returns>
252 public int ClearImageQueue()
253 {
254 int requestsDeleted;
255
256 lock (m_priorityQueue)
257 {
258 requestsDeleted = m_priorityQueue.Count;
259
260 // Surprisingly, there doesn't seem to be a clear method at this time.
261 while (!m_priorityQueue.IsEmpty)
262 m_priorityQueue.DeleteMax();
263 }
264
265 return requestsDeleted;
266 }
267
268 /// <summary>
249 /// Returns an array containing all the images in the queue. 269 /// Returns an array containing all the images in the queue.
250 /// </summary> 270 /// </summary>
251 /// <returns></returns> 271 /// <returns></returns>
diff --git a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs
index db70e56..95aa864 100644
--- a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs
+++ b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs
@@ -79,7 +79,19 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
79// m_log.DebugFormat("[LINDEN UDP INFO MODULE]: REGION {0} ADDED", scene.RegionInfo.RegionName); 79// m_log.DebugFormat("[LINDEN UDP INFO MODULE]: REGION {0} ADDED", scene.RegionInfo.RegionName);
80 80
81 lock (m_scenes) 81 lock (m_scenes)
82 m_scenes[scene.RegionInfo.RegionID] = scene; 82 m_scenes[scene.RegionInfo.RegionID] = scene;
83
84 scene.AddCommand(
85 this, "image queues clear",
86 "image queues clear <first-name> <last-name>",
87 "Clear the image queues (textures downloaded via UDP) for a particular client.",
88 (mod, cmd) => MainConsole.Instance.Output(HandleImageQueuesClear(cmd)));
89
90 scene.AddCommand(
91 this, "show image queues",
92 "image queues show <first-name> <last-name>",
93 "Show the image queues (textures downloaded via UDP) for a particular client.",
94 (mod, cmd) => MainConsole.Instance.Output(GetImageQueuesReport(cmd)));
83 95
84 scene.AddCommand( 96 scene.AddCommand(
85 this, "show pqueues", 97 this, "show pqueues",
@@ -116,7 +128,7 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
116 "emergency-monitoring", 128 "emergency-monitoring",
117 "Go on/off emergency monitoring mode", 129 "Go on/off emergency monitoring mode",
118 "Go on/off emergency monitoring mode", 130 "Go on/off emergency monitoring mode",
119 EmergencyMonitoring); 131 HandleEmergencyMonitoring);
120 } 132 }
121 133
122 public void RemoveRegion(Scene scene) 134 public void RemoveRegion(Scene scene)
@@ -132,7 +144,49 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
132// m_log.DebugFormat("[LINDEN UDP INFO MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName); 144// m_log.DebugFormat("[LINDEN UDP INFO MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName);
133 } 145 }
134 146
135 protected void EmergencyMonitoring(string module, string[] cmd) 147 protected string HandleImageQueuesClear(string[] cmd)
148 {
149 if (cmd.Length != 5)
150 return "Usage: image queues clear <first-name> <last-name>";
151
152 string firstName = cmd[3];
153 string lastName = cmd[4];
154
155 List<ScenePresence> foundAgents = new List<ScenePresence>();
156
157 lock (m_scenes)
158 {
159 foreach (Scene scene in m_scenes.Values)
160 {
161 ScenePresence sp = scene.GetScenePresence(firstName, lastName);
162 if (sp != null)
163 foundAgents.Add(sp);
164 }
165 }
166
167 if (foundAgents.Count == 0)
168 return string.Format("No agents found for {0} {1}", firstName, lastName);
169
170 StringBuilder report = new StringBuilder();
171
172 foreach (ScenePresence agent in foundAgents)
173 {
174 LLClientView client = agent.ControllingClient as LLClientView;
175
176 if (client == null)
177 return "This command is only supported for LLClientView";
178
179 int requestsDeleted = client.ImageManager.ClearImageQueue();
180
181 report.AppendFormat(
182 "In region {0} ({1} agent) cleared {2} requests\n",
183 agent.Scene.RegionInfo.RegionName, agent.IsChildAgent ? "child" : "root", requestsDeleted);
184 }
185
186 return report.ToString();
187 }
188
189 protected void HandleEmergencyMonitoring(string module, string[] cmd)
136 { 190 {
137 bool mode = true; 191 bool mode = true;
138 if (cmd.Length == 1 || (cmd.Length > 1 && cmd[1] == "on")) 192 if (cmd.Length == 1 || (cmd.Length > 1 && cmd[1] == "on"))
@@ -239,10 +293,7 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
239 private string GetImageQueuesReport(string[] showParams) 293 private string GetImageQueuesReport(string[] showParams)
240 { 294 {
241 if (showParams.Length < 5 || showParams.Length > 6) 295 if (showParams.Length < 5 || showParams.Length > 6)
242 { 296 return "Usage: show image queues <first-name> <last-name> [full]";
243 MainConsole.Instance.OutputFormat("Usage: show image queues <first-name> <last-name> [full]");
244 return "";
245 }
246 297
247 string firstName = showParams[3]; 298 string firstName = showParams[3];
248 string lastName = showParams[4]; 299 string lastName = showParams[4];
@@ -262,10 +313,7 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
262 } 313 }
263 314
264 if (foundAgents.Count == 0) 315 if (foundAgents.Count == 0)
265 { 316 return string.Format("No agents found for {0} {1}", firstName, lastName);
266 MainConsole.Instance.OutputFormat("No agents found for {0} {1}", firstName, lastName);
267 return "";
268 }
269 317
270 StringBuilder report = new StringBuilder(); 318 StringBuilder report = new StringBuilder();
271 319
@@ -274,10 +322,7 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
274 LLClientView client = agent.ControllingClient as LLClientView; 322 LLClientView client = agent.ControllingClient as LLClientView;
275 323
276 if (client == null) 324 if (client == null)
277 { 325 return "This command is only supported for LLClientView";
278 MainConsole.Instance.OutputFormat("This command is only supported for LLClientView");
279 return "";
280 }
281 326
282 J2KImage[] images = client.ImageManager.GetImages(); 327 J2KImage[] images = client.ImageManager.GetImages();
283 328