public void CreateFlushCommand(Opcode type, bool noreply)
 {
     int delay = 0;
     if (_requestHeader.ExtraLength > 0)
         delay = ((_rawData[0] << 24) | (_rawData[1] << 16) | (_rawData[2] << 8) | _rawData[3]);
     _command = new FlushCommand(type,delay);
     _command.NoReply = noreply;
 }
 public static byte[] BuildFlushResponse(FlushCommand command)
 {
     BinaryResponseStatus status = BinaryResponseStatus.no_error;
     if (command.OperationResult.ReturnResult != Result.SUCCESS)
         status = BinaryResponseStatus.invalid_arguments;
     else
     {
         if (command.NoReply == true)
             return null;
     }
     return BuildResposne(command.Opcode, status, command.Opaque, 0, null, null, null);
 }
Example #3
0
        private void CreateFlushCommand(string arguments)
        {
            int delay = 0;
            bool noreply = false;

            string[] argumentsArray;
            if (string.IsNullOrEmpty(arguments))
            {
                delay = 0;
            }
            else
            {
                argumentsArray = arguments.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
                if (argumentsArray.Length > 2)
                {
                    CreateInvalidCommand();
                    return;
                }

                try
                {
                    delay = int.Parse(argumentsArray[0]);
                    if (argumentsArray.Length > 1 && argumentsArray[1] == "noreply")
                        noreply = true;
                }
                catch (Exception e)
                {
                    CreateInvalidCommand("CLIENT_ERROR bad command line format");
                    return;
                }
            }

            _command = new FlushCommand(Opcode.Flush,delay);
            _command.NoReply = noreply;
            this.State = ParserState.ReadyToDispatch;
        }