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...
0.6.0-stable
Dr Scofield 2008-08-28 07:37:16 +00:00
parent 49f9bd8b68
commit 4a3523bc67
1 changed files with 21 additions and 6 deletions

View File

@ -56,6 +56,27 @@ namespace OpenSim.Framework.Communications
/// system. /// system.
/// </remarks> /// </remarks>
public GridInfoService(IConfigSource configSource) public GridInfoService(IConfigSource configSource)
{
loadGridInfo(configSource);
}
/// <summary>
/// Default constructor, uses OpenSim.ini.
/// </summary>
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"; _info["platform"] = "OpenSim";
try try
@ -98,13 +119,7 @@ namespace OpenSim.Framework.Communications
_log.Debug("[GridInfoService] cannot get grid info from config source, using minimal defaults"); _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); _log.InfoFormat("[GridInfoService] Grid info service initialized with {0} keys", _info.Count);
}
/// <summary>
/// Default constructor, uses OpenSim.ini.
/// </summary>
public GridInfoService() : this(new IniConfigSource(Path.Combine(Util.configDir(), "OpenSim.ini")))
{
} }
private void IssueWarning() private void IssueWarning()