diff options
Diffstat (limited to 'OpenGrid.Framework.Manager/GridServerManager.cs')
-rw-r--r-- | OpenGrid.Framework.Manager/GridServerManager.cs | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/OpenGrid.Framework.Manager/GridServerManager.cs b/OpenGrid.Framework.Manager/GridServerManager.cs index c536e33..5c39cc1 100644 --- a/OpenGrid.Framework.Manager/GridServerManager.cs +++ b/OpenGrid.Framework.Manager/GridServerManager.cs | |||
@@ -2,7 +2,7 @@ using System; | |||
2 | using System.Collections; | 2 | using System.Collections; |
3 | using System.Collections.Generic; | 3 | using System.Collections.Generic; |
4 | using Nwc.XmlRpc; | 4 | using Nwc.XmlRpc; |
5 | 5 | using System.Threading; | |
6 | 6 | ||
7 | namespace OpenGrid.Framework.Manager { | 7 | namespace OpenGrid.Framework.Manager { |
8 | 8 | ||
@@ -19,18 +19,21 @@ namespace OpenGrid.Framework.Manager { | |||
19 | Hashtable requestData = (Hashtable)request.Params[0]; | 19 | Hashtable requestData = (Hashtable)request.Params[0]; |
20 | Hashtable responseData = new Hashtable(); | 20 | Hashtable responseData = new Hashtable(); |
21 | 21 | ||
22 | if((string)requestData["authkey"] != recvkey) { | 22 | responseData["msg"]="Shutdown command accepted"; |
23 | responseData["error"]="INVALID KEY"; | 23 | (new Thread(new ThreadStart(ZOMGServerIsNowTerminallyIll))).Start(); |
24 | } else { | ||
25 | responseData["msg"]="Shutdown command accepted"; | ||
26 | responseData["authkey"]=sendkey; | ||
27 | thecallback("shutdown"); | ||
28 | } | ||
29 | |||
30 | 24 | ||
31 | response.Value = responseData; | 25 | response.Value = responseData; |
32 | return response; | 26 | return response; |
33 | } | 27 | } |
28 | |||
29 | // Brought to by late-night coding | ||
30 | public static void ZOMGServerIsNowTerminallyIll() | ||
31 | { | ||
32 | Console.WriteLine("ZOMG! THIS SERVER IS TERMINALLY ILL - WE GOT A SHUTDOWN REQUEST FROM A GRID MANAGER!!!!"); | ||
33 | Console.WriteLine("We have 3 seconds to live..."); | ||
34 | Thread.Sleep(3000); | ||
35 | thecallback("shutdown"); | ||
36 | } | ||
34 | } | 37 | } |
35 | } | 38 | } |
36 | 39 | ||