aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Console/RemoteConsole.cs
diff options
context:
space:
mode:
authorMelanie2009-08-17 08:45:20 +0100
committerMelanie2009-08-17 08:45:20 +0100
commitcef16bec6dabc90fdccf82f755d24683d834208b (patch)
tree3265dbc64721f17eef82b06c7e16a7b4c6e0f657 /OpenSim/Framework/Console/RemoteConsole.cs
parentMerge branch 'master' of ssh://melanie@opensimulator.org/var/git/opensim (diff)
downloadopensim-SC_OLD-cef16bec6dabc90fdccf82f755d24683d834208b.zip
opensim-SC_OLD-cef16bec6dabc90fdccf82f755d24683d834208b.tar.gz
opensim-SC_OLD-cef16bec6dabc90fdccf82f755d24683d834208b.tar.bz2
opensim-SC_OLD-cef16bec6dabc90fdccf82f755d24683d834208b.tar.xz
Add the OpenSim.ConsoleClient app.
Usage: OpenSim.ConsoleClient -h <host> -p <port> -u <user> -P <pass> host defaults to localhost, port defaults to 8003.
Diffstat (limited to 'OpenSim/Framework/Console/RemoteConsole.cs')
-rw-r--r--OpenSim/Framework/Console/RemoteConsole.cs44
1 files changed, 33 insertions, 11 deletions
diff --git a/OpenSim/Framework/Console/RemoteConsole.cs b/OpenSim/Framework/Console/RemoteConsole.cs
index dbf8f8c..da8556a 100644
--- a/OpenSim/Framework/Console/RemoteConsole.cs
+++ b/OpenSim/Framework/Console/RemoteConsole.cs
@@ -98,7 +98,12 @@ namespace OpenSim.Framework.Console
98 m_LineNumber++; 98 m_LineNumber++;
99 m_Scrollback.Add(String.Format("{0}", m_LineNumber)+":"+level+":"+text); 99 m_Scrollback.Add(String.Format("{0}", m_LineNumber)+":"+level+":"+text);
100 } 100 }
101 System.Console.Write(text); 101 System.Console.WriteLine(text.Trim());
102 }
103
104 public override void Output(string text)
105 {
106 Output(text, "normal");
102 } 107 }
103 108
104 public override string ReadLine(string p, bool isCommand, bool e) 109 public override string ReadLine(string p, bool isCommand, bool e)
@@ -152,9 +157,8 @@ namespace OpenSim.Framework.Console
152 157
153 foreach (UUID id in expired) 158 foreach (UUID id in expired)
154 { 159 {
155 System.Console.WriteLine("Expired {0}", id.ToString());
156 CloseConnection(id);
157 m_Connections.Remove(id); 160 m_Connections.Remove(id);
161 CloseConnection(id);
158 } 162 }
159 } 163 }
160 } 164 }
@@ -244,8 +248,8 @@ namespace OpenSim.Framework.Console
244 { 248 {
245 if (m_Connections.ContainsKey(id)) 249 if (m_Connections.ContainsKey(id))
246 { 250 {
247 CloseConnection(id);
248 m_Connections.Remove(id); 251 m_Connections.Remove(id);
252 CloseConnection(id);
249 } 253 }
250 } 254 }
251 255
@@ -346,9 +350,15 @@ namespace OpenSim.Framework.Console
346 350
347 public void CloseConnection(UUID id) 351 public void CloseConnection(UUID id)
348 { 352 {
349 string uri = "/ReadResponses/" + id.ToString() + "/"; 353 try
354 {
355 string uri = "/ReadResponses/" + id.ToString() + "/";
350 356
351 m_Server.RemovePollServiceHTTPHandler("", uri); 357 m_Server.RemovePollServiceHTTPHandler("", uri);
358 }
359 catch (Exception)
360 {
361 }
352 } 362 }
353 363
354 private bool HasEvents(UUID sessionID) 364 private bool HasEvents(UUID sessionID)
@@ -394,8 +404,11 @@ namespace OpenSim.Framework.Console
394 lock (m_Scrollback) 404 lock (m_Scrollback)
395 { 405 {
396 long startLine = m_LineNumber - m_Scrollback.Count; 406 long startLine = m_LineNumber - m_Scrollback.Count;
407 long sendStart = startLine;
408 if (sendStart < c.lastLineSeen)
409 sendStart = c.lastLineSeen;
397 410
398 for (long i = startLine ; i < m_LineNumber ; i++) 411 for (long i = sendStart ; i < m_LineNumber ; i++)
399 { 412 {
400 XmlElement res = xmldoc.CreateElement("", "Line", ""); 413 XmlElement res = xmldoc.CreateElement("", "Line", "");
401 long line = i + 1; 414 long line = i + 1;
@@ -422,12 +435,21 @@ namespace OpenSim.Framework.Console
422 { 435 {
423 Hashtable result = new Hashtable(); 436 Hashtable result = new Hashtable();
424 437
425 result["int_response_code"] = 502; 438 XmlDocument xmldoc = new XmlDocument();
426 result["content_type"] = "text/plain"; 439 XmlNode xmlnode = xmldoc.CreateNode(XmlNodeType.XmlDeclaration,
440 "", "");
441
442 xmldoc.AppendChild(xmlnode);
443 XmlElement rootElement = xmldoc.CreateElement("", "ConsoleSession",
444 "");
445
446 xmldoc.AppendChild(rootElement);
447
448 result["str_response_string"] = xmldoc.InnerXml;
449 result["int_response_code"] = 200;
450 result["content_type"] = "text/xml";
427 result["keepalive"] = false; 451 result["keepalive"] = false;
428 result["reusecontext"] = false; 452 result["reusecontext"] = false;
429 result["str_response_string"] = "Upstream error: ";
430 result["error_status_text"] = "Upstream error:";
431 453
432 return result; 454 return result;
433 } 455 }