Call SetServer on consoles reflectively to avoid having type checks in places where it tends to be forgotten to update them.

This commit is contained in:
Melanie
2019-08-21 21:15:58 +01:00
parent 0fd17c08ae
commit 7e136c67fd
5 changed files with 14 additions and 11 deletions

8
OpenSim/Server/Base/HttpServerBase.cs Normal file → Executable file
View File

@@ -149,12 +149,14 @@ namespace OpenSim.Server.Base
MainServer.RegisterHttpConsoleCommands(MainConsole.Instance);
if (MainConsole.Instance is RemoteConsole)
MethodInfo mi = m_console.GetType().GetMethod("SetServer", BindingFlags.Public | BindingFlags.Instance, null, new Type[] { typeof(BaseHttpServer) }, null);
if (mi != null)
{
if (m_consolePort == 0)
((RemoteConsole)MainConsole.Instance).SetServer(MainServer.Instance);
mi.Invoke(MainConsole.Instance, new object[] { MainServer.Instance });
else
((RemoteConsole)MainConsole.Instance).SetServer(MainServer.GetHttpServer(m_consolePort));
mi.Invoke(MainConsole.Instance, new object[] { MainServer.GetHttpServer(m_consolePort) });
}
}
}