diff --git a/OpenSim/Server/Base/HttpServerBase.cs b/OpenSim/Server/Base/HttpServerBase.cs index 6a1f37cf8f..ed0210f190 100644 --- a/OpenSim/Server/Base/HttpServerBase.cs +++ b/OpenSim/Server/Base/HttpServerBase.cs @@ -41,7 +41,7 @@ namespace OpenSim.Server.Base { // Logger // - // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private static readonly ILog m_Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); // The http server instance // @@ -55,8 +55,14 @@ namespace OpenSim.Server.Base get { return m_HttpServer; } } + public uint DefaultPort + { + get { return m_Port; } + } + public IHttpServer GetHttpServer(uint port) { + m_Log.InfoFormat("[SERVER]: Requested port {0}", port); if (port == m_Port) return HttpServer; @@ -64,6 +70,8 @@ namespace OpenSim.Server.Base return m_Servers[port]; m_Servers[port] = new BaseHttpServer(port); + m_Servers[port].Start(); + return m_Servers[port]; } diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs index db3a4cebc3..9beadd8110 100644 --- a/OpenSim/Server/Base/ServerUtils.cs +++ b/OpenSim/Server/Base/ServerUtils.cs @@ -141,7 +141,9 @@ namespace OpenSim.Server.Base } catch (Exception e) { - m_log.ErrorFormat("Error loading plugin from {0}, exception {1}", dllName, e.InnerException); + if (!(e is System.MissingMethodException)) + m_log.ErrorFormat("Error loading plugin from {0}, exception {1}", dllName, e.InnerException); + return null; } return plug; diff --git a/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs b/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs index 7c74e058f2..f7eb292091 100644 --- a/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs +++ b/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs @@ -37,13 +37,17 @@ namespace OpenSim.Server.Handlers.Asset public class AssetServiceConnector : ServiceConnector { private IAssetService m_AssetService; + private string m_ConfigName = "AssetService"; - public AssetServiceConnector(IConfigSource config, IHttpServer server) : - base(config, server) + public AssetServiceConnector(IConfigSource config, IHttpServer server, string configName) : + base(config, server, configName) { - IConfig serverConfig = config.Configs["AssetService"]; + if (configName != String.Empty) + m_ConfigName = configName; + + IConfig serverConfig = config.Configs[m_ConfigName]; if (serverConfig == null) - throw new Exception("No section 'Server' in config file"); + throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName)); string assetService = serverConfig.GetString("LocalServiceModule", String.Empty); @@ -55,7 +59,6 @@ namespace OpenSim.Server.Handlers.Asset m_AssetService = ServerUtils.LoadPlugin(assetService, args); - //System.Console.WriteLine("XXXXXXXXXXXXXXXXXXX m_AssetSetvice == null? " + ((m_AssetService == null) ? "yes" : "no")); server.AddStreamHandler(new AssetServerGetHandler(m_AssetService)); server.AddStreamHandler(new AssetServerPostHandler(m_AssetService)); server.AddStreamHandler(new AssetServerDeleteHandler(m_AssetService)); diff --git a/OpenSim/Server/Handlers/Authentication/AuthenticationServerConnector.cs b/OpenSim/Server/Handlers/Authentication/AuthenticationServerConnector.cs index 589dc3b424..2abef0a1c4 100644 --- a/OpenSim/Server/Handlers/Authentication/AuthenticationServerConnector.cs +++ b/OpenSim/Server/Handlers/Authentication/AuthenticationServerConnector.cs @@ -37,13 +37,17 @@ namespace OpenSim.Server.Handlers.Authentication public class AuthenticationServiceConnector : ServiceConnector { private IAuthenticationService m_AuthenticationService; + private string m_ConfigName = "AuthenticationService"; - public AuthenticationServiceConnector(IConfigSource config, IHttpServer server) : - base(config, server) + public AuthenticationServiceConnector(IConfigSource config, IHttpServer server, string configName) : + base(config, server, configName) { - IConfig serverConfig = config.Configs["AuthenticationService"]; + if (configName != String.Empty) + m_ConfigName = configName; + + IConfig serverConfig = config.Configs[m_ConfigName]; if (serverConfig == null) - throw new Exception("No section 'Server' in config file"); + throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName)); string authenticationService = serverConfig.GetString("AuthenticationServiceModule", String.Empty); diff --git a/OpenSim/Server/Handlers/Authorization/AuthorizationServerConnector.cs b/OpenSim/Server/Handlers/Authorization/AuthorizationServerConnector.cs index 0d9f239fe6..20fd0f78fd 100644 --- a/OpenSim/Server/Handlers/Authorization/AuthorizationServerConnector.cs +++ b/OpenSim/Server/Handlers/Authorization/AuthorizationServerConnector.cs @@ -37,13 +37,16 @@ namespace OpenSim.Server.Handlers.Authorization public class AuthorizationServerConnector : ServiceConnector { private IAuthorizationService m_AuthorizationService; + private string m_ConfigName = "AuthorizationService"; - public AuthorizationServerConnector(IConfigSource config, IHttpServer server) : - base(config, server) + public AuthorizationServerConnector(IConfigSource config, IHttpServer server, string configName) : + base(config, server, configName) { - IConfig serverConfig = config.Configs["AuthorizationService"]; + if (configName != String.Empty) + m_ConfigName = configName; + IConfig serverConfig = config.Configs[m_ConfigName]; if (serverConfig == null) - throw new Exception("No section 'Server' in config file"); + throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName)); string authorizationService = serverConfig.GetString("LocalServiceModule", String.Empty); diff --git a/OpenSim/Server/Handlers/Base/ServerConnector.cs b/OpenSim/Server/Handlers/Base/ServerConnector.cs index 62fe7738c7..71876dabbd 100644 --- a/OpenSim/Server/Handlers/Base/ServerConnector.cs +++ b/OpenSim/Server/Handlers/Base/ServerConnector.cs @@ -39,7 +39,7 @@ namespace OpenSim.Server.Handlers.Base public class ServiceConnector : IServiceConnector { - public ServiceConnector(IConfigSource config, IHttpServer server) + public ServiceConnector(IConfigSource config, IHttpServer server, string configName) { } } diff --git a/OpenSim/Server/Handlers/Freeswitch/FreeswitchServerConnector.cs b/OpenSim/Server/Handlers/Freeswitch/FreeswitchServerConnector.cs index a4ab0d3954..07bafc8c01 100644 --- a/OpenSim/Server/Handlers/Freeswitch/FreeswitchServerConnector.cs +++ b/OpenSim/Server/Handlers/Freeswitch/FreeswitchServerConnector.cs @@ -37,19 +37,23 @@ namespace OpenSim.Server.Handlers.Freeswitch public class FreeswitchServerConnector : ServiceConnector { private IFreeswitchService m_FreeswitchService; + private string m_ConfigName = "FreeswitchService"; - public FreeswitchServerConnector(IConfigSource config, IHttpServer server) : - base(config, server) + public FreeswitchServerConnector(IConfigSource config, IHttpServer server, string configName) : + base(config, server, configName) { - IConfig serverConfig = config.Configs["FreeswitchService"]; + if (configName != String.Empty) + m_ConfigName = configName; + + IConfig serverConfig = config.Configs[m_ConfigName]; if (serverConfig == null) - throw new Exception("No section 'Server' in config file"); + throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName)); string freeswitchService = serverConfig.GetString("LocalServiceModule", String.Empty); if (freeswitchService == String.Empty) - throw new Exception("No FreeswitchService in config file"); + throw new Exception("No LocalServiceModule in config file"); Object[] args = new Object[] { config }; m_FreeswitchService = diff --git a/OpenSim/Server/Handlers/Grid/GridServerConnector.cs b/OpenSim/Server/Handlers/Grid/GridServerConnector.cs index ebdf489ed5..14daf12fa0 100644 --- a/OpenSim/Server/Handlers/Grid/GridServerConnector.cs +++ b/OpenSim/Server/Handlers/Grid/GridServerConnector.cs @@ -37,19 +37,20 @@ namespace OpenSim.Server.Handlers.Grid public class GridServiceConnector : ServiceConnector { private IGridService m_GridService; + private string m_ConfigName = "GridService"; - public GridServiceConnector(IConfigSource config, IHttpServer server) : - base(config, server) + public GridServiceConnector(IConfigSource config, IHttpServer server, string configName) : + base(config, server, configName) { - IConfig serverConfig = config.Configs["GridService"]; + IConfig serverConfig = config.Configs[m_ConfigName]; if (serverConfig == null) - throw new Exception("No section 'Server' in config file"); + throw new Exception(String.Format("No section {0} in config file", m_ConfigName)); string gridService = serverConfig.GetString("LocalServiceModule", String.Empty); if (gridService == String.Empty) - throw new Exception("No GridService in config file"); + throw new Exception("No LocalServiceModule in config file"); Object[] args = new Object[] { config }; m_GridService = ServerUtils.LoadPlugin(gridService, args); diff --git a/OpenSim/Server/Handlers/Grid/HypergridServerConnector.cs b/OpenSim/Server/Handlers/Grid/HypergridServerConnector.cs index c47f652294..115ac29a2d 100644 --- a/OpenSim/Server/Handlers/Grid/HypergridServerConnector.cs +++ b/OpenSim/Server/Handlers/Grid/HypergridServerConnector.cs @@ -54,7 +54,7 @@ namespace OpenSim.Server.Handlers.Grid private IHyperlinkService m_HyperlinkService; public HypergridServiceInConnector(IConfigSource config, IHttpServer server, IHyperlinkService hyperService) : - base(config, server) + base(config, server, String.Empty) { m_HyperlinkService = hyperService; server.AddXmlRPCHandler("link_region", LinkRegionRequest, false); diff --git a/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs b/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs index 998b3228ed..ca452638ec 100644 --- a/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs +++ b/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs @@ -54,19 +54,20 @@ namespace OpenSim.Server.Handlers.Inventory //private AuthedSessionCache m_session_cache = new AuthedSessionCache(INVENTORY_DEFAULT_SESSION_TIME); private string m_userserver_url; + private string m_ConfigName = "InventoryService"; - public InventoryServiceInConnector(IConfigSource config, IHttpServer server) : - base(config, server) + public InventoryServiceInConnector(IConfigSource config, IHttpServer server, string configName) : + base(config, server, configName) { - IConfig serverConfig = config.Configs["InventoryService"]; + IConfig serverConfig = config.Configs[m_ConfigName]; if (serverConfig == null) - throw new Exception("No section 'InventoryService' in config file"); + throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName)); string inventoryService = serverConfig.GetString("LocalServiceModule", String.Empty); if (inventoryService == String.Empty) - throw new Exception("No InventoryService in config file"); + throw new Exception("No LocalServiceModule in config file"); Object[] args = new Object[] { config }; m_InventoryService = diff --git a/OpenSim/Server/Handlers/Land/LandServiceInConnector.cs b/OpenSim/Server/Handlers/Land/LandServiceInConnector.cs index 10e3b470e6..d368bd39ad 100644 --- a/OpenSim/Server/Handlers/Land/LandServiceInConnector.cs +++ b/OpenSim/Server/Handlers/Land/LandServiceInConnector.cs @@ -46,7 +46,7 @@ namespace OpenSim.Server.Handlers.Land // TODO : private IAuthenticationService m_AuthenticationService; public LandServiceInConnector(IConfigSource source, IHttpServer server, ILandService service, IScene scene) : - base(source, server) + base(source, server, String.Empty) { m_LandService = service; if (m_LandService == null) diff --git a/OpenSim/Server/Handlers/Neighbour/NeighbourServiceInConnector.cs b/OpenSim/Server/Handlers/Neighbour/NeighbourServiceInConnector.cs index b3a91cf2f9..ac2e75f042 100644 --- a/OpenSim/Server/Handlers/Neighbour/NeighbourServiceInConnector.cs +++ b/OpenSim/Server/Handlers/Neighbour/NeighbourServiceInConnector.cs @@ -46,7 +46,7 @@ namespace OpenSim.Server.Handlers.Neighbour private IAuthenticationService m_AuthenticationService = null; public NeighbourServiceInConnector(IConfigSource source, IHttpServer server, INeighbourService nService, IScene scene) : - base(source, server) + base(source, server, String.Empty) { m_NeighbourService = nService; diff --git a/OpenSim/Server/Handlers/Simulation/SimulationServiceInConnector.cs b/OpenSim/Server/Handlers/Simulation/SimulationServiceInConnector.cs index 0bb471315c..fe93fa544b 100644 --- a/OpenSim/Server/Handlers/Simulation/SimulationServiceInConnector.cs +++ b/OpenSim/Server/Handlers/Simulation/SimulationServiceInConnector.cs @@ -41,7 +41,7 @@ namespace OpenSim.Server.Handlers.Simulation private IAuthenticationService m_AuthenticationService; public SimulationServiceInConnector(IConfigSource config, IHttpServer server, IScene scene) : - base(config, server) + base(config, server, String.Empty) { IConfig serverConfig = config.Configs["SimulationService"]; if (serverConfig == null) diff --git a/OpenSim/Server/ServerMain.cs b/OpenSim/Server/ServerMain.cs index 01f2649d3c..a7b33c9739 100644 --- a/OpenSim/Server/ServerMain.cs +++ b/OpenSim/Server/ServerMain.cs @@ -96,29 +96,23 @@ namespace OpenSim.Server if (port != 0) server = m_Server.GetHttpServer(port); - m_log.InfoFormat("[SERVER]: Loading {0}", friendlyName); + if (port != m_Server.DefaultPort) + m_log.InfoFormat("[SERVER]: Loading {0} on port {1}", friendlyName, port); + else + m_log.InfoFormat("[SERVER]: Loading {0}", friendlyName); IServiceConnector connector = null; - try - { - Object[] modargs = null; - if (configName != string.Empty) - { - modargs = new Object[] { m_Server.Config, server, - configName }; - connector = ServerUtils.LoadPlugin(conn, - modargs); - } - if (connector == null) - { - modargs = new Object[] { m_Server.Config, server }; - connector = - ServerUtils.LoadPlugin(conn, - modargs); - } - } - catch (Exception) + + Object[] modargs = new Object[] { m_Server.Config, server, + configName }; + connector = ServerUtils.LoadPlugin(conn, + modargs); + if (connector == null) { + modargs = new Object[] { m_Server.Config, server }; + connector = + ServerUtils.LoadPlugin(conn, + modargs); } if (connector != null)