In grid mode, add SuppressConsoleCommands flag to [GridService] so that we can stop misleading grid service only console commands from registering.

We need to do this because the simulator initializes and internal copy of the GridService in grid mode for internal purposes
bullet-2.82
Justin Clark-Casey (justincc) 2014-07-18 22:57:04 +01:00
parent a26d1ffc66
commit 6048dfcd71
3 changed files with 23 additions and 18 deletions

View File

@ -94,15 +94,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
private void InitialiseService(IConfigSource source)
{
IConfig assetConfig = source.Configs["GridService"];
if (assetConfig == null)
IConfig config = source.Configs["GridService"];
if (config == null)
{
m_log.Error("[LOCAL GRID SERVICE CONNECTOR]: GridService missing from OpenSim.ini");
return;
}
string serviceDll = assetConfig.GetString("LocalServiceModule",
String.Empty);
string serviceDll = config.GetString("LocalServiceModule", String.Empty);
if (serviceDll == String.Empty)
{

View File

@ -64,6 +64,9 @@ namespace OpenSim.Services.GridService
m_config = config;
IConfig gridConfig = config.Configs["GridService"];
bool suppressConsoleCommands = false;
if (gridConfig != null)
{
m_DeleteOnUnregister = gridConfig.GetBoolean("DeleteOnUnregister", true);
@ -77,13 +80,17 @@ namespace OpenSim.Services.GridService
}
m_AllowDuplicateNames = gridConfig.GetBoolean("AllowDuplicateNames", m_AllowDuplicateNames);
m_AllowHypergridMapSearch = gridConfig.GetBoolean("AllowHypergridMapSearch", m_AllowHypergridMapSearch);
// This service is also used locally by a simulator running in grid mode. This switches prevents
// inappropriate console commands from being registered
suppressConsoleCommands = gridConfig.GetBoolean("SuppressConsoleCommands", suppressConsoleCommands);
}
if (m_RootInstance == null)
{
m_RootInstance = this;
if (MainConsole.Instance != null)
if (!suppressConsoleCommands && MainConsole.Instance != null)
{
MainConsole.Instance.Commands.AddCommand("Regions", true,
"deregister region id",
@ -92,17 +99,12 @@ namespace OpenSim.Services.GridService
String.Empty,
HandleDeregisterRegion);
// A messy way of stopping this command being added if we are in standalone (since the simulator
// has an identically named command
//
// XXX: We're relying on the OpenSimulator version being registered first, which is not well defined.
if (!MainConsole.Instance.Commands.HasCommand("show regions"))
MainConsole.Instance.Commands.AddCommand("Regions", true,
"show regions",
"show regions",
"Show details on all regions",
String.Empty,
HandleShowRegions);
MainConsole.Instance.Commands.AddCommand("Regions", true,
"show regions",
"show regions",
"Show details on all regions",
String.Empty,
HandleShowRegions);
MainConsole.Instance.Commands.AddCommand("Regions", true,
"show region name",
@ -132,6 +134,7 @@ namespace OpenSim.Services.GridService
String.Empty,
HandleSetFlags);
}
m_HypergridLinker = new HypergridLinker(m_config, this, m_Database);
}
}

View File

@ -55,8 +55,11 @@
LocalServiceModule = "OpenSim.Services.GridService.dll:GridService"
; for the LocalGridServicesConnector which is used by the Remote one
StorageProvider = "OpenSim.Data.Null.dll:NullRegionData"
NetworkConnector = "OpenSim.Services.Connectors.dll:GridServicesConnector"
; Because LocalGridServicesConnector starts this service, in grid mode we need to suppress
; the inappropriate console commands that it registers.
SuppressConsoleCommands = true
[LibraryService]
LocalServiceModule = "OpenSim.Services.InventoryService.dll:LibraryService"