Ejemplo n.º 1
0
        public override void HandleAdditionalReceiving(object sender, DataReceivedEventArgs e)
        {
            var defaultDataComm = e as DefaultDataComm;

            if (defaultDataComm != null)
            {
                switch (defaultDataComm.Protocol)
                {
                case DefaultDataComm.MessageType.Node:
                    // hand off to proper sender and receiver
                    Proxy.HandOffSendReceive(new NodeManagerReceiver(),
                                             new NodeManagerSender(Manager), ConnectionType.Node);
                    // leave and stop this thread.
                    Manager.AddConnectedNode(Proxy);
                    DoneReceiving = true;
                    return;

                case DefaultDataComm.MessageType.Job:
                    // hand off to proper sender and receiver
                    Proxy.HandOffSendReceive(new NodeManagerReceiver(),
                                             new NodeManagerSender(Manager), ConnectionType.Job);
                    // tell the job to submit their job info
                    Proxy.QueueDataEvent(new NodeManagerComm("submit"));
                    // leave and stop this thread.
                    DoneReceiving = true;
                    return;

                case DefaultDataComm.MessageType.Query:
                    // hand off to proper sender and receiver
                    Proxy.HandOffSendReceive(new NodeManagerReceiver(),
                                             new NodeManagerSender(Manager), ConnectionType.Query);
                    // leave and stop this thread.
                    DoneReceiving = true;
                    return;
                }
            }
        }