That shutdown function needs to call this....

Added nice little delay to give time for the XML-RPC response to go back to the grid manager when shutting down
zircon^2
gareth 2007-05-19 00:23:39 +00:00
parent e42c10fee5
commit 06734abf5f
1 changed files with 12 additions and 9 deletions

View File

@ -2,7 +2,7 @@ using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using Nwc.XmlRpc; using Nwc.XmlRpc;
using System.Threading;
namespace OpenGrid.Framework.Manager { namespace OpenGrid.Framework.Manager {
@ -19,18 +19,21 @@ namespace OpenGrid.Framework.Manager {
Hashtable requestData = (Hashtable)request.Params[0]; Hashtable requestData = (Hashtable)request.Params[0];
Hashtable responseData = new Hashtable(); Hashtable responseData = new Hashtable();
if((string)requestData["authkey"] != recvkey) {
responseData["error"]="INVALID KEY";
} else {
responseData["msg"]="Shutdown command accepted"; responseData["msg"]="Shutdown command accepted";
responseData["authkey"]=sendkey; (new Thread(new ThreadStart(ZOMGServerIsNowTerminallyIll))).Start();
thecallback("shutdown");
}
response.Value = responseData; response.Value = responseData;
return response; return response;
} }
// Brought to by late-night coding
public static void ZOMGServerIsNowTerminallyIll()
{
Console.WriteLine("ZOMG! THIS SERVER IS TERMINALLY ILL - WE GOT A SHUTDOWN REQUEST FROM A GRID MANAGER!!!!");
Console.WriteLine("We have 3 seconds to live...");
Thread.Sleep(3000);
thecallback("shutdown");
}
} }
} }