Merge branch 'master' into careminster

avinationmerge
Melanie 2012-01-10 21:28:59 +00:00
commit 8fa1108b72
3 changed files with 104 additions and 24 deletions

View File

@ -306,6 +306,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected static Dictionary<PacketType, PacketMethod> PacketHandlers = new Dictionary<PacketType, PacketMethod>(); //Global/static handlers for all clients protected static Dictionary<PacketType, PacketMethod> PacketHandlers = new Dictionary<PacketType, PacketMethod>(); //Global/static handlers for all clients
/// <summary>
/// Handles UDP texture download.
/// </summary>
public LLImageManager ImageManager { get; private set; }
private readonly LLUDPServer m_udpServer; private readonly LLUDPServer m_udpServer;
private readonly LLUDPClient m_udpClient; private readonly LLUDPClient m_udpClient;
private readonly UUID m_sessionId; private readonly UUID m_sessionId;
@ -351,7 +356,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
protected Dictionary<PacketType, PacketProcessor> m_packetHandlers = new Dictionary<PacketType, PacketProcessor>(); protected Dictionary<PacketType, PacketProcessor> m_packetHandlers = new Dictionary<PacketType, PacketProcessor>();
protected Dictionary<string, GenericMessage> m_genericPacketHandlers = new Dictionary<string, GenericMessage>(); //PauPaw:Local Generic Message handlers protected Dictionary<string, GenericMessage> m_genericPacketHandlers = new Dictionary<string, GenericMessage>(); //PauPaw:Local Generic Message handlers
protected Scene m_scene; protected Scene m_scene;
private LLImageManager m_imageManager;
protected string m_firstName; protected string m_firstName;
protected string m_lastName; protected string m_lastName;
protected Thread m_clientThread; protected Thread m_clientThread;
@ -470,7 +474,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
m_assetService = m_scene.RequestModuleInterface<IAssetService>(); m_assetService = m_scene.RequestModuleInterface<IAssetService>();
m_GroupsModule = scene.RequestModuleInterface<IGroupsModule>(); m_GroupsModule = scene.RequestModuleInterface<IGroupsModule>();
m_imageManager = new LLImageManager(this, m_assetService, Scene.RequestModuleInterface<IJ2KDecoder>()); ImageManager = new LLImageManager(this, m_assetService, Scene.RequestModuleInterface<IJ2KDecoder>());
m_channelVersion = Util.StringToBytes256(scene.GetSimulatorVersion()); m_channelVersion = Util.StringToBytes256(scene.GetSimulatorVersion());
m_agentId = agentId; m_agentId = agentId;
m_sessionId = sessionId; m_sessionId = sessionId;
@ -522,7 +526,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
IsActive = false; IsActive = false;
// Shutdown the image manager // Shutdown the image manager
m_imageManager.Close(); ImageManager.Close();
// Fire the callback for this connection closing // Fire the callback for this connection closing
if (OnConnectionClosed != null) if (OnConnectionClosed != null)
@ -3983,7 +3987,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
if ((categories & ThrottleOutPacketTypeFlags.Texture) != 0) if ((categories & ThrottleOutPacketTypeFlags.Texture) != 0)
m_imageManager.ProcessImageQueue(m_udpServer.TextureSendLimit); ImageManager.ProcessImageQueue(m_udpServer.TextureSendLimit);
} }
public void SendAssetUploadCompleteMessage(sbyte AssetType, bool Success, UUID AssetFullID) public void SendAssetUploadCompleteMessage(sbyte AssetType, bool Success, UUID AssetFullID)
@ -7531,7 +7535,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if ((ImageType)block.Type == ImageType.Baked) if ((ImageType)block.Type == ImageType.Baked)
args.Priority *= 2.0f; args.Priority *= 2.0f;
m_imageManager.EnqueueReq(args); ImageManager.EnqueueReq(args);
} }
return true; return true;

View File

@ -245,6 +245,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
m_shuttingdown = true; m_shuttingdown = true;
} }
/// <summary>
/// Returns an array containing all the images in the queue.
/// </summary>
/// <returns></returns>
public J2KImage[] GetImages()
{
lock (m_priorityQueue)
return m_priorityQueue.ToArray();
}
#region Priority Queue Helpers #region Priority Queue Helpers
private J2KImage GetHighestPriorityImage() private J2KImage GetHighestPriorityImage()

View File

@ -87,7 +87,7 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
"Show priority queue data for each client", "Show priority queue data for each client",
"Without the 'full' option, only root agents are shown." "Without the 'full' option, only root agents are shown."
+ " With the 'full' option child agents are also shown.", + " With the 'full' option child agents are also shown.",
ShowPQueuesReport); (mod, cmd) => MainConsole.Instance.Output(GetPQueuesReport(cmd)));
scene.AddCommand( scene.AddCommand(
this, "show queues", this, "show queues",
@ -95,7 +95,13 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
"Show queue data for each client", "Show queue data for each client",
"Without the 'full' option, only root agents are shown." "Without the 'full' option, only root agents are shown."
+ " With the 'full' option child agents are also shown.", + " With the 'full' option child agents are also shown.",
ShowQueuesReport); (mod, cmd) => MainConsole.Instance.Output(GetQueuesReport(cmd)));
scene.AddCommand(
this, "show image queues",
"show image queues <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( scene.AddCommand(
this, "show throttles", this, "show throttles",
@ -103,7 +109,7 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
"Show throttle settings for each client and for the server overall", "Show throttle settings for each client and for the server overall",
"Without the 'full' option, only root agents are shown." "Without the 'full' option, only root agents are shown."
+ " With the 'full' option child agents are also shown.", + " With the 'full' option child agents are also shown.",
ShowThrottlesReport); (mod, cmd) => MainConsole.Instance.Output(GetThrottlesReport(cmd)));
scene.AddCommand( scene.AddCommand(
this, "emergency-monitoring", this, "emergency-monitoring",
@ -124,21 +130,6 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
public void RegionLoaded(Scene scene) public void RegionLoaded(Scene scene)
{ {
// m_log.DebugFormat("[LINDEN UDP INFO MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName); // m_log.DebugFormat("[LINDEN UDP INFO MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName);
}
protected void ShowPQueuesReport(string module, string[] cmd)
{
MainConsole.Instance.Output(GetPQueuesReport(cmd));
}
protected void ShowQueuesReport(string module, string[] cmd)
{
MainConsole.Instance.Output(GetQueuesReport(cmd));
}
protected void ShowThrottlesReport(string module, string[] cmd)
{
MainConsole.Instance.Output(GetThrottlesReport(cmd));
} }
protected void EmergencyMonitoring(string module, string[] cmd) protected void EmergencyMonitoring(string module, string[] cmd)
@ -166,7 +157,6 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
entry.Length > maxLength ? entry.Substring(0, maxLength) : entry, entry.Length > maxLength ? entry.Substring(0, maxLength) : entry,
""); "");
} }
/// <summary> /// <summary>
/// Generate UDP Queue data report for each client /// Generate UDP Queue data report for each client
@ -240,6 +230,82 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
return report.ToString(); return report.ToString();
} }
/// <summary>
/// Generate an image queue report
/// </summary>
/// <param name="showParams"></param>
/// <returns></returns>
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 "";
}
string firstName = showParams[3];
string lastName = showParams[4];
bool showChildAgents = showParams.Length == 6;
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 && (showChildAgents || !sp.IsChildAgent))
foundAgents.Add(sp);
}
}
if (foundAgents.Count == 0)
{
MainConsole.Instance.OutputFormat("No agents found for {0} {1}", firstName, lastName);
return "";
}
StringBuilder report = new StringBuilder();
foreach (ScenePresence agent in foundAgents)
{
LLClientView client = agent.ControllingClient as LLClientView;
if (client == null)
{
MainConsole.Instance.OutputFormat("This command is only supported for LLClientView");
return "";
}
J2KImage[] images = client.ImageManager.GetImages();
report.AppendFormat(
"In region {0} ({1} agent)\n",
agent.Scene.RegionInfo.RegionName, agent.IsChildAgent ? "child" : "root");
report.AppendFormat("Images in queue: {0}\n", images.Length);
if (images.Length > 0)
{
report.AppendFormat(
"{0,-36} {1,-8} {2,-9} {3,-9} {4,-9} {5,-7}\n",
"Texture ID",
"Last Seq",
"Priority",
"Start Pkt",
"Has Asset",
"Decoded");
foreach (J2KImage image in images)
report.AppendFormat(
"{0,36} {1,8} {2,9} {3,10} {4,9} {5,7}\n",
image.TextureID, image.LastSequence, image.Priority, image.StartPacket, image.HasAsset, image.IsDecoded);
}
}
return report.ToString();
}
/// <summary> /// <summary>
/// Generate UDP Queue data report for each client /// Generate UDP Queue data report for each client