From 4a3523bc67d16e9f5e07c65ab8fba88f49423171 Mon Sep 17 00:00:00 2001 From: Dr Scofield Date: Thu, 28 Aug 2008 07:37:16 +0000 Subject: this fixes the crash reported by mantis #2046: user server crashing if no OpenSim.ini file found by GridInfoService. GridInfoService now will just issue a warning that GridInfo will NOT be available to your users if no OpenSim.ini file is available. due to the static nature of UserConfig (configuration options hardcoded) i don't think it's currently an option to move GridInfo into user_server.xml but if anyone wants to look into this i'd be delighted... --- .../Framework/Communications/GridInfoService.cs | 27 +++++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/OpenSim/Framework/Communications/GridInfoService.cs b/OpenSim/Framework/Communications/GridInfoService.cs index ad60638..ce66c82 100644 --- a/OpenSim/Framework/Communications/GridInfoService.cs +++ b/OpenSim/Framework/Communications/GridInfoService.cs @@ -57,6 +57,27 @@ namespace OpenSim.Framework.Communications /// public GridInfoService(IConfigSource configSource) { + loadGridInfo(configSource); + } + + /// + /// Default constructor, uses OpenSim.ini. + /// + public GridInfoService() + { + try + { + IConfigSource configSource = new IniConfigSource(Path.Combine(Util.configDir(), "OpenSim.ini")); + loadGridInfo(configSource); + } + catch (FileNotFoundException) + { + _log.Warn("[GridInfoService] no OpenSim.ini file found --- GridInfoServices WILL NOT BE AVAILABLE to your users"); + } + } + + private void loadGridInfo(IConfigSource configSource) + { _info["platform"] = "OpenSim"; try { @@ -98,13 +119,7 @@ namespace OpenSim.Framework.Communications _log.Debug("[GridInfoService] cannot get grid info from config source, using minimal defaults"); } _log.InfoFormat("[GridInfoService] Grid info service initialized with {0} keys", _info.Count); - } - /// - /// Default constructor, uses OpenSim.ini. - /// - public GridInfoService() : this(new IniConfigSource(Path.Combine(Util.configDir(), "OpenSim.ini"))) - { } private void IssueWarning() -- cgit v1.1