0.1-prestable
MW 2007-05-07 16:23:33 +00:00
parent 40eb8bc8b6
commit 3d0fff1c09
1 changed files with 104 additions and 96 deletions

View File

@ -150,22 +150,28 @@ namespace OpenSim
m_console.WriteLine("Starting in Grid mode"); m_console.WriteLine("Starting in Grid mode");
} }
try { try
GridServers.Initialise(); {
} catch (Exception e) { GridServers.Initialise();
m_console.WriteLine(e.Message + "\nSorry, could not setup the grid interface"); }
Environment.Exit(1); catch (Exception e)
} {
m_console.WriteLine(e.Message + "\nSorry, could not setup the grid interface");
Environment.Exit(1);
}
startuptime = DateTime.Now; startuptime = DateTime.Now;
try { try
AssetCache = new AssetCache(GridServers.AssetServer); {
InventoryCache = new InventoryCache(); AssetCache = new AssetCache(GridServers.AssetServer);
} catch (Exception e) { InventoryCache = new InventoryCache();
m_console.WriteLine(e.Message + "\nSorry, could not setup local cache"); }
Environment.Exit(1); catch (Exception e)
} {
m_console.WriteLine(e.Message + "\nSorry, could not setup local cache");
Environment.Exit(1);
}
PacketServer packetServer = new PacketServer(this); PacketServer packetServer = new PacketServer(this);
@ -199,14 +205,17 @@ 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 { try
regionData.RegionLocX = Convert.ToUInt32(((RemoteGridBase)(GridServers.GridServer)).GridData["region_locx"].ToString()); {
regionData.RegionLocY = Convert.ToUInt32(((RemoteGridBase)(GridServers.GridServer)).GridData["region_locy"].ToString()); regionData.RegionLocX = Convert.ToUInt32(((RemoteGridBase)(GridServers.GridServer)).GridData["region_locx"].ToString());
regionData.RegionName = ((RemoteGridBase)(GridServers.GridServer)).GridData["regionname"].ToString(); regionData.RegionLocY = Convert.ToUInt32(((RemoteGridBase)(GridServers.GridServer)).GridData["region_locy"].ToString());
} catch(Exception e) { regionData.RegionName = ((RemoteGridBase)(GridServers.GridServer)).GridData["regionname"].ToString();
m_console.WriteLine(e.Message + "\nBAD ERROR! THIS SHOULD NOT HAPPEN! Bad GridData from the grid interface!!!! ZOMG!!!"); }
Environment.Exit(1); catch (Exception e)
} {
m_console.WriteLine(e.Message + "\nBAD ERROR! THIS SHOULD NOT HAPPEN! Bad GridData from the grid interface!!!! ZOMG!!!");
Environment.Exit(1);
}
} }
} }
@ -249,8 +258,8 @@ namespace OpenSim
if (gridServer.GetName() == "Remote") if (gridServer.GetName() == "Remote")
{ {
// should startup the OGS protocol server here // should startup the OGS protocol server here
// Are we actually using this? // Are we actually using this?
OGSServer = new OpenGridProtocolServer(this.regionData.IPListenPort - 500); // Changed so we can have more than one OGSServer per machine. OGSServer = new OpenGridProtocolServer(this.regionData.IPListenPort - 500); // Changed so we can have more than one OGSServer per machine.
// we are in Grid mode so set a XmlRpc handler to handle "expect_user" calls from the user server // we are in Grid mode so set a XmlRpc handler to handle "expect_user" calls from the user server
httpServer.AddXmlRPCHandler("expect_user", httpServer.AddXmlRPCHandler("expect_user",
@ -363,136 +372,135 @@ namespace OpenSim
// SandBoxMode // SandBoxMode
string attri = ""; string attri = "";
attri = configData.GetAttribute("SandBox"); attri = configData.GetAttribute("SandBox");
if ((attri == "")^(attri == "false")) if ((attri == "") || ((attri != "false") && (attri != "true")))
{ {
this.m_sandbox = false; this.m_sandbox = false;
configData.SetAttribute("SandBox", "false"); configData.SetAttribute("SandBox", "false");
} }
else if (attri == "true") else
{ {
this.m_sandbox = Convert.ToBoolean(attri); this.m_sandbox = Convert.ToBoolean(attri);
} else { }
m_console.WriteLine("Main.cs: SetupFromConfig() - Invalid value for SandBox attribute, terminating");
Environment.Exit(1);
}
// LoginServer // LoginServer
attri = ""; attri = "";
attri = configData.GetAttribute("LoginServer"); attri = configData.GetAttribute("LoginServer");
if ((attri == "")^(attri == "false")) if ((attri == "") || ((attri != "false") && (attri != "true")))
{ {
this.m_loginserver = false; this.m_loginserver = false;
configData.SetAttribute("LoginServer", "false"); configData.SetAttribute("LoginServer", "false");
} }
else if (attri == "true") else
{ {
this.m_loginserver = Convert.ToBoolean(attri); this.m_loginserver = Convert.ToBoolean(attri);
} else { }
m_console.WriteLine("Main.cs: SetupFromConfig() - Invalid value for LoginServer attribute, terminating");
Environment.Exit(1);
}
// Sandbox User accounts // Sandbox User accounts
attri = ""; attri = "";
attri = configData.GetAttribute("UserAccount"); attri = configData.GetAttribute("UserAccount");
if ((attri == "")^(attri == "false")) if ((attri == "") || ((attri != "false") && (attri != "true")))
{ {
this.user_accounts = false; this.user_accounts = false;
configData.SetAttribute("UserAccounts", "false"); configData.SetAttribute("UserAccounts", "false");
} }
else if (attri == "true") else if (attri == "true")
{ {
this.user_accounts = Convert.ToBoolean(attri); this.user_accounts = Convert.ToBoolean(attri);
} else { }
m_console.WriteLine("Main.cs: SetupFromConfig() - Invalid value for UserAccount attribute, terminating");
Environment.Exit(1);
}
// Grid mode hack to use local asset server // Grid mode hack to use local asset server
attri = ""; attri = "";
attri = configData.GetAttribute("LocalAssets"); attri = configData.GetAttribute("LocalAssets");
if ((attri == "")^(attri == "false")) if ((attri == "") || ((attri != "false") && (attri != "true")))
{ {
this.gridLocalAsset = false; this.gridLocalAsset = false;
configData.SetAttribute("LocalAssets", "false"); configData.SetAttribute("LocalAssets", "false");
} }
else if (attri == "true") else if (attri == "true")
{ {
this.gridLocalAsset = Convert.ToBoolean(attri); this.gridLocalAsset = Convert.ToBoolean(attri);
} else { }
m_console.WriteLine("Main.cs: SetupFromConfig() - Invalid value for LocalAssets attribute, terminating");
}
attri = ""; attri = "";
attri = configData.GetAttribute("PhysicsEngine"); attri = configData.GetAttribute("PhysicsEngine");
switch(attri) { switch (attri)
default: {
m_console.WriteLine("Main.cs: SetupFromConfig() - Invalid value for PhysicsEngine attribute, terminating"); default:
Environment.Exit(1); m_console.WriteLine("Main.cs: SetupFromConfig() - Invalid value for PhysicsEngine attribute, terminating");
break; Environment.Exit(1);
break;
case "":
this.m_physicsEngine = "basicphysics";
configData.SetAttribute("PhysicsEngine", "basicphysics");
OpenSim.world.Avatar.PhysicsEngineFlying = false;
break;
case "RealPhysX": case "":
this.m_physicsEngine = "RealPhysX"; this.m_physicsEngine = "basicphysics";
OpenSim.world.Avatar.PhysicsEngineFlying = true; configData.SetAttribute("PhysicsEngine", "basicphysics");
break; OpenSim.world.Avatar.PhysicsEngineFlying = false;
break;
case "OpenDynamicsEngine":
this.m_physicsEngine = "OpenDynamicsEngine"; case "basicphysics":
OpenSim.world.Avatar.PhysicsEngineFlying = true; this.m_physicsEngine = "basicphysics";
break; configData.SetAttribute("PhysicsEngine", "basicphysics");
} OpenSim.world.Avatar.PhysicsEngineFlying = false;
break;
case "RealPhysX":
this.m_physicsEngine = "RealPhysX";
OpenSim.world.Avatar.PhysicsEngineFlying = true;
break;
case "OpenDynamicsEngine":
this.m_physicsEngine = "OpenDynamicsEngine";
OpenSim.world.Avatar.PhysicsEngineFlying = true;
break;
}
configData.Commit(); configData.Commit();
} }
catch (Exception e) catch (Exception e)
{ {
Console.WriteLine(e.Message); Console.WriteLine(e.Message);
Console.WriteLine("\nSorry, a fatal error occurred while trying to initialise the configuration data"); Console.WriteLine("\nSorry, a fatal error occurred while trying to initialise the configuration data");
Console.WriteLine("Can not continue starting up"); Console.WriteLine("Can not continue starting up");
Environment.Exit(1); Environment.Exit(1);
} }
} }
private SimConfig LoadConfigDll(string dllName) private SimConfig LoadConfigDll(string dllName)
{ {
try { try
Assembly pluginAssembly = Assembly.LoadFrom(dllName);
SimConfig config = null;
foreach (Type pluginType in pluginAssembly.GetTypes())
{ {
if (pluginType.IsPublic) Assembly pluginAssembly = Assembly.LoadFrom(dllName);
SimConfig config = null;
foreach (Type pluginType in pluginAssembly.GetTypes())
{ {
if (!pluginType.IsAbstract) if (pluginType.IsPublic)
{ {
Type typeInterface = pluginType.GetInterface("ISimConfig", true); if (!pluginType.IsAbstract)
if (typeInterface != null)
{ {
ISimConfig plug = (ISimConfig)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); Type typeInterface = pluginType.GetInterface("ISimConfig", true);
config = plug.GetConfigObject();
break;
}
typeInterface = null; if (typeInterface != null)
{
ISimConfig plug = (ISimConfig)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
config = plug.GetConfigObject();
break;
}
typeInterface = null;
}
} }
} }
pluginAssembly = null;
return config;
}
catch (Exception e)
{
m_console.WriteLine(e.Message + "\nSorry, a fatal error occurred while trying to load the config DLL");
m_console.WriteLine("Can not continue starting up");
Environment.Exit(1);
return null;
} }
pluginAssembly = null;
return config;
} catch (Exception e) {
m_console.WriteLine(e.Message + "\nSorry, a fatal error occurred while trying to load the config DLL");
m_console.WriteLine("Can not continue starting up");
Environment.Exit(1);
return null;
}
} }
private void OnReceivedData(IAsyncResult result) private void OnReceivedData(IAsyncResult result)