Add "image queues clear <first-name> <last-name>" console command
This allows a way to manually clear pending image queue requests for debug purposesiar_mods
parent
d75899f2d1
commit
c92a9a6640
|
@ -245,6 +245,26 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
m_shuttingdown = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clear the image queue.
|
||||
/// </summary>
|
||||
/// <returns>The number of requests cleared.</returns>
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns an array containing all the images in the queue.
|
||||
/// </summary>
|
||||
|
|
|
@ -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 <first-name> <last-name>",
|
||||
"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 <first-name> <last-name>",
|
||||
"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 <first-name> <last-name>";
|
||||
|
||||
string firstName = cmd[3];
|
||||
string lastName = cmd[4];
|
||||
|
||||
List<ScenePresence> foundAgents = new List<ScenePresence>();
|
||||
|
||||
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 <first-name> <last-name> [full]");
|
||||
return "";
|
||||
}
|
||||
return "Usage: show image queues <first-name> <last-name> [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();
|
||||
|
||||
|
|
Loading…
Reference in New Issue