aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorlbsa712007-06-14 16:14:40 +0000
committerlbsa712007-06-14 16:14:40 +0000
commita8646ff159ea62d2569226cc13f283cd3794cbac (patch)
tree9897d72a8962fd5069858af71175e61c9de63442
parent* Added maintenance patch (issue #139) from BigfootAg to /trunk (diff)
downloadopensim-SC_OLD-a8646ff159ea62d2569226cc13f283cd3794cbac.zip
opensim-SC_OLD-a8646ff159ea62d2569226cc13f283cd3794cbac.tar.gz
opensim-SC_OLD-a8646ff159ea62d2569226cc13f283cd3794cbac.tar.bz2
opensim-SC_OLD-a8646ff159ea62d2569226cc13f283cd3794cbac.tar.xz
* teared out too wide catch clauses. See Code Conventions.
-rw-r--r--OpenSim/OpenSim/Application.cs7
-rw-r--r--OpenSim/OpenSim/OpenSimMain.cs239
2 files changed, 100 insertions, 146 deletions
diff --git a/OpenSim/OpenSim/Application.cs b/OpenSim/OpenSim/Application.cs
index 15fcd93..dec0029 100644
--- a/OpenSim/OpenSim/Application.cs
+++ b/OpenSim/OpenSim/Application.cs
@@ -123,13 +123,6 @@ namespace OpenSim
123 OpenSim.Framework.Console.MainConsole.Instance.MainConsolePrompt(); 123 OpenSim.Framework.Console.MainConsole.Instance.MainConsolePrompt();
124 } 124 }
125 } 125 }
126 catch (Exception oException)
127 {
128 Console.WriteLine(oException.Message);
129 Console.WriteLine("Fatal error. Server is shutdown. Press 'Enter' to close.");
130 Console.ReadLine();
131
132 }
133 finally 126 finally
134 { 127 {
135 /// Ensure that all sockets have been closed before the process closes. This helps ensure that no 128 /// Ensure that all sockets have been closed before the process closes. This helps ensure that no
diff --git a/OpenSim/OpenSim/OpenSimMain.cs b/OpenSim/OpenSim/OpenSimMain.cs
index c6ee7e9..0a316bd 100644
--- a/OpenSim/OpenSim/OpenSimMain.cs
+++ b/OpenSim/OpenSim/OpenSimMain.cs
@@ -78,15 +78,10 @@ namespace OpenSim
78 public override void StartUp() 78 public override void StartUp()
79 { 79 {
80 this.regionData = new RegionInfo(); 80 this.regionData = new RegionInfo();
81 try 81
82 { 82 this.localConfig = new XmlConfig(m_config);
83 this.localConfig = new XmlConfig(m_config); 83 this.localConfig.LoadData();
84 this.localConfig.LoadData(); 84
85 }
86 catch (Exception e)
87 {
88 Console.WriteLine(e.Message);
89 }
90 if (this.configFileSetup) 85 if (this.configFileSetup)
91 { 86 {
92 this.SetupFromConfigFile(this.localConfig); 87 this.SetupFromConfigFile(this.localConfig);
@@ -115,16 +110,10 @@ namespace OpenSim
115 110
116 startuptime = DateTime.Now; 111 startuptime = DateTime.Now;
117 112
118 try 113
119 { 114 AssetCache = new AssetCache(GridServers.AssetServer);
120 AssetCache = new AssetCache(GridServers.AssetServer); 115 InventoryCache = new InventoryCache();
121 InventoryCache = new InventoryCache(); 116
122 }
123 catch (Exception e)
124 {
125 m_console.Error(e.Message + "\nSorry, could not setup local cache");
126 Environment.Exit(1);
127 }
128 117
129 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); 118 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);
130 119
@@ -191,12 +180,12 @@ namespace OpenSim
191 if (this.m_sandbox) 180 if (this.m_sandbox)
192 { 181 {
193 OpenSim.Framework.User.UserProfile masterUser = adminLoginServer.LocalUserManager.GetProfileByName(this.regionData.MasterAvatarFirstName, this.regionData.MasterAvatarLastName); 182 OpenSim.Framework.User.UserProfile masterUser = adminLoginServer.LocalUserManager.GetProfileByName(this.regionData.MasterAvatarFirstName, this.regionData.MasterAvatarLastName);
194 if(masterUser == null) 183 if (masterUser == null)
195 { 184 {
196 m_console.Notice("Main.cs:Startup() - Sandbox Mode; Master Avatar is a new user; creating account."); 185 m_console.Notice("Main.cs:Startup() - Sandbox Mode; Master Avatar is a new user; creating account.");
197 adminLoginServer.CreateUserAccount(this.regionData.MasterAvatarFirstName, this.regionData.MasterAvatarLastName, this.regionData.MasterAvatarSandboxPassword); 186 adminLoginServer.CreateUserAccount(this.regionData.MasterAvatarFirstName, this.regionData.MasterAvatarLastName, this.regionData.MasterAvatarSandboxPassword);
198 masterUser = adminLoginServer.LocalUserManager.GetProfileByName(this.regionData.MasterAvatarFirstName, this.regionData.MasterAvatarLastName); 187 masterUser = adminLoginServer.LocalUserManager.GetProfileByName(this.regionData.MasterAvatarFirstName, this.regionData.MasterAvatarLastName);
199 if(masterUser == null) //Still NULL?!!?! OMG FAIL! 188 if (masterUser == null) //Still NULL?!!?! OMG FAIL!
200 { 189 {
201 throw new Exception("Failure to create master user account"); 190 throw new Exception("Failure to create master user account");
202 } 191 }
@@ -232,15 +221,7 @@ namespace OpenSim
232 221
233 m_console.Notice("Starting in Sandbox mode"); 222 m_console.Notice("Starting in Sandbox mode");
234 223
235 try 224 GridServers.Initialise();
236 {
237 GridServers.Initialise();
238 }
239 catch (Exception e)
240 {
241 m_console.Error(e.Message + "\nSorry, could not setup the grid interface");
242 Environment.Exit(1);
243 }
244 } 225 }
245 226
246 protected override void SetupRemoteGridServers() 227 protected override void SetupRemoteGridServers()
@@ -257,15 +238,9 @@ namespace OpenSim
257 238
258 m_console.Notice("Starting in Grid mode"); 239 m_console.Notice("Starting in Grid mode");
259 240
260 try 241
261 { 242 GridServers.Initialise();
262 GridServers.Initialise(); 243
263 }
264 catch (Exception e)
265 {
266 m_console.Error(e.Message + "\nSorry, could not setup the grid interface");
267 Environment.Exit(1);
268 }
269 } 244 }
270 245
271 protected override void SetupLocalWorld() 246 protected override void SetupLocalWorld()
@@ -310,7 +285,7 @@ namespace OpenSim
310 { 285 {
311 Hashtable requestData = (Hashtable)request.Params[0]; 286 Hashtable requestData = (Hashtable)request.Params[0];
312 uint circuitcode = Convert.ToUInt32(requestData["circuit_code"]); 287 uint circuitcode = Convert.ToUInt32(requestData["circuit_code"]);
313 288
314 AgentCircuitData agent_data = new AgentCircuitData(); 289 AgentCircuitData agent_data = new AgentCircuitData();
315 agent_data.firstname = (string)requestData["firstname"]; 290 agent_data.firstname = (string)requestData["firstname"];
316 agent_data.lastname = (string)requestData["lastname"]; 291 agent_data.lastname = (string)requestData["lastname"];
@@ -356,17 +331,12 @@ namespace OpenSim
356 { 331 {
357 // The grid server has told us who we are 332 // The grid server has told us who we are
358 // We must obey the grid server. 333 // We must obey the grid server.
359 try 334
360 { 335 regionData.RegionLocX = Convert.ToUInt32(((RemoteGridBase)(GridServers.GridServer)).GridData["region_locx"].ToString());
361 regionData.RegionLocX = Convert.ToUInt32(((RemoteGridBase)(GridServers.GridServer)).GridData["region_locx"].ToString()); 336 regionData.RegionLocY = Convert.ToUInt32(((RemoteGridBase)(GridServers.GridServer)).GridData["region_locy"].ToString());
362 regionData.RegionLocY = Convert.ToUInt32(((RemoteGridBase)(GridServers.GridServer)).GridData["region_locy"].ToString()); 337 regionData.RegionName = ((RemoteGridBase)(GridServers.GridServer)).GridData["regionname"].ToString();
363 regionData.RegionName = ((RemoteGridBase)(GridServers.GridServer)).GridData["regionname"].ToString(); 338
364 } 339
365 catch (Exception e)
366 {
367 m_console.Error("Did not recieve valid information from the grid server. " + e.ToString());
368 Environment.Exit(1);
369 }
370 } 340 }
371 } 341 }
372 342
@@ -374,102 +344,93 @@ namespace OpenSim
374 344
375 private void SetupFromConfigFile(IGenericConfig configData) 345 private void SetupFromConfigFile(IGenericConfig configData)
376 { 346 {
377 try
378 {
379 // SandBoxMode
380 string attri = "";
381 attri = configData.GetAttribute("SandBox");
382 if ((attri == "") || ((attri != "false") && (attri != "true")))
383 {
384 this.m_sandbox = false;
385 configData.SetAttribute("SandBox", "false");
386 }
387 else
388 {
389 this.m_sandbox = Convert.ToBoolean(attri);
390 }
391 347
392 // LoginServer 348 // SandBoxMode
393 attri = ""; 349 string attri = "";
394 attri = configData.GetAttribute("LoginServer"); 350 attri = configData.GetAttribute("SandBox");
395 if ((attri == "") || ((attri != "false") && (attri != "true"))) 351 if ((attri == "") || ((attri != "false") && (attri != "true")))
396 { 352 {
397 this.m_loginserver = false; 353 this.m_sandbox = false;
398 configData.SetAttribute("LoginServer", "false"); 354 configData.SetAttribute("SandBox", "false");
399 } 355 }
400 else 356 else
401 { 357 {
402 this.m_loginserver = Convert.ToBoolean(attri); 358 this.m_sandbox = Convert.ToBoolean(attri);
403 } 359 }
404 360
405 // Sandbox User accounts 361 // LoginServer
406 attri = ""; 362 attri = "";
407 attri = configData.GetAttribute("UserAccount"); 363 attri = configData.GetAttribute("LoginServer");
408 if ((attri == "") || ((attri != "false") && (attri != "true"))) 364 if ((attri == "") || ((attri != "false") && (attri != "true")))
409 { 365 {
410 this.user_accounts = false; 366 this.m_loginserver = false;
411 configData.SetAttribute("UserAccounts", "false"); 367 configData.SetAttribute("LoginServer", "false");
412 } 368 }
413 else if (attri == "true") 369 else
414 { 370 {
415 this.user_accounts = Convert.ToBoolean(attri); 371 this.m_loginserver = Convert.ToBoolean(attri);
416 } 372 }
417 373
418 // Grid mode hack to use local asset server 374 // Sandbox User accounts
419 attri = ""; 375 attri = "";
420 attri = configData.GetAttribute("LocalAssets"); 376 attri = configData.GetAttribute("UserAccount");
421 if ((attri == "") || ((attri != "false") && (attri != "true"))) 377 if ((attri == "") || ((attri != "false") && (attri != "true")))
422 { 378 {
423 this.gridLocalAsset = false; 379 this.user_accounts = false;
424 configData.SetAttribute("LocalAssets", "false"); 380 configData.SetAttribute("UserAccounts", "false");
425 } 381 }
426 else if (attri == "true") 382 else if (attri == "true")
427 { 383 {
428 this.gridLocalAsset = Convert.ToBoolean(attri); 384 this.user_accounts = Convert.ToBoolean(attri);
429 } 385 }
430 386
387 // Grid mode hack to use local asset server
388 attri = "";
389 attri = configData.GetAttribute("LocalAssets");
390 if ((attri == "") || ((attri != "false") && (attri != "true")))
391 {
392 this.gridLocalAsset = false;
393 configData.SetAttribute("LocalAssets", "false");
394 }
395 else if (attri == "true")
396 {
397 this.gridLocalAsset = Convert.ToBoolean(attri);
398 }
431 399
432 attri = "";
433 attri = configData.GetAttribute("PhysicsEngine");
434 switch (attri)
435 {
436 default:
437 m_console.Warn("Main.cs: SetupFromConfig() - Invalid value for PhysicsEngine attribute, terminating");
438 Environment.Exit(1);
439 break;
440
441 case "":
442 this.m_physicsEngine = "basicphysics";
443 configData.SetAttribute("PhysicsEngine", "basicphysics");
444 OpenSim.RegionServer.Simulator.Avatar.PhysicsEngineFlying = false;
445 break;
446
447 case "basicphysics":
448 this.m_physicsEngine = "basicphysics";
449 configData.SetAttribute("PhysicsEngine", "basicphysics");
450 OpenSim.RegionServer.Simulator.Avatar.PhysicsEngineFlying = false;
451 break;
452
453 case "RealPhysX":
454 this.m_physicsEngine = "RealPhysX";
455 OpenSim.RegionServer.Simulator.Avatar.PhysicsEngineFlying = true;
456 break;
457
458 case "OpenDynamicsEngine":
459 this.m_physicsEngine = "OpenDynamicsEngine";
460 OpenSim.RegionServer.Simulator.Avatar.PhysicsEngineFlying = true;
461 break;
462 }
463 400
464 configData.Commit(); 401 attri = "";
465 } 402 attri = configData.GetAttribute("PhysicsEngine");
466 catch (Exception e) 403 switch (attri)
467 { 404 {
468 m_console.Error(e.Message); 405 default:
469 m_console.Error("Sorry, a fatal error occurred while trying to initialise the configuration data"); 406 m_console.Warn("Main.cs: SetupFromConfig() - Invalid value for PhysicsEngine attribute, terminating");
470 m_console.Error("Can not continue starting up"); 407 Environment.Exit(1);
471 Environment.Exit(1); 408 break;
409
410 case "":
411 this.m_physicsEngine = "basicphysics";
412 configData.SetAttribute("PhysicsEngine", "basicphysics");
413 OpenSim.RegionServer.Simulator.Avatar.PhysicsEngineFlying = false;
414 break;
415
416 case "basicphysics":
417 this.m_physicsEngine = "basicphysics";
418 configData.SetAttribute("PhysicsEngine", "basicphysics");
419 OpenSim.RegionServer.Simulator.Avatar.PhysicsEngineFlying = false;
420 break;
421
422 case "RealPhysX":
423 this.m_physicsEngine = "RealPhysX";
424 OpenSim.RegionServer.Simulator.Avatar.PhysicsEngineFlying = true;
425 break;
426
427 case "OpenDynamicsEngine":
428 this.m_physicsEngine = "OpenDynamicsEngine";
429 OpenSim.RegionServer.Simulator.Avatar.PhysicsEngineFlying = true;
430 break;
472 } 431 }
432
433 configData.Commit();
473 } 434 }
474 435
475 /// <summary> 436 /// <summary>