/// <summary> /// Update node's job processor with given version and file on the disk wich specified name. /// </summary> /// <param name="node"></param> /// <param name="version"></param> /// <returns></returns> public bool UpdateProcBinary(Node node, int version) { string updateFilename = version + ".zip"; string binaryPath = Path.Combine(Environment.CurrentDirectory, "ProcBinaries"); string updateFileFullpath = Path.Combine(binaryPath, updateFilename); try { //byte[] compressedFile = File.ReadAllBytes(updateFileFullpath); AsyncServerNodeProcUpdateCastMessage msg = new AsyncServerNodeProcUpdateCastMessage(); msg.updateVersion = version; //msg.compressedFile = compressedFile; AsyncMessageSender sender = node.GetAsyncCommSender(); Task.Factory.StartNew(() => { if (!sender.SendCast(msg)) Console.WriteLine("[Error] SendCast failed!"); }); return true; } catch (FileNotFoundException) { Console.WriteLine("[Error][NodeManager][UpdateNodeBinary] FIle not found. " + updateFileFullpath); return false; } }
/// <summary> /// Update node's job processor with given byte array and version. /// </summary> /// <param name="node"></param> /// <param name="version"></param> /// <param name="compressedFile"></param> private void UpdateProcBinary(Node node, int version, byte[] compressedFile) { AsyncServerNodeProcUpdateCastMessage msg = new AsyncServerNodeProcUpdateCastMessage(); msg.updateVersion = version; //msg.compressedFile = compressedFile; AsyncMessageSender sender = node.GetAsyncCommSender(); Task.Factory.StartNew(() => { if (!sender.SendCast(msg)) Console.WriteLine("[Error] SendCast failed!"); }); }
private void UpdateNodeBinary(Node node, int version, byte[] compressedFile) { AsyncServerNodeNodeBinUpdateCastMessage msg = new AsyncServerNodeNodeBinUpdateCastMessage(); msg.updateVersion = version; //msg.compressedFile = compressedFile; if (!node.GetAsyncCommSender().SendCast(msg)) Console.WriteLine("[Error] SendCast failed!"); }