From ca412032e89939146a05cf708a4b9df93f74c4ac Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 12 Jul 2012 21:36:33 +0100 Subject: Put output for "show connections" command into standard table format. Also moves into own method. --- OpenSim/Region/Application/OpenSim.cs | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) (limited to 'OpenSim/Region/Application') diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 56ad5c9..f3e4a2d 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -996,25 +996,7 @@ namespace OpenSim break; case "connections": - System.Text.StringBuilder connections = new System.Text.StringBuilder("Connections:\n"); - m_sceneManager.ForEachScene( - delegate(Scene scene) { - scene.ForEachClient( - delegate(IClientAPI client) { - connections.AppendFormat( - "{0}: {1} ({2}) from {3} on circuit {4}\n", - scene.RegionInfo.RegionName, - client.Name, - client.AgentId, - client.RemoteEndPoint, - client.CircuitCode - ); - } - ); - } - ); - - MainConsole.Instance.Output(connections.ToString()); + HandleShowConnections(); break; case "circuits": @@ -1138,6 +1120,21 @@ namespace OpenSim } } + private void HandleShowConnections() + { + ConsoleDisplayTable cdt = new ConsoleDisplayTable(); + cdt.AddColumn("Region", 20); + cdt.AddColumn("Avatar name", 25); + cdt.AddColumn("Remote endpoint", 23); + cdt.AddColumn("Circuit number", 14); + + m_sceneManager.ForEachScene( + s => s.ForEachClient( + c => cdt.AddRow(s.RegionInfo.RegionName, c.Name, c.RemoteEndPoint.ToString(), c.CircuitCode.ToString()))); + + MainConsole.Instance.Output(cdt.ToString()); + } + /// /// Use XML2 format to serialize data to a file /// -- cgit v1.1 From 6a0de355e09c264ce3f9e2c7db0b69919794e30c Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 12 Jul 2012 22:37:48 +0100 Subject: Add active status to "show connections" --- OpenSim/Region/Application/OpenSim.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Application') diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index f3e4a2d..e980716 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -1127,10 +1127,16 @@ namespace OpenSim cdt.AddColumn("Avatar name", 25); cdt.AddColumn("Remote endpoint", 23); cdt.AddColumn("Circuit number", 14); + cdt.AddColumn("Active?", 7); m_sceneManager.ForEachScene( s => s.ForEachClient( - c => cdt.AddRow(s.RegionInfo.RegionName, c.Name, c.RemoteEndPoint.ToString(), c.CircuitCode.ToString()))); + c => cdt.AddRow( + s.RegionInfo.RegionName, + c.Name, + c.RemoteEndPoint.ToString(), + c.CircuitCode.ToString(), + c.IsActive.ToString()))); MainConsole.Instance.Output(cdt.ToString()); } -- cgit v1.1 From 15283d35f1c567d6b33d0ba2884c1a73c83c6ce6 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 12 Jul 2012 23:09:36 +0100 Subject: 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. --- OpenSim/Region/Application/OpenSim.cs | 51 +++++++++++++++++++++-------------- 1 file changed, 31 insertions(+), 20 deletions(-) (limited to 'OpenSim/Region/Application') diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index e980716..230af8e 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -1000,22 +1000,7 @@ namespace OpenSim break; case "circuits": - System.Text.StringBuilder acd = new System.Text.StringBuilder("Agent Circuits:\n"); - 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()); + HandleShowCircuits(); break; 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() { ConsoleDisplayTable cdt = new ConsoleDisplayTable(); cdt.AddColumn("Region", 20); - cdt.AddColumn("Avatar name", 25); - cdt.AddColumn("Remote endpoint", 23); - cdt.AddColumn("Circuit number", 14); + cdt.AddColumn("Avatar name", 24); + cdt.AddColumn("Circuit code", 12); + cdt.AddColumn("Endpoint", 23); cdt.AddColumn("Active?", 7); m_sceneManager.ForEachScene( s => s.ForEachClient( c => cdt.AddRow( - s.RegionInfo.RegionName, + s.Name, c.Name, c.RemoteEndPoint.ToString(), c.CircuitCode.ToString(), -- cgit v1.1