Extend "show circuits" to show circuit code, ip and viewer name.

Also change to use standard table formatting
"show circuits" and "show connections" console commands are very similar but access different data structures.
0.7.4.1
Justin Clark-Casey (justincc) 2012-07-12 23:09:36 +01:00
parent 6a0de355e0
commit 15283d35f1
2 changed files with 36 additions and 20 deletions

View File

@ -98,6 +98,11 @@ namespace OpenSim.Framework
/// </summary> /// </summary>
public string lastname; public string lastname;
/// <summary>
/// Agent's full name.
/// </summary>
public string Name { get { return string.Format("{0} {1}", firstname, lastname); } }
/// <summary> /// <summary>
/// Random Unique GUID for this session. Client gets this at login and it's /// Random Unique GUID for this session. Client gets this at login and it's
/// only supposed to be disclosed over secure channels /// only supposed to be disclosed over secure channels

View File

@ -1000,22 +1000,7 @@ namespace OpenSim
break; break;
case "circuits": case "circuits":
System.Text.StringBuilder acd = new System.Text.StringBuilder("Agent Circuits:\n"); HandleShowCircuits();
m_sceneManager.ForEachScene(
delegate(Scene scene) {
//this.HttpServer.
acd.AppendFormat("{0}:\n", scene.RegionInfo.RegionName);
foreach (AgentCircuitData aCircuit in scene.AuthenticateHandler.GetAgentCircuits().Values)
acd.AppendFormat(
"\t{0} {1} ({2})\n",
aCircuit.firstname,
aCircuit.lastname,
(aCircuit.child ? "Child" : "Root")
);
}
);
MainConsole.Instance.Output(acd.ToString());
break; break;
case "http-handlers": case "http-handlers":
@ -1120,19 +1105,45 @@ namespace OpenSim
} }
} }
private void HandleShowCircuits()
{
ConsoleDisplayTable cdt = new ConsoleDisplayTable();
cdt.AddColumn("Region", 20);
cdt.AddColumn("Avatar name", 24);
cdt.AddColumn("Type", 5);
cdt.AddColumn("Code", 10);
cdt.AddColumn("IP", 16);
cdt.AddColumn("Viewer Name", 24);
m_sceneManager.ForEachScene(
s =>
{
foreach (AgentCircuitData aCircuit in s.AuthenticateHandler.GetAgentCircuits().Values)
cdt.AddRow(
s.Name,
aCircuit.Name,
aCircuit.child ? "child" : "root",
aCircuit.circuitcode.ToString(),
aCircuit.IPAddress.ToString(),
aCircuit.Viewer);
});
MainConsole.Instance.Output(cdt.ToString());
}
private void HandleShowConnections() private void HandleShowConnections()
{ {
ConsoleDisplayTable cdt = new ConsoleDisplayTable(); ConsoleDisplayTable cdt = new ConsoleDisplayTable();
cdt.AddColumn("Region", 20); cdt.AddColumn("Region", 20);
cdt.AddColumn("Avatar name", 25); cdt.AddColumn("Avatar name", 24);
cdt.AddColumn("Remote endpoint", 23); cdt.AddColumn("Circuit code", 12);
cdt.AddColumn("Circuit number", 14); cdt.AddColumn("Endpoint", 23);
cdt.AddColumn("Active?", 7); cdt.AddColumn("Active?", 7);
m_sceneManager.ForEachScene( m_sceneManager.ForEachScene(
s => s.ForEachClient( s => s.ForEachClient(
c => cdt.AddRow( c => cdt.AddRow(
s.RegionInfo.RegionName, s.Name,
c.Name, c.Name,
c.RemoteEndPoint.ToString(), c.RemoteEndPoint.ToString(),
c.CircuitCode.ToString(), c.CircuitCode.ToString(),