diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs
index 30d3712550..7bfb844b8e 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs
@@ -245,6 +245,26 @@ namespace OpenSim.Region.ClientStack.LindenUDP
m_shuttingdown = true;
}
+ ///
+ /// Clear the image queue.
+ ///
+ /// The number of requests cleared.
+ public int ClearImageQueue()
+ {
+ int requestsDeleted;
+
+ lock (m_priorityQueue)
+ {
+ requestsDeleted = m_priorityQueue.Count;
+
+ // Surprisingly, there doesn't seem to be a clear method at this time.
+ while (!m_priorityQueue.IsEmpty)
+ m_priorityQueue.DeleteMax();
+ }
+
+ return requestsDeleted;
+ }
+
///
/// Returns an array containing all the images in the queue.
///
diff --git a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs
index db70e56e37..95aa864de6 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
// m_log.DebugFormat("[LINDEN UDP INFO MODULE]: REGION {0} ADDED", scene.RegionInfo.RegionName);
lock (m_scenes)
- m_scenes[scene.RegionInfo.RegionID] = scene;
+ m_scenes[scene.RegionInfo.RegionID] = scene;
+
+ scene.AddCommand(
+ this, "image queues clear",
+ "image queues clear ",
+ "Clear the image queues (textures downloaded via UDP) for a particular client.",
+ (mod, cmd) => MainConsole.Instance.Output(HandleImageQueuesClear(cmd)));
+
+ scene.AddCommand(
+ this, "show image queues",
+ "image queues show ",
+ "Show the image queues (textures downloaded via UDP) for a particular client.",
+ (mod, cmd) => MainConsole.Instance.Output(GetImageQueuesReport(cmd)));
scene.AddCommand(
this, "show pqueues",
@@ -116,7 +128,7 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
"emergency-monitoring",
"Go on/off emergency monitoring mode",
"Go on/off emergency monitoring mode",
- EmergencyMonitoring);
+ HandleEmergencyMonitoring);
}
public void RemoveRegion(Scene scene)
@@ -132,7 +144,49 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
// m_log.DebugFormat("[LINDEN UDP INFO MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName);
}
- protected void EmergencyMonitoring(string module, string[] cmd)
+ protected string HandleImageQueuesClear(string[] cmd)
+ {
+ if (cmd.Length != 5)
+ return "Usage: image queues clear ";
+
+ string firstName = cmd[3];
+ string lastName = cmd[4];
+
+ List foundAgents = new List();
+
+ lock (m_scenes)
+ {
+ foreach (Scene scene in m_scenes.Values)
+ {
+ ScenePresence sp = scene.GetScenePresence(firstName, lastName);
+ if (sp != null)
+ foundAgents.Add(sp);
+ }
+ }
+
+ if (foundAgents.Count == 0)
+ return string.Format("No agents found for {0} {1}", firstName, lastName);
+
+ StringBuilder report = new StringBuilder();
+
+ foreach (ScenePresence agent in foundAgents)
+ {
+ LLClientView client = agent.ControllingClient as LLClientView;
+
+ if (client == null)
+ return "This command is only supported for LLClientView";
+
+ int requestsDeleted = client.ImageManager.ClearImageQueue();
+
+ report.AppendFormat(
+ "In region {0} ({1} agent) cleared {2} requests\n",
+ agent.Scene.RegionInfo.RegionName, agent.IsChildAgent ? "child" : "root", requestsDeleted);
+ }
+
+ return report.ToString();
+ }
+
+ protected void HandleEmergencyMonitoring(string module, string[] cmd)
{
bool mode = true;
if (cmd.Length == 1 || (cmd.Length > 1 && cmd[1] == "on"))
@@ -239,10 +293,7 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
private string GetImageQueuesReport(string[] showParams)
{
if (showParams.Length < 5 || showParams.Length > 6)
- {
- MainConsole.Instance.OutputFormat("Usage: show image queues [full]");
- return "";
- }
+ return "Usage: show image queues [full]";
string firstName = showParams[3];
string lastName = showParams[4];
@@ -262,10 +313,7 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
}
if (foundAgents.Count == 0)
- {
- MainConsole.Instance.OutputFormat("No agents found for {0} {1}", firstName, lastName);
- return "";
- }
+ return string.Format("No agents found for {0} {1}", firstName, lastName);
StringBuilder report = new StringBuilder();
@@ -274,10 +322,7 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
LLClientView client = agent.ControllingClient as LLClientView;
if (client == null)
- {
- MainConsole.Instance.OutputFormat("This command is only supported for LLClientView");
- return "";
- }
+ return "This command is only supported for LLClientView";
J2KImage[] images = client.ImageManager.GetImages();