diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/ConsoleClient/ConsoleClient.cs | 38 | ||||
-rw-r--r-- | OpenSim/Framework/Console/RemoteConsole.cs | 36 | ||||
-rw-r--r-- | OpenSim/Server/Base/ServicesServerBase.cs | 5 |
3 files changed, 57 insertions, 22 deletions
diff --git a/OpenSim/ConsoleClient/ConsoleClient.cs b/OpenSim/ConsoleClient/ConsoleClient.cs index 8c616e0..f4605da 100644 --- a/OpenSim/ConsoleClient/ConsoleClient.cs +++ b/OpenSim/ConsoleClient/ConsoleClient.cs | |||
@@ -29,6 +29,7 @@ using Nini.Config; | |||
29 | using log4net; | 29 | using log4net; |
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using System; | 31 | using System; |
32 | using System.IO; | ||
32 | using System.Xml; | 33 | using System.Xml; |
33 | using System.Collections.Generic; | 34 | using System.Collections.Generic; |
34 | using OpenSim.Server.Base; | 35 | using OpenSim.Server.Base; |
@@ -73,9 +74,18 @@ namespace OpenSim.ConsoleClient | |||
73 | 74 | ||
74 | Requester.MakeRequest("http://"+m_Host+":"+m_Port.ToString()+"/StartSession/", String.Format("USER={0}&PASS={1}", m_User, m_Pass), LoginReply); | 75 | Requester.MakeRequest("http://"+m_Host+":"+m_Port.ToString()+"/StartSession/", String.Format("USER={0}&PASS={1}", m_User, m_Pass), LoginReply); |
75 | 76 | ||
76 | int res = m_Server.Run(); | 77 | string pidFile = serverConfig.GetString("PIDFile", String.Empty); |
77 | 78 | ||
78 | Environment.Exit(res); | 79 | while (m_Server.Running) |
80 | { | ||
81 | System.Threading.Thread.Sleep(500); | ||
82 | // MainConsole.Instance.Prompt(); | ||
83 | } | ||
84 | |||
85 | if (pidFile != String.Empty) | ||
86 | File.Delete(pidFile); | ||
87 | |||
88 | Environment.Exit(0); | ||
79 | 89 | ||
80 | return 0; | 90 | return 0; |
81 | } | 91 | } |
@@ -83,13 +93,14 @@ namespace OpenSim.ConsoleClient | |||
83 | private static void SendCommand(string module, string[] cmd) | 93 | private static void SendCommand(string module, string[] cmd) |
84 | { | 94 | { |
85 | string sendCmd = ""; | 95 | string sendCmd = ""; |
96 | string[] cmdlist = new string[cmd.Length - 1]; | ||
97 | |||
98 | sendCmd = cmd[0]; | ||
99 | |||
86 | if (cmd.Length > 1) | 100 | if (cmd.Length > 1) |
87 | { | 101 | { |
88 | sendCmd = cmd[0]; | 102 | Array.Copy(cmd, 1, cmdlist, 0, cmd.Length - 1); |
89 | 103 | sendCmd += " \"" + String.Join("\" \"", cmdlist) + "\""; | |
90 | Array.Copy(cmd, 1, cmd, 0, cmd.Length-1); | ||
91 | Array.Resize(ref cmd, cmd.Length-1); | ||
92 | sendCmd += "\"" + String.Join("\" \"", cmd) + "\""; | ||
93 | } | 104 | } |
94 | 105 | ||
95 | Requester.MakeRequest("http://"+m_Host+":"+m_Port.ToString()+"/SessionCommand/", String.Format("ID={0}&COMMAND={1}", m_SessionID, sendCmd), CommandReply); | 106 | Requester.MakeRequest("http://"+m_Host+":"+m_Port.ToString()+"/SessionCommand/", String.Format("ID={0}&COMMAND={1}", m_SessionID, sendCmd), CommandReply); |
@@ -183,16 +194,27 @@ namespace OpenSim.ConsoleClient | |||
183 | while (lines.Count > 100) | 194 | while (lines.Count > 100) |
184 | lines.RemoveAt(0); | 195 | lines.RemoveAt(0); |
185 | 196 | ||
197 | string prompt = String.Empty; | ||
198 | |||
186 | foreach (string l in lines) | 199 | foreach (string l in lines) |
187 | { | 200 | { |
188 | string[] parts = l.Split(new char[] {':'}, 3); | 201 | string[] parts = l.Split(new char[] {':'}, 3); |
189 | if (parts.Length != 3) | 202 | if (parts.Length != 3) |
190 | continue; | 203 | continue; |
191 | 204 | ||
192 | MainConsole.Instance.Output(parts[2].Trim(), parts[1]); | 205 | if (parts[2].StartsWith("+++") || parts[2].StartsWith("-++")) |
206 | prompt = parts[2]; | ||
207 | else | ||
208 | MainConsole.Instance.Output(parts[2].Trim(), parts[1]); | ||
193 | } | 209 | } |
194 | 210 | ||
211 | |||
195 | Requester.MakeRequest(requestUrl, requestData, ReadResponses); | 212 | Requester.MakeRequest(requestUrl, requestData, ReadResponses); |
213 | |||
214 | if (prompt.StartsWith("+++")) | ||
215 | MainConsole.Instance.ReadLine(prompt.Substring(3), true, true); | ||
216 | else if (prompt.StartsWith("-++")) | ||
217 | SendCommand(String.Empty, new string[] { MainConsole.Instance.ReadLine(prompt.Substring(3), false, true) }); | ||
196 | } | 218 | } |
197 | 219 | ||
198 | public static void CommandReply(string requestUrl, string requestData, string replyData) | 220 | public static void CommandReply(string requestUrl, string requestData, string replyData) |
diff --git a/OpenSim/Framework/Console/RemoteConsole.cs b/OpenSim/Framework/Console/RemoteConsole.cs index 6f8348d..a46a6cb 100644 --- a/OpenSim/Framework/Console/RemoteConsole.cs +++ b/OpenSim/Framework/Console/RemoteConsole.cs | |||
@@ -106,8 +106,15 @@ namespace OpenSim.Framework.Console | |||
106 | 106 | ||
107 | public override string ReadLine(string p, bool isCommand, bool e) | 107 | public override string ReadLine(string p, bool isCommand, bool e) |
108 | { | 108 | { |
109 | if (isCommand) | ||
110 | Output("+++"+p); | ||
111 | else | ||
112 | Output("-++"+p); | ||
113 | |||
109 | m_DataEvent.WaitOne(); | 114 | m_DataEvent.WaitOne(); |
110 | 115 | ||
116 | string cmdinput; | ||
117 | |||
111 | lock (m_InputData) | 118 | lock (m_InputData) |
112 | { | 119 | { |
113 | if (m_InputData.Count == 0) | 120 | if (m_InputData.Count == 0) |
@@ -116,29 +123,30 @@ namespace OpenSim.Framework.Console | |||
116 | return ""; | 123 | return ""; |
117 | } | 124 | } |
118 | 125 | ||
119 | string cmdinput = m_InputData[0]; | 126 | cmdinput = m_InputData[0]; |
120 | m_InputData.RemoveAt(0); | 127 | m_InputData.RemoveAt(0); |
121 | if (m_InputData.Count == 0) | 128 | if (m_InputData.Count == 0) |
122 | m_DataEvent.Reset(); | 129 | m_DataEvent.Reset(); |
123 | 130 | ||
124 | if (isCommand) | 131 | } |
132 | |||
133 | if (isCommand) | ||
134 | { | ||
135 | string[] cmd = Commands.Resolve(Parser.Parse(cmdinput)); | ||
136 | |||
137 | if (cmd.Length != 0) | ||
125 | { | 138 | { |
126 | string[] cmd = Commands.Resolve(Parser.Parse(cmdinput)); | 139 | int i; |
127 | 140 | ||
128 | if (cmd.Length != 0) | 141 | for (i=0 ; i < cmd.Length ; i++) |
129 | { | 142 | { |
130 | int i; | 143 | if (cmd[i].Contains(" ")) |
131 | 144 | cmd[i] = "\"" + cmd[i] + "\""; | |
132 | for (i=0 ; i < cmd.Length ; i++) | ||
133 | { | ||
134 | if (cmd[i].Contains(" ")) | ||
135 | cmd[i] = "\"" + cmd[i] + "\""; | ||
136 | } | ||
137 | return String.Empty; | ||
138 | } | 145 | } |
146 | return String.Empty; | ||
139 | } | 147 | } |
140 | return cmdinput; | ||
141 | } | 148 | } |
149 | return cmdinput; | ||
142 | } | 150 | } |
143 | 151 | ||
144 | private void DoExpire() | 152 | private void DoExpire() |
@@ -308,7 +316,7 @@ namespace OpenSim.Framework.Console | |||
308 | return reply; | 316 | return reply; |
309 | } | 317 | } |
310 | 318 | ||
311 | if (post["COMMAND"] == null || post["COMMAND"].ToString() == String.Empty) | 319 | if (post["COMMAND"] == null) |
312 | return reply; | 320 | return reply; |
313 | 321 | ||
314 | lock (m_InputData) | 322 | lock (m_InputData) |
diff --git a/OpenSim/Server/Base/ServicesServerBase.cs b/OpenSim/Server/Base/ServicesServerBase.cs index 63ba673..a5bebb8 100644 --- a/OpenSim/Server/Base/ServicesServerBase.cs +++ b/OpenSim/Server/Base/ServicesServerBase.cs | |||
@@ -236,6 +236,11 @@ namespace OpenSim.Server.Base | |||
236 | Initialise(); | 236 | Initialise(); |
237 | } | 237 | } |
238 | 238 | ||
239 | public bool Running | ||
240 | { | ||
241 | get { return m_Running; } | ||
242 | } | ||
243 | |||
239 | public virtual int Run() | 244 | public virtual int Run() |
240 | { | 245 | { |
241 | while (m_Running) | 246 | while (m_Running) |