diff options
author | Melanie | 2019-08-21 21:15:58 +0100 |
---|---|---|
committer | Melanie | 2019-08-21 21:15:58 +0100 |
commit | 7e136c67fd89f6c559420093acdee867967773bb (patch) | |
tree | 6b9f5d4d81dff6821937684a5baf1e6c3ad75efc | |
parent | Massive console refactor. Greatly simplify interface. (diff) | |
download | opensim-SC-7e136c67fd89f6c559420093acdee867967773bb.zip opensim-SC-7e136c67fd89f6c559420093acdee867967773bb.tar.gz opensim-SC-7e136c67fd89f6c559420093acdee867967773bb.tar.bz2 opensim-SC-7e136c67fd89f6c559420093acdee867967773bb.tar.xz |
Call SetServer on consoles reflectively to avoid having type checks in places where it tends to be forgotten to update them.
-rwxr-xr-x | OpenSim/Framework/Console/RemoteConsole.cs | 2 | ||||
-rwxr-xr-x[-rw-r--r--] | OpenSim/Framework/ICommandConsole.cs | 0 | ||||
-rwxr-xr-x | OpenSim/Framework/IConsole.cs | 2 | ||||
-rwxr-xr-x | OpenSim/Region/Application/OpenSim.cs | 13 | ||||
-rwxr-xr-x[-rw-r--r--] | OpenSim/Server/Base/HttpServerBase.cs | 8 |
5 files changed, 14 insertions, 11 deletions
diff --git a/OpenSim/Framework/Console/RemoteConsole.cs b/OpenSim/Framework/Console/RemoteConsole.cs index 16b4636..11006a9 100755 --- a/OpenSim/Framework/Console/RemoteConsole.cs +++ b/OpenSim/Framework/Console/RemoteConsole.cs | |||
@@ -46,6 +46,8 @@ namespace OpenSim.Framework.Console | |||
46 | // | 46 | // |
47 | public class RemoteConsole : CommandConsole | 47 | public class RemoteConsole : CommandConsole |
48 | { | 48 | { |
49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
50 | |||
49 | // Connection specific data, indexed by a session ID | 51 | // Connection specific data, indexed by a session ID |
50 | // we create when a client connects. | 52 | // we create when a client connects. |
51 | protected class ConsoleConnection | 53 | protected class ConsoleConnection |
diff --git a/OpenSim/Framework/ICommandConsole.cs b/OpenSim/Framework/ICommandConsole.cs index 3db2765..3db2765 100644..100755 --- a/OpenSim/Framework/ICommandConsole.cs +++ b/OpenSim/Framework/ICommandConsole.cs | |||
diff --git a/OpenSim/Framework/IConsole.cs b/OpenSim/Framework/IConsole.cs index 963e07f..22f62df 100755 --- a/OpenSim/Framework/IConsole.cs +++ b/OpenSim/Framework/IConsole.cs | |||
@@ -38,7 +38,7 @@ namespace OpenSim.Framework | |||
38 | 38 | ||
39 | string Prompt(string p, string def = null, List<char> excludedCharacters = null, bool echo = true); | 39 | string Prompt(string p, string def = null, List<char> excludedCharacters = null, bool echo = true); |
40 | 40 | ||
41 | // Displays a command prompt and returns a default value, user may only enter 1 of 2 options | 41 | // Displays a prompt and returns a default value, user may only enter 1 of 2 options |
42 | string Prompt(string prompt, string defaultresponse, List<string> options); | 42 | string Prompt(string prompt, string defaultresponse, List<string> options); |
43 | } | 43 | } |
44 | } \ No newline at end of file | 44 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 6a56a36..5cfca6c 100755 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs | |||
@@ -49,6 +49,7 @@ using OpenSim.Framework.Monitoring; | |||
49 | using OpenSim.Region.Framework.Interfaces; | 49 | using OpenSim.Region.Framework.Interfaces; |
50 | using OpenSim.Region.Framework.Scenes; | 50 | using OpenSim.Region.Framework.Scenes; |
51 | using OpenSim.Services.Interfaces; | 51 | using OpenSim.Services.Interfaces; |
52 | using OpenSim.Framework.Servers.HttpServer; | ||
52 | 53 | ||
53 | namespace OpenSim | 54 | namespace OpenSim |
54 | { | 55 | { |
@@ -228,16 +229,14 @@ namespace OpenSim | |||
228 | m_log.InfoFormat("[OPENSIM] Enabling remote managed stats fetch. URL = {0}", urlBase); | 229 | m_log.InfoFormat("[OPENSIM] Enabling remote managed stats fetch. URL = {0}", urlBase); |
229 | } | 230 | } |
230 | 231 | ||
231 | if (m_console is RemoteConsole) | 232 | MethodInfo mi = m_console.GetType().GetMethod("SetServer", BindingFlags.Public | BindingFlags.Instance, null, new Type[] { typeof(BaseHttpServer) }, null); |
233 | |||
234 | if (mi != null) | ||
232 | { | 235 | { |
233 | if (m_consolePort == 0) | 236 | if (m_consolePort == 0) |
234 | { | 237 | mi.Invoke(m_console, new object[] { m_httpServer }); |
235 | ((RemoteConsole)m_console).SetServer(m_httpServer); | ||
236 | } | ||
237 | else | 238 | else |
238 | { | 239 | mi.Invoke(m_console, new object[] { MainServer.GetHttpServer(m_consolePort) }); |
239 | ((RemoteConsole)m_console).SetServer(MainServer.GetHttpServer(m_consolePort)); | ||
240 | } | ||
241 | } | 240 | } |
242 | 241 | ||
243 | // Hook up to the watchdog timer | 242 | // Hook up to the watchdog timer |
diff --git a/OpenSim/Server/Base/HttpServerBase.cs b/OpenSim/Server/Base/HttpServerBase.cs index 3357250..5e76156 100644..100755 --- a/OpenSim/Server/Base/HttpServerBase.cs +++ b/OpenSim/Server/Base/HttpServerBase.cs | |||
@@ -149,12 +149,14 @@ namespace OpenSim.Server.Base | |||
149 | 149 | ||
150 | MainServer.RegisterHttpConsoleCommands(MainConsole.Instance); | 150 | MainServer.RegisterHttpConsoleCommands(MainConsole.Instance); |
151 | 151 | ||
152 | if (MainConsole.Instance is RemoteConsole) | 152 | MethodInfo mi = m_console.GetType().GetMethod("SetServer", BindingFlags.Public | BindingFlags.Instance, null, new Type[] { typeof(BaseHttpServer) }, null); |
153 | |||
154 | if (mi != null) | ||
153 | { | 155 | { |
154 | if (m_consolePort == 0) | 156 | if (m_consolePort == 0) |
155 | ((RemoteConsole)MainConsole.Instance).SetServer(MainServer.Instance); | 157 | mi.Invoke(MainConsole.Instance, new object[] { MainServer.Instance }); |
156 | else | 158 | else |
157 | ((RemoteConsole)MainConsole.Instance).SetServer(MainServer.GetHttpServer(m_consolePort)); | 159 | mi.Invoke(MainConsole.Instance, new object[] { MainServer.GetHttpServer(m_consolePort) }); |
158 | } | 160 | } |
159 | } | 161 | } |
160 | } | 162 | } |