Ejemplo n.º 1
0
        protected internal TCommandInfo FindCommand(byte[] readBuffer, int offset, int length, bool isReusableBuffer, out int left)
        {
            var commandInfo = CommandReader.FindCommandInfo(AppSession, readBuffer, offset, length, isReusableBuffer, out left);

            if (commandInfo == null)
            {
                int leftBufferCount = CommandReader.LeftBufferSize;
                if (leftBufferCount >= AppServer.Config.MaxCommandLength)
                {
                    AppServer.Logger.LogError(this, string.Format("Max command length: {0}, current processed length: {1}",
                                                                  AppServer.Config.MaxCommandLength, leftBufferCount));
                    Close(CloseReason.ServerClosing);
                    return(m_NullCommandInfo);
                }
            }

            //If next command reader wasn't set, still use current command reader in next round received data processing
            if (CommandReader.NextCommandReader != null)
            {
                CommandReader = CommandReader.NextCommandReader;
            }

            return(commandInfo);
        }