* teared out too wide catch clauses. See Code Conventions.

afrisby
lbsa71 2007-06-14 16:14:40 +00:00
parent 16b43b8bff
commit a8646ff159
2 changed files with 104 additions and 150 deletions

View File

@ -123,13 +123,6 @@ namespace OpenSim
OpenSim.Framework.Console.MainConsole.Instance.MainConsolePrompt(); OpenSim.Framework.Console.MainConsole.Instance.MainConsolePrompt();
} }
} }
catch (Exception oException)
{
Console.WriteLine(oException.Message);
Console.WriteLine("Fatal error. Server is shutdown. Press 'Enter' to close.");
Console.ReadLine();
}
finally finally
{ {
/// Ensure that all sockets have been closed before the process closes. This helps ensure that no /// Ensure that all sockets have been closed before the process closes. This helps ensure that no

View File

@ -78,15 +78,10 @@ namespace OpenSim
public override void StartUp() public override void StartUp()
{ {
this.regionData = new RegionInfo(); this.regionData = new RegionInfo();
try
{ this.localConfig = new XmlConfig(m_config);
this.localConfig = new XmlConfig(m_config); this.localConfig.LoadData();
this.localConfig.LoadData();
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
if (this.configFileSetup) if (this.configFileSetup)
{ {
this.SetupFromConfigFile(this.localConfig); this.SetupFromConfigFile(this.localConfig);
@ -115,16 +110,10 @@ namespace OpenSim
startuptime = DateTime.Now; startuptime = DateTime.Now;
try
{ AssetCache = new AssetCache(GridServers.AssetServer);
AssetCache = new AssetCache(GridServers.AssetServer); InventoryCache = new InventoryCache();
InventoryCache = new InventoryCache();
}
catch (Exception e)
{
m_console.Error(e.Message + "\nSorry, could not setup local cache");
Environment.Exit(1);
}
m_udpServer = new UDPServer(this.regionData.IPListenPort, this.GridServers, this.AssetCache, this.InventoryCache, this.regionData, this.m_sandbox, this.user_accounts, this.m_console, this.AuthenticateSessionsHandler); m_udpServer = new UDPServer(this.regionData.IPListenPort, this.GridServers, this.AssetCache, this.InventoryCache, this.regionData, this.m_sandbox, this.user_accounts, this.m_console, this.AuthenticateSessionsHandler);
@ -191,12 +180,12 @@ namespace OpenSim
if (this.m_sandbox) if (this.m_sandbox)
{ {
OpenSim.Framework.User.UserProfile masterUser = adminLoginServer.LocalUserManager.GetProfileByName(this.regionData.MasterAvatarFirstName, this.regionData.MasterAvatarLastName); OpenSim.Framework.User.UserProfile masterUser = adminLoginServer.LocalUserManager.GetProfileByName(this.regionData.MasterAvatarFirstName, this.regionData.MasterAvatarLastName);
if(masterUser == null) if (masterUser == null)
{ {
m_console.Notice("Main.cs:Startup() - Sandbox Mode; Master Avatar is a new user; creating account."); m_console.Notice("Main.cs:Startup() - Sandbox Mode; Master Avatar is a new user; creating account.");
adminLoginServer.CreateUserAccount(this.regionData.MasterAvatarFirstName, this.regionData.MasterAvatarLastName, this.regionData.MasterAvatarSandboxPassword); adminLoginServer.CreateUserAccount(this.regionData.MasterAvatarFirstName, this.regionData.MasterAvatarLastName, this.regionData.MasterAvatarSandboxPassword);
masterUser = adminLoginServer.LocalUserManager.GetProfileByName(this.regionData.MasterAvatarFirstName, this.regionData.MasterAvatarLastName); masterUser = adminLoginServer.LocalUserManager.GetProfileByName(this.regionData.MasterAvatarFirstName, this.regionData.MasterAvatarLastName);
if(masterUser == null) //Still NULL?!!?! OMG FAIL! if (masterUser == null) //Still NULL?!!?! OMG FAIL!
{ {
throw new Exception("Failure to create master user account"); throw new Exception("Failure to create master user account");
} }
@ -232,15 +221,7 @@ namespace OpenSim
m_console.Notice("Starting in Sandbox mode"); m_console.Notice("Starting in Sandbox mode");
try GridServers.Initialise();
{
GridServers.Initialise();
}
catch (Exception e)
{
m_console.Error(e.Message + "\nSorry, could not setup the grid interface");
Environment.Exit(1);
}
} }
protected override void SetupRemoteGridServers() protected override void SetupRemoteGridServers()
@ -257,15 +238,9 @@ namespace OpenSim
m_console.Notice("Starting in Grid mode"); m_console.Notice("Starting in Grid mode");
try
{ GridServers.Initialise();
GridServers.Initialise();
}
catch (Exception e)
{
m_console.Error(e.Message + "\nSorry, could not setup the grid interface");
Environment.Exit(1);
}
} }
protected override void SetupLocalWorld() protected override void SetupLocalWorld()
@ -356,17 +331,12 @@ namespace OpenSim
{ {
// The grid server has told us who we are // The grid server has told us who we are
// We must obey the grid server. // We must obey the grid server.
try
{ regionData.RegionLocX = Convert.ToUInt32(((RemoteGridBase)(GridServers.GridServer)).GridData["region_locx"].ToString());
regionData.RegionLocX = Convert.ToUInt32(((RemoteGridBase)(GridServers.GridServer)).GridData["region_locx"].ToString()); regionData.RegionLocY = Convert.ToUInt32(((RemoteGridBase)(GridServers.GridServer)).GridData["region_locy"].ToString());
regionData.RegionLocY = Convert.ToUInt32(((RemoteGridBase)(GridServers.GridServer)).GridData["region_locy"].ToString()); regionData.RegionName = ((RemoteGridBase)(GridServers.GridServer)).GridData["regionname"].ToString();
regionData.RegionName = ((RemoteGridBase)(GridServers.GridServer)).GridData["regionname"].ToString();
}
catch (Exception e)
{
m_console.Error("Did not recieve valid information from the grid server. " + e.ToString());
Environment.Exit(1);
}
} }
} }
@ -374,102 +344,93 @@ namespace OpenSim
private void SetupFromConfigFile(IGenericConfig configData) private void SetupFromConfigFile(IGenericConfig configData)
{ {
try
// SandBoxMode
string attri = "";
attri = configData.GetAttribute("SandBox");
if ((attri == "") || ((attri != "false") && (attri != "true")))
{ {
// SandBoxMode this.m_sandbox = false;
string attri = ""; configData.SetAttribute("SandBox", "false");
attri = configData.GetAttribute("SandBox");
if ((attri == "") || ((attri != "false") && (attri != "true")))
{
this.m_sandbox = false;
configData.SetAttribute("SandBox", "false");
}
else
{
this.m_sandbox = Convert.ToBoolean(attri);
}
// LoginServer
attri = "";
attri = configData.GetAttribute("LoginServer");
if ((attri == "") || ((attri != "false") && (attri != "true")))
{
this.m_loginserver = false;
configData.SetAttribute("LoginServer", "false");
}
else
{
this.m_loginserver = Convert.ToBoolean(attri);
}
// Sandbox User accounts
attri = "";
attri = configData.GetAttribute("UserAccount");
if ((attri == "") || ((attri != "false") && (attri != "true")))
{
this.user_accounts = false;
configData.SetAttribute("UserAccounts", "false");
}
else if (attri == "true")
{
this.user_accounts = Convert.ToBoolean(attri);
}
// Grid mode hack to use local asset server
attri = "";
attri = configData.GetAttribute("LocalAssets");
if ((attri == "") || ((attri != "false") && (attri != "true")))
{
this.gridLocalAsset = false;
configData.SetAttribute("LocalAssets", "false");
}
else if (attri == "true")
{
this.gridLocalAsset = Convert.ToBoolean(attri);
}
attri = "";
attri = configData.GetAttribute("PhysicsEngine");
switch (attri)
{
default:
m_console.Warn("Main.cs: SetupFromConfig() - Invalid value for PhysicsEngine attribute, terminating");
Environment.Exit(1);
break;
case "":
this.m_physicsEngine = "basicphysics";
configData.SetAttribute("PhysicsEngine", "basicphysics");
OpenSim.RegionServer.Simulator.Avatar.PhysicsEngineFlying = false;
break;
case "basicphysics":
this.m_physicsEngine = "basicphysics";
configData.SetAttribute("PhysicsEngine", "basicphysics");
OpenSim.RegionServer.Simulator.Avatar.PhysicsEngineFlying = false;
break;
case "RealPhysX":
this.m_physicsEngine = "RealPhysX";
OpenSim.RegionServer.Simulator.Avatar.PhysicsEngineFlying = true;
break;
case "OpenDynamicsEngine":
this.m_physicsEngine = "OpenDynamicsEngine";
OpenSim.RegionServer.Simulator.Avatar.PhysicsEngineFlying = true;
break;
}
configData.Commit();
} }
catch (Exception e) else
{ {
m_console.Error(e.Message); this.m_sandbox = Convert.ToBoolean(attri);
m_console.Error("Sorry, a fatal error occurred while trying to initialise the configuration data");
m_console.Error("Can not continue starting up");
Environment.Exit(1);
} }
// LoginServer
attri = "";
attri = configData.GetAttribute("LoginServer");
if ((attri == "") || ((attri != "false") && (attri != "true")))
{
this.m_loginserver = false;
configData.SetAttribute("LoginServer", "false");
}
else
{
this.m_loginserver = Convert.ToBoolean(attri);
}
// Sandbox User accounts
attri = "";
attri = configData.GetAttribute("UserAccount");
if ((attri == "") || ((attri != "false") && (attri != "true")))
{
this.user_accounts = false;
configData.SetAttribute("UserAccounts", "false");
}
else if (attri == "true")
{
this.user_accounts = Convert.ToBoolean(attri);
}
// Grid mode hack to use local asset server
attri = "";
attri = configData.GetAttribute("LocalAssets");
if ((attri == "") || ((attri != "false") && (attri != "true")))
{
this.gridLocalAsset = false;
configData.SetAttribute("LocalAssets", "false");
}
else if (attri == "true")
{
this.gridLocalAsset = Convert.ToBoolean(attri);
}
attri = "";
attri = configData.GetAttribute("PhysicsEngine");
switch (attri)
{
default:
m_console.Warn("Main.cs: SetupFromConfig() - Invalid value for PhysicsEngine attribute, terminating");
Environment.Exit(1);
break;
case "":
this.m_physicsEngine = "basicphysics";
configData.SetAttribute("PhysicsEngine", "basicphysics");
OpenSim.RegionServer.Simulator.Avatar.PhysicsEngineFlying = false;
break;
case "basicphysics":
this.m_physicsEngine = "basicphysics";
configData.SetAttribute("PhysicsEngine", "basicphysics");
OpenSim.RegionServer.Simulator.Avatar.PhysicsEngineFlying = false;
break;
case "RealPhysX":
this.m_physicsEngine = "RealPhysX";
OpenSim.RegionServer.Simulator.Avatar.PhysicsEngineFlying = true;
break;
case "OpenDynamicsEngine":
this.m_physicsEngine = "OpenDynamicsEngine";
OpenSim.RegionServer.Simulator.Avatar.PhysicsEngineFlying = true;
break;
}
configData.Commit();
} }
/// <summary> /// <summary>