コード例 #1
0
        /// <summary>
        /// IDarPoolingForwarding method. The user-related command uses only one hop,
        /// i.e. they always reach the correct and final destination node with only
        /// one connession. For these reasons, we only have to execute the command,
        /// and the return the result to the rootSender service node.
        /// </summary>
        /// <param name="forwardedCommand"></param>
        public void HandleForwardedDarPoolingRequest(Command fwdCommand, string rootSenderAddress)
        {
            if (debug)
                Console.WriteLine("{0} {1} node received FWD_{2}",LogTimestamp, receiver.NodeName.ToUpper(), fwdCommand.GetType().Name);

            AddFwdCommandService(fwdCommand.CommandID, rootSenderAddress);
            fwdCommand.Receiver = receiver;
            fwdCommand.Callback = new AsyncCallback(ProcessResultOfForwardedCommand);
            fwdCommand.Execute();
        }
コード例 #2
0
        public void HandleMobileDarPoolingRequest(Command command)
        {
            if (debug)
                Console.WriteLine("\n{0} {1} node received {2}", LogTimestamp, receiver.NodeName.ToUpper(), command.GetType());

            /** Assign a GUID to the command. */
            pendingMobileCommands.Add(command.CommandID, command);

            /** Set a ServiceNodeCore as the receiver of the command and execute the command. */
            command.Timestamp = DateTime.Now;
            command.Receiver = receiver;
            command.Callback = new AsyncCallback(ProcessResult);
            command.Execute();
        }
コード例 #3
0
        /// <summary>
        /// Execute request of clients.
        /// </summary>
        /// <param name="command">The Command object, sent by a client</param>
        public void HandleDarPoolingRequest(Command command)
        {
            if (debug)
                Console.WriteLine("\n{0} {1} node received {2}",LogTimestamp, receiver.NodeName.ToUpper(),command.GetType());

            /** Assign a GUID to the command. */
            command.CommandID = generateGUID();
            /** Save information about the client that has sent the command. */
            IDarPoolingCallback client = OperationContext.Current.GetCallbackChannel<IDarPoolingCallback>();
            commandClient.Add(command.CommandID, client);

            /** Set a ServiceNodeCore as the receiver of the command and execute the command. */
            command.Timestamp = DateTime.Now;
            command.Receiver = receiver;
            command.Callback = new AsyncCallback(ProcessResult);
            command.Execute();
        }