/// <summary> /// Filters the request. /// </summary> /// <param name="readBuffer">The read buffer.</param> /// <param name="offset">The offset.</param> /// <param name="length">The length.</param> /// <param name="toBeCopied">if set to <c>true</c> [to be copied].</param> /// <param name="rest">The rest, the size of the data which has not been processed</param> /// <param name="offsetDelta">return offset delta of next receiving buffer.</param> /// <returns></returns> TRequestInfo FilterRequest(byte[] readBuffer, int offset, int length, bool toBeCopied, out int rest, out int offsetDelta) { if (!AppServer.OnRawDataReceived(this, readBuffer, offset, length)) { rest = 0; offsetDelta = 0; return(null); } var requestInfo = m_RequestFilter.Filter(readBuffer, offset, length, toBeCopied, out rest); var offsetAdapter = m_RequestFilter as IOffsetAdapter; offsetDelta = offsetAdapter != null ? offsetAdapter.OffsetDelta : 0; if (requestInfo == null) { int leftBufferCount = m_RequestFilter.LeftBufferSize; if (leftBufferCount >= AppServer.Config.MaxRequestLength) { if (Logger.IsErrorEnabled) { Logger.ErrorFormat("Max request length: {0}, current processed length: {1}", AppServer.Config.MaxRequestLength, leftBufferCount); } Close(CloseReason.ServerClosing); return(null); } } //If next request filter wasn't set, still use current request filter in next round received data processing if (m_RequestFilter.NextRequestFilter != null) { m_RequestFilter = m_RequestFilter.NextRequestFilter; } return(requestInfo); }
/// <summary> /// Executes the command. /// </summary> /// <param name="session">The session.</param> /// <param name="cmdInfo">The CMD info.</param> public void ExecuteCommand(TAppSession session, TCommandInfo cmdInfo) { AppServer.ExecuteCommand(session, cmdInfo); }