aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Application/OpenSimController.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Application/OpenSimController.cs')
-rw-r--r--OpenSim/Region/Application/OpenSimController.cs68
1 files changed, 28 insertions, 40 deletions
diff --git a/OpenSim/Region/Application/OpenSimController.cs b/OpenSim/Region/Application/OpenSimController.cs
index da93b54..1fa4b04 100644
--- a/OpenSim/Region/Application/OpenSimController.cs
+++ b/OpenSim/Region/Application/OpenSimController.cs
@@ -1,28 +1,15 @@
1using System; 1using System;
2using System.Collections.Generic;
3using System.Collections; 2using System.Collections;
4using System.IO; 3using System.Net;
5using System.Text; 4using System.Timers;
6using Nini.Config; 5using Nwc.XmlRpc;
7using OpenSim.Framework.Communications.Cache; 6using OpenSim.Framework;
8using OpenSim.Framework.Console; 7using OpenSim.Framework.Console;
9using OpenSim.Framework.Interfaces;
10using OpenSim.Framework.Servers; 8using OpenSim.Framework.Servers;
11using OpenSim.Framework;
12using OpenSim.Framework;
13using OpenSim.Region.ClientStack;
14using OpenSim.Region.Communications.Local;
15using OpenSim.Region.Communications.OGS1;
16using OpenSim.Region.Environment;
17using OpenSim.Region.Environment.Scenes;
18using OpenSim.Region.Physics.Manager;
19using System.Globalization;
20using Nwc.XmlRpc;
21using RegionInfo = OpenSim.Framework.RegionInfo;
22 9
23namespace OpenSim 10namespace OpenSim
24{ 11{
25 class OpenSimController 12 internal class OpenSimController
26 { 13 {
27 private OpenSimMain m_app; 14 private OpenSimMain m_app;
28 private BaseHttpServer m_httpServer; 15 private BaseHttpServer m_httpServer;
@@ -44,22 +31,23 @@ namespace OpenSim
44 { 31 {
45 MainLog.Instance.Verbose("CONTROLLER", "Recieved Shutdown Administrator Request"); 32 MainLog.Instance.Verbose("CONTROLLER", "Recieved Shutdown Administrator Request");
46 XmlRpcResponse response = new XmlRpcResponse(); 33 XmlRpcResponse response = new XmlRpcResponse();
47 Hashtable requestData = (Hashtable)request.Params[0]; 34 Hashtable requestData = (Hashtable) request.Params[0];
48 35
49 if ((string)requestData["shutdown"] == "delayed") 36 if ((string) requestData["shutdown"] == "delayed")
50 { 37 {
51 int timeout = Convert.ToInt32((string)requestData["milliseconds"]); 38 int timeout = Convert.ToInt32((string) requestData["milliseconds"]);
52 39
53 Hashtable responseData = new Hashtable(); 40 Hashtable responseData = new Hashtable();
54 responseData["accepted"] = "true"; 41 responseData["accepted"] = "true";
55 response.Value = responseData; 42 response.Value = responseData;
56 43
57 m_app.SceneManager.SendGeneralMessage("Region is going down in " + ((int)(timeout / 1000)).ToString() + " second(s). Please save what you are doing and log out."); 44 m_app.SceneManager.SendGeneralMessage("Region is going down in " + ((int) (timeout/1000)).ToString() +
45 " second(s). Please save what you are doing and log out.");
58 46
59 // Perform shutdown 47 // Perform shutdown
60 System.Timers.Timer shutdownTimer = new System.Timers.Timer(timeout); // Wait before firing 48 Timer shutdownTimer = new Timer(timeout); // Wait before firing
61 shutdownTimer.AutoReset = false; 49 shutdownTimer.AutoReset = false;
62 shutdownTimer.Elapsed += new System.Timers.ElapsedEventHandler(shutdownTimer_Elapsed); 50 shutdownTimer.Elapsed += new ElapsedEventHandler(shutdownTimer_Elapsed);
63 51
64 return response; 52 return response;
65 } 53 }
@@ -72,15 +60,15 @@ namespace OpenSim
72 m_app.SceneManager.SendGeneralMessage("Region is going down now."); 60 m_app.SceneManager.SendGeneralMessage("Region is going down now.");
73 61
74 // Perform shutdown 62 // Perform shutdown
75 System.Timers.Timer shutdownTimer = new System.Timers.Timer(2000); // Wait 2 seconds before firing 63 Timer shutdownTimer = new Timer(2000); // Wait 2 seconds before firing
76 shutdownTimer.AutoReset = false; 64 shutdownTimer.AutoReset = false;
77 shutdownTimer.Elapsed += new System.Timers.ElapsedEventHandler(shutdownTimer_Elapsed); 65 shutdownTimer.Elapsed += new ElapsedEventHandler(shutdownTimer_Elapsed);
78 66
79 return response; 67 return response;
80 } 68 }
81 } 69 }
82 70
83 void shutdownTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) 71 private void shutdownTimer_Elapsed(object sender, ElapsedEventArgs e)
84 { 72 {
85 m_app.Shutdown(); 73 m_app.Shutdown();
86 } 74 }
@@ -89,28 +77,28 @@ namespace OpenSim
89 { 77 {
90 MainLog.Instance.Verbose("CONTROLLER", "Recieved Create Region Administrator Request"); 78 MainLog.Instance.Verbose("CONTROLLER", "Recieved Create Region Administrator Request");
91 XmlRpcResponse response = new XmlRpcResponse(); 79 XmlRpcResponse response = new XmlRpcResponse();
92 Hashtable requestData = (Hashtable)request.Params[0]; 80 Hashtable requestData = (Hashtable) request.Params[0];
93 81
94 RegionInfo newRegionData = new RegionInfo(); 82 RegionInfo newRegionData = new RegionInfo();
95 83
96 try 84 try
97 { 85 {
98 newRegionData.RegionID = (string)requestData["region_id"]; 86 newRegionData.RegionID = (string) requestData["region_id"];
99 newRegionData.RegionName = (string)requestData["region_name"]; 87 newRegionData.RegionName = (string) requestData["region_name"];
100 newRegionData.RegionLocX = Convert.ToUInt32((string)requestData["region_x"]); 88 newRegionData.RegionLocX = Convert.ToUInt32((string) requestData["region_x"]);
101 newRegionData.RegionLocY = Convert.ToUInt32((string)requestData["region_y"]); 89 newRegionData.RegionLocY = Convert.ToUInt32((string) requestData["region_y"]);
102 90
103 // Security risk 91 // Security risk
104 newRegionData.DataStore = (string)requestData["datastore"]; 92 newRegionData.DataStore = (string) requestData["datastore"];
105 93
106 newRegionData.InternalEndPoint = new System.Net.IPEndPoint( 94 newRegionData.InternalEndPoint = new IPEndPoint(
107 System.Net.IPAddress.Parse((string)requestData["listen_ip"]), 0); 95 IPAddress.Parse((string) requestData["listen_ip"]), 0);
108 96
109 newRegionData.InternalEndPoint.Port = Convert.ToInt32((string)requestData["listen_port"]); 97 newRegionData.InternalEndPoint.Port = Convert.ToInt32((string) requestData["listen_port"]);
110 newRegionData.ExternalHostName = (string)requestData["external_address"]; 98 newRegionData.ExternalHostName = (string) requestData["external_address"];
111 99
112 newRegionData.MasterAvatarFirstName = (string)requestData["region_master_first"]; 100 newRegionData.MasterAvatarFirstName = (string) requestData["region_master_first"];
113 newRegionData.MasterAvatarLastName = (string)requestData["region_master_last"]; 101 newRegionData.MasterAvatarLastName = (string) requestData["region_master_last"];
114 102
115 m_app.CreateRegion(newRegionData); 103 m_app.CreateRegion(newRegionData);
116 104
@@ -129,4 +117,4 @@ namespace OpenSim
129 return response; 117 return response;
130 } 118 }
131 } 119 }
132} 120} \ No newline at end of file