/// <summary> /// Handle any additional receiving the node might want to do /// in the receiver class. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public override void HandleAdditionalReceiving(object sender, DataReceivedEventArgs e) { NodeComm receivedData = e as NodeComm; if (receivedData != null) { switch (receivedData.Protocol) { case NodeComm.MessageType.File: // This will block on the IOStream until the file reading // is over. The next thing sent over the network must be a file. _job = JsonConvert.DeserializeObject <JobRef>(receivedData.Args[1]); FileRead.ReadInWriteOut(Proxy.IOStream, _job.FileName); //job = receivedData; // after we have finished reading the data, let node manager know OnDataReceived(new NodeComm(DataReceivedEventArgs.ConstructMessage("fileread"))); break; case NodeComm.MessageType.Execute: //TODO, this should be its own task/thread _parent.Logger.Log("Node: executing"); JobLauncher j = new JobLauncher(_job, _parent); j.LaunchJob(); break; case NodeComm.MessageType.Shutdown: case NodeComm.MessageType.Quit: // shutting down or quitting, we are done receving DoneReceiving = true; break; } } }