From 20a9bf08f51351e1e0a9de94f184ff56cd572665 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Thu, 1 May 2008 18:04:42 +0000 Subject: * Rolled back a few changes. --- OpenSim/Grid/GridServer/GridManager.cs | 185 ++++++++++----------- OpenSim/Grid/GridServer/GridServerBase.cs | 60 ++++--- OpenSim/Grid/GridServer/IGridPlugin.cs | 2 +- OpenSim/Grid/GridServer/Program.cs | 2 +- OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs | 2 +- 5 files changed, 122 insertions(+), 129 deletions(-) (limited to 'OpenSim/Grid/GridServer') diff --git a/OpenSim/Grid/GridServer/GridManager.cs b/OpenSim/Grid/GridServer/GridManager.cs index 32f002a..7eb9c34 100644 --- a/OpenSim/Grid/GridServer/GridManager.cs +++ b/OpenSim/Grid/GridServer/GridManager.cs @@ -44,11 +44,11 @@ namespace OpenSim.Grid.GridServer { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private readonly Dictionary _logplugins = new Dictionary(); + private Dictionary _plugins = new Dictionary(); + private Dictionary _logplugins = new Dictionary(); // This is here so that the grid server can hand out MessageServer settings to regions on registration - private readonly List _MessageServers = new List(); - private readonly Dictionary _plugins = new Dictionary(); + private List _MessageServers = new List(); public GridConfig Config; @@ -72,7 +72,7 @@ namespace OpenSim.Grid.GridServer if (typeInterface != null) { IGridData plug = - (IGridData) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); + (IGridData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); plug.Initialise(); _plugins.Add(plug.getName(), plug); m_log.Info("[DATA]: Added IGridData Interface"); @@ -84,7 +84,7 @@ namespace OpenSim.Grid.GridServer if (typeInterface != null) { ILogData plug = - (ILogData) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); + (ILogData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); plug.Initialise(); _logplugins.Add(plug.getName(), plug); m_log.Info("[DATA]: Added ILogData Interface"); @@ -152,7 +152,7 @@ namespace OpenSim.Grid.GridServer } catch { - m_log.Warn("[storage]: Unable to find region " + handle + " via " + kvp.Key); + m_log.Warn("[storage]: Unable to find region " + handle.ToString() + " via " + kvp.Key); } } return null; @@ -218,20 +218,20 @@ namespace OpenSim.Grid.GridServer { if ( GetRegion( - Util.UIntsToLong((uint) ((central_region.regionLocX + x) * Constants.RegionSize), - (uint) (central_region.regionLocY + y) * Constants.RegionSize)) != null) + Util.UIntsToLong((uint)((central_region.regionLocX + x) * Constants.RegionSize), + (uint)(central_region.regionLocY + y) * Constants.RegionSize)) != null) { neighbour = GetRegion( - Util.UIntsToLong((uint) ((central_region.regionLocX + x) * Constants.RegionSize), - (uint) (central_region.regionLocY + y) * Constants.RegionSize)); + Util.UIntsToLong((uint)((central_region.regionLocX + x) * Constants.RegionSize), + (uint)(central_region.regionLocY + y) * Constants.RegionSize)); response += ""; response += "" + neighbour.serverIP + ""; - response += "" + neighbour.serverPort + ""; - response += "" + neighbour.regionLocX + ""; - response += "" + neighbour.regionLocY + ""; - response += "" + neighbour.regionHandle + ""; + response += "" + neighbour.serverPort.ToString() + ""; + response += "" + neighbour.regionLocX.ToString() + ""; + response += "" + neighbour.regionLocY.ToString() + ""; + response += "" + neighbour.regionHandle.ToString() + ""; response += ""; } } @@ -287,10 +287,10 @@ namespace OpenSim.Grid.GridServer RegionProfileData sim; RegionProfileData existingSim; - Hashtable requestData = (Hashtable) request.Params[0]; + Hashtable requestData = (Hashtable)request.Params[0]; LLUUID uuid; - if (!requestData.ContainsKey("UUID") || !LLUUID.TryParse((string) requestData["UUID"], out uuid)) + if (!requestData.ContainsKey("UUID") || !LLUUID.TryParse((string)requestData["UUID"], out uuid)) { m_log.Info("[GRID]: Region connected without a UUID, ignoring."); return ErrorResponse("No UUID passed to grid server - unable to connect you"); @@ -303,7 +303,7 @@ namespace OpenSim.Grid.GridServer catch (FormatException e) { m_log.Info("[GRID]: Invalid login parameters, ignoring."); - return ErrorResponse("Wrong format in login parameters. Please verify parameters." + e); + return ErrorResponse("Wrong format in login parameters. Please verify parameters." + e.ToString() ); } existingSim = GetRegion(sim.regionHandle); @@ -329,7 +329,7 @@ namespace OpenSim.Grid.GridServer { DataResponse insertResponse; - if (existingSim == null) + if( existingSim == null ) { insertResponse = kvp.Value.AddProfile(sim); } @@ -348,20 +348,20 @@ namespace OpenSim.Grid.GridServer break; case DataResponse.RESPONSE_INVALIDCREDENTIALS: m_log.Warn("[storage]: " + - "New sim creation failed (Invalid Credentials): " + sim.regionName); + "New sim creation failed (Invalid Credentials): " + sim.regionName); break; case DataResponse.RESPONSE_AUTHREQUIRED: m_log.Warn("[storage]: " + - "New sim creation failed (Authentication Required): " + - sim.regionName); + "New sim creation failed (Authentication Required): " + + sim.regionName); break; } } catch (Exception e) { m_log.Warn("[storage]: " + - "Unable to add region " + sim.UUID + " via " + kvp.Key); - m_log.Warn("[storage]: " + e); + "Unable to add region " + sim.UUID.ToString() + " via " + kvp.Key); + m_log.Warn("[storage]: " + e.ToString()); } } @@ -375,8 +375,7 @@ namespace OpenSim.Grid.GridServer { m_log.Warn("[grid]: Authentication failed when trying to add new region " + sim.regionName + " at location " + sim.regionLocX + - " " + sim.regionLocY + " with TheSim.regionRecvKey " + sim.regionRecvKey + "(" + Config.SimSendKey + - ") and TheSim.regionRecvKey " + sim.regionSendKey + "(" + Config.SimRecvKey + ") "); + " " + sim.regionLocY + " with TheSim.regionRecvKey " + sim.regionRecvKey + "(" + Config.SimSendKey + ") and TheSim.regionRecvKey " + sim.regionSendKey + "(" + Config.SimRecvKey + ") "); } else { @@ -390,8 +389,7 @@ namespace OpenSim.Grid.GridServer } else { - m_log.Warn("[grid]: Failed to add new region " + sim.regionName + " at location " + sim.regionLocX + " " + sim.regionLocY + - " currently occupied by " + existingSim.regionName); + m_log.Warn("[grid]: Failed to add new region " + sim.regionName + " at location " + sim.regionLocX + " " + sim.regionLocY + " currently occupied by " + existingSim.regionName); return ErrorResponse("Another region already exists at that location. Try another"); } } @@ -466,7 +464,7 @@ namespace OpenSim.Grid.GridServer foreach (KeyValuePair aSim in neighbours) { NeighbourBlock = new Hashtable(); - NeighbourBlock["sim_ip"] = Util.GetHostFromDNS(aSim.Value.serverIP).ToString(); + NeighbourBlock["sim_ip"] = Util.GetHostFromDNS(aSim.Value.serverIP.ToString()).ToString(); NeighbourBlock["sim_port"] = aSim.Value.serverPort.ToString(); NeighbourBlock["region_locx"] = aSim.Value.regionLocX.ToString(); NeighbourBlock["region_locy"] = aSim.Value.regionLocY.ToString(); @@ -487,13 +485,13 @@ namespace OpenSim.Grid.GridServer { if ( GetRegion( - Helpers.UIntsToLong((uint) ((sim.regionLocX + x) * Constants.RegionSize), - (uint) (sim.regionLocY + y) * Constants.RegionSize)) != null) + Helpers.UIntsToLong((uint)((sim.regionLocX + x) * Constants.RegionSize), + (uint)(sim.regionLocY + y) * Constants.RegionSize)) != null) { neighbour = GetRegion( - Helpers.UIntsToLong((uint) ((sim.regionLocX + x) * Constants.RegionSize), - (uint) (sim.regionLocY + y) * Constants.RegionSize)); + Helpers.UIntsToLong((uint)((sim.regionLocX + x) * Constants.RegionSize), + (uint)(sim.regionLocY + y) * Constants.RegionSize)); NeighbourBlock = new Hashtable(); NeighbourBlock["sim_ip"] = Util.GetHostFromDNS(neighbour.serverIP).ToString(); @@ -521,26 +519,27 @@ namespace OpenSim.Grid.GridServer RegionProfileData sim; sim = new RegionProfileData(); - sim.UUID = new LLUUID((string) requestData["UUID"]); - sim.originUUID = new LLUUID((string) requestData["originUUID"]); + sim.UUID = new LLUUID((string)requestData["UUID"]); + sim.originUUID = new LLUUID((string)requestData["originUUID"]); sim.regionRecvKey = String.Empty; sim.regionSendKey = String.Empty; - + if (requestData.ContainsKey("region_secret")) { - string regionsecret = (string) requestData["region_secret"]; + string regionsecret = (string)requestData["region_secret"]; if (regionsecret.Length > 0) sim.regionSecret = regionsecret; else sim.regionSecret = Config.SimRecvKey; + } else { sim.regionSecret = Config.SimRecvKey; } - - + + sim.regionDataURI = String.Empty; sim.regionAssetURI = Config.DefaultAssetServer; sim.regionAssetRecvKey = Config.AssetRecvKey; @@ -549,16 +548,16 @@ namespace OpenSim.Grid.GridServer sim.regionUserSendKey = Config.UserSendKey; sim.regionUserRecvKey = Config.UserRecvKey; - sim.serverIP = (string) requestData["sim_ip"]; - sim.serverPort = Convert.ToUInt32((string) requestData["sim_port"]); - sim.httpPort = Convert.ToUInt32((string) requestData["http_port"]); - sim.remotingPort = Convert.ToUInt32((string) requestData["remoting_port"]); - sim.regionLocX = Convert.ToUInt32((string) requestData["region_locx"]); - sim.regionLocY = Convert.ToUInt32((string) requestData["region_locy"]); + sim.serverIP = (string)requestData["sim_ip"]; + sim.serverPort = Convert.ToUInt32((string)requestData["sim_port"]); + sim.httpPort = Convert.ToUInt32((string)requestData["http_port"]); + sim.remotingPort = Convert.ToUInt32((string)requestData["remoting_port"]); + sim.regionLocX = Convert.ToUInt32((string)requestData["region_locx"]); + sim.regionLocY = Convert.ToUInt32((string)requestData["region_locy"]); sim.regionLocZ = 0; LLUUID textureID; - if (LLUUID.TryParse((string) requestData["map-image-id"], out textureID)) + if (LLUUID.TryParse((string)requestData["map-image-id"], out textureID)) { sim.regionMapTextureID = textureID; } @@ -571,23 +570,21 @@ namespace OpenSim.Grid.GridServer // // this particular section of the mod attempts to receive a value from the region's xml file by way of // OSG1GridServices for the region's owner - sim.owner_uuid = (string) requestData["master_avatar_uuid"]; + sim.owner_uuid = (string)requestData["master_avatar_uuid"]; try { - sim.regionRecvKey = (string) requestData["recvkey"]; - sim.regionSendKey = (string) requestData["authkey"]; - } - catch (KeyNotFoundException) - { + sim.regionRecvKey = (string)requestData["recvkey"]; + sim.regionSendKey = (string)requestData["authkey"]; } + catch (KeyNotFoundException) { } sim.regionHandle = Helpers.UIntsToLong((sim.regionLocX * Constants.RegionSize), (sim.regionLocY * Constants.RegionSize)); - sim.serverURI = (string) requestData["server_uri"]; + sim.serverURI = (string)requestData["server_uri"]; sim.httpServerURI = "http://" + sim.serverIP + ":" + sim.httpPort + "/"; - sim.regionName = (string) requestData["sim_name"]; + sim.regionName = (string)requestData["sim_name"]; return sim; } @@ -607,7 +604,7 @@ namespace OpenSim.Grid.GridServer //RegionProfileData TheSim = null; string uuid; - Hashtable requestData = (Hashtable) request.Params[0]; + Hashtable requestData = (Hashtable)request.Params[0]; if (requestData.ContainsKey("UUID")) { @@ -627,7 +624,7 @@ namespace OpenSim.Grid.GridServer //OpenSim.Data.MySQL.MySQLGridData dbengine = new OpenSim.Data.MySQL.MySQLGridData(); try { - MySQLGridData mysqldata = (MySQLGridData) (kvp.Value); + MySQLGridData mysqldata = (MySQLGridData)(kvp.Value); //DataResponse insertResponse = mysqldata.DeleteProfile(TheSim); DataResponse insertResponse = mysqldata.DeleteProfile(uuid); switch (insertResponse) @@ -667,22 +664,22 @@ namespace OpenSim.Grid.GridServer /// public XmlRpcResponse XmlRpcSimulatorDataRequestMethod(XmlRpcRequest request) { - Hashtable requestData = (Hashtable) request.Params[0]; + Hashtable requestData = (Hashtable)request.Params[0]; Hashtable responseData = new Hashtable(); RegionProfileData simData = null; if (requestData.ContainsKey("region_UUID")) { - simData = GetRegion(new LLUUID((string) requestData["region_UUID"])); + simData = GetRegion(new LLUUID((string)requestData["region_UUID"])); } else if (requestData.ContainsKey("region_handle")) { //CFK: The if/else below this makes this message redundant. //CFK: Console.WriteLine("requesting data for region " + (string) requestData["region_handle"]); - simData = GetRegion(Convert.ToUInt64((string) requestData["region_handle"])); + simData = GetRegion(Convert.ToUInt64((string)requestData["region_handle"])); } else if (requestData.ContainsKey("region_name_search")) { - simData = GetRegion((string) requestData["region_name_search"]); + simData = GetRegion((string)requestData["region_name_search"]); } if (simData == null) @@ -693,8 +690,8 @@ namespace OpenSim.Grid.GridServer } else { - m_log.Info("[DATA]: found " + simData.regionName + " regionHandle = " + - (string) requestData["region_handle"]); + m_log.Info("[DATA]: found " + (string)simData.regionName + " regionHandle = " + + (string)requestData["region_handle"]); responseData["sim_ip"] = Util.GetHostFromDNS(simData.serverIP).ToString(); responseData["sim_port"] = simData.serverPort.ToString(); responseData["server_uri"] = simData.serverURI; @@ -716,22 +713,22 @@ namespace OpenSim.Grid.GridServer { int xmin = 980, ymin = 980, xmax = 1020, ymax = 1020; - Hashtable requestData = (Hashtable) request.Params[0]; + Hashtable requestData = (Hashtable)request.Params[0]; if (requestData.ContainsKey("xmin")) { - xmin = (Int32) requestData["xmin"]; + xmin = (Int32)requestData["xmin"]; } if (requestData.ContainsKey("ymin")) { - ymin = (Int32) requestData["ymin"]; + ymin = (Int32)requestData["ymin"]; } if (requestData.ContainsKey("xmax")) { - xmax = (Int32) requestData["xmax"]; + xmax = (Int32)requestData["xmax"]; } if (requestData.ContainsKey("ymax")) { - ymax = (Int32) requestData["ymax"]; + ymax = (Int32)requestData["ymax"]; } //CFK: The second log is more meaningful and either standard or fast generally occurs. //CFK: m_log.Info("[MAP]: World map request for range (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")"); @@ -746,15 +743,15 @@ namespace OpenSim.Grid.GridServer if (fastMode) { Dictionary neighbours = - GetRegions((uint) xmin, (uint) ymin, (uint) xmax, (uint) ymax); + GetRegions((uint)xmin, (uint)ymin, (uint)xmax, (uint)ymax); foreach (KeyValuePair aSim in neighbours) { Hashtable simProfileBlock = new Hashtable(); simProfileBlock["x"] = aSim.Value.regionLocX.ToString(); simProfileBlock["y"] = aSim.Value.regionLocY.ToString(); - Console.WriteLine("send neighbour info for " + aSim.Value.regionLocX + " , " + - aSim.Value.regionLocY); + Console.WriteLine("send neighbour info for " + aSim.Value.regionLocX.ToString() + " , " + + aSim.Value.regionLocY.ToString()); simProfileBlock["name"] = aSim.Value.regionName; simProfileBlock["access"] = 21; simProfileBlock["region-flags"] = 512; @@ -764,15 +761,15 @@ namespace OpenSim.Grid.GridServer // For Sugilite compatibility simProfileBlock["regionhandle"] = aSim.Value.regionHandle.ToString(); - simProfileBlock["sim_ip"] = aSim.Value.serverIP; + simProfileBlock["sim_ip"] = aSim.Value.serverIP.ToString(); simProfileBlock["sim_port"] = aSim.Value.serverPort.ToString(); - simProfileBlock["sim_uri"] = aSim.Value.serverURI; + simProfileBlock["sim_uri"] = aSim.Value.serverURI.ToString(); simProfileBlock["uuid"] = aSim.Value.UUID.ToString(); simProfileBlock["remoting_port"] = aSim.Value.remotingPort; simProfileList.Add(simProfileBlock); } - m_log.Info("[MAP]: Fast map " + simProfileList.Count + + m_log.Info("[MAP]: Fast map " + simProfileList.Count.ToString() + " regions @ (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")"); } else @@ -782,7 +779,7 @@ namespace OpenSim.Grid.GridServer { for (int y = ymin; y < ymax + 1; y++) { - ulong regHandle = Helpers.UIntsToLong((uint) (x * Constants.RegionSize), (uint) (y * Constants.RegionSize)); + ulong regHandle = Helpers.UIntsToLong((uint)(x * Constants.RegionSize), (uint)(y * Constants.RegionSize)); simProfile = GetRegion(regHandle); if (simProfile != null) { @@ -798,16 +795,16 @@ namespace OpenSim.Grid.GridServer // For Sugilite compatibility simProfileBlock["regionhandle"] = simProfile.regionHandle.ToString(); - simProfileBlock["sim_ip"] = simProfile.serverIP; + simProfileBlock["sim_ip"] = simProfile.serverIP.ToString(); simProfileBlock["sim_port"] = simProfile.serverPort.ToString(); - simProfileBlock["sim_uri"] = simProfile.serverURI; + simProfileBlock["sim_uri"] = simProfile.serverURI.ToString(); simProfileBlock["uuid"] = simProfile.UUID.ToString(); simProfileList.Add(simProfileBlock); } } } - m_log.Info("[MAP]: Std map " + simProfileList.Count + + m_log.Info("[MAP]: Std map " + simProfileList.Count.ToString() + " regions @ (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")"); } @@ -863,12 +860,12 @@ namespace OpenSim.Grid.GridServer respstring = ""; respstring += "" + TheSim.regionSendKey + ""; respstring += ""; - respstring += "" + TheSim.UUID + ""; + respstring += "" + TheSim.UUID.ToString() + ""; respstring += "" + TheSim.regionName + ""; - respstring += "" + Util.GetHostFromDNS(TheSim.serverIP) + ""; - respstring += "" + TheSim.serverPort + ""; - respstring += "" + TheSim.regionLocX + ""; - respstring += "" + TheSim.regionLocY + ""; + respstring += "" + Util.GetHostFromDNS(TheSim.serverIP).ToString() + ""; + respstring += "" + TheSim.serverPort.ToString() + ""; + respstring += "" + TheSim.regionLocX.ToString() + ""; + respstring += "" + TheSim.regionLocY.ToString() + ""; respstring += "1"; respstring += ""; respstring += ""; @@ -949,12 +946,12 @@ namespace OpenSim.Grid.GridServer break; case "region_locx": - theSim.regionLocX = Convert.ToUInt32(simnode.ChildNodes[i].InnerText); + theSim.regionLocX = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText); theSim.regionHandle = Helpers.UIntsToLong((theSim.regionLocX * Constants.RegionSize), (theSim.regionLocY * Constants.RegionSize)); break; case "region_locy": - theSim.regionLocY = Convert.ToUInt32(simnode.ChildNodes[i].InnerText); + theSim.regionLocY = Convert.ToUInt32((string)simnode.ChildNodes[i].InnerText); theSim.regionHandle = Helpers.UIntsToLong((theSim.regionLocX * Constants.RegionSize), (theSim.regionLocY * Constants.RegionSize)); break; } @@ -1008,28 +1005,28 @@ namespace OpenSim.Grid.GridServer catch (Exception e) { m_log.Warn("[GRID]: GetRegionPlugin Handle " + kvp.Key + " unable to add new sim: " + - e); + e.ToString()); } } return "OK"; } catch (Exception e) { - return "ERROR! Could not save to database! (" + e + ")"; + return "ERROR! Could not save to database! (" + e.ToString() + ")"; } } public XmlRpcResponse XmlRPCRegisterMessageServer(XmlRpcRequest request) { XmlRpcResponse response = new XmlRpcResponse(); - Hashtable requestData = (Hashtable) request.Params[0]; + Hashtable requestData = (Hashtable)request.Params[0]; Hashtable responseData = new Hashtable(); if (requestData.Contains("uri")) { - string URI = (string) requestData["URI"]; - string sendkey = (string) requestData["sendkey"]; - string recvkey = (string) requestData["recvkey"]; + string URI = (string)requestData["URI"]; + string sendkey = (string)requestData["sendkey"]; + string recvkey = (string)requestData["recvkey"]; MessageServerInfo m = new MessageServerInfo(); m.URI = URI; m.sendkey = sendkey; @@ -1045,14 +1042,14 @@ namespace OpenSim.Grid.GridServer public XmlRpcResponse XmlRPCDeRegisterMessageServer(XmlRpcRequest request) { XmlRpcResponse response = new XmlRpcResponse(); - Hashtable requestData = (Hashtable) request.Params[0]; + Hashtable requestData = (Hashtable)request.Params[0]; Hashtable responseData = new Hashtable(); if (requestData.Contains("uri")) { - string URI = (string) requestData["uri"]; - string sendkey = (string) requestData["sendkey"]; - string recvkey = (string) requestData["recvkey"]; + string URI = (string)requestData["uri"]; + string sendkey = (string)requestData["sendkey"]; + string recvkey = (string)requestData["recvkey"]; MessageServerInfo m = new MessageServerInfo(); m.URI = URI; m.sendkey = sendkey; @@ -1065,4 +1062,4 @@ namespace OpenSim.Grid.GridServer return response; } } -} \ No newline at end of file +} diff --git a/OpenSim/Grid/GridServer/GridServerBase.cs b/OpenSim/Grid/GridServer/GridServerBase.cs index ac33a6c..2feaac3 100644 --- a/OpenSim/Grid/GridServer/GridServerBase.cs +++ b/OpenSim/Grid/GridServer/GridServerBase.cs @@ -44,34 +44,6 @@ namespace OpenSim.Grid.GridServer protected GridManager m_gridManager; protected List m_plugins = new List(); - public GridServerBase() - { - m_console = new ConsoleBase("OpenGrid", this); - MainConsole.Instance = m_console; - } - - #region conscmd_callback Members - - public override void RunCmd(string cmd, string[] cmdparams) - { - base.RunCmd(cmd, cmdparams); - - switch (cmd) - { - case "help": - m_console.Notice("shutdown - shutdown the grid (USE CAUTION!)"); - break; - - case "shutdown": - foreach (IGridPlugin plugin in m_plugins) plugin.Close(); - m_console.Close(); - Environment.Exit(0); - break; - } - } - - #endregion - public void Work() { m_console.Notice("Enter help for a list of commands\n"); @@ -82,6 +54,12 @@ namespace OpenSim.Grid.GridServer } } + public GridServerBase() + { + m_console = new ConsoleBase("OpenGrid", this); + MainConsole.Instance = m_console; + } + public void managercallback(string cmd) { switch (cmd) @@ -105,14 +83,14 @@ namespace OpenSim.Grid.GridServer AddHttpHandlers(); - LoadGridPlugins(); + LoadGridPlugins( ); m_httpServer.Start(); m_console.Status("[GRID]: Starting sim status checker"); Timer simCheckTimer = new Timer(3600000 * 3); // 3 Hours between updates. - simCheckTimer.Elapsed += CheckSims; + simCheckTimer.Elapsed += new ElapsedEventHandler(CheckSims); simCheckTimer.Enabled = true; } @@ -144,7 +122,7 @@ namespace OpenSim.Grid.GridServer foreach (TypeExtensionNode node in nodes) { m_console.Status("[GRIDPLUGINS]: Loading OpenSim plugin " + node.Path); - IGridPlugin plugin = (IGridPlugin) node.CreateInstance(); + IGridPlugin plugin = (IGridPlugin)node.CreateInstance(); plugin.Initialise(this); m_plugins.Add(plugin); } @@ -199,5 +177,23 @@ namespace OpenSim.Grid.GridServer } */ } + + public override void RunCmd(string cmd, string[] cmdparams) + { + base.RunCmd(cmd, cmdparams); + + switch (cmd) + { + case "help": + m_console.Notice("shutdown - shutdown the grid (USE CAUTION!)"); + break; + + case "shutdown": + foreach (IGridPlugin plugin in m_plugins) plugin.Close(); + m_console.Close(); + Environment.Exit(0); + break; + } + } } -} \ No newline at end of file +} diff --git a/OpenSim/Grid/GridServer/IGridPlugin.cs b/OpenSim/Grid/GridServer/IGridPlugin.cs index 40d208c..fbadfce 100644 --- a/OpenSim/Grid/GridServer/IGridPlugin.cs +++ b/OpenSim/Grid/GridServer/IGridPlugin.cs @@ -38,4 +38,4 @@ namespace OpenSim.Grid.GridServer void Initialise(GridServerBase gridServer); void Close(); } -} \ No newline at end of file +} diff --git a/OpenSim/Grid/GridServer/Program.cs b/OpenSim/Grid/GridServer/Program.cs index 06d8e3d..6eb4e15 100644 --- a/OpenSim/Grid/GridServer/Program.cs +++ b/OpenSim/Grid/GridServer/Program.cs @@ -50,4 +50,4 @@ namespace OpenSim.Grid.GridServer } } } -} \ No newline at end of file +} diff --git a/OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs b/OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs index 2b07547..1468edd 100644 --- a/OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs +++ b/OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs @@ -60,4 +60,4 @@ using System.Runtime.InteropServices; // [assembly : AssemblyVersion("1.0.0.0")] -[assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file +[assembly : AssemblyFileVersion("1.0.0.0")] -- cgit v1.1