// Token: 0x060017DA RID: 6106 RVA: 0x00062B9C File Offset: 0x00060D9C private int ReadXpressBlock(byte[] buf, int off, int len) { if (this.m_xpressReadBuf == null) { this.m_xpressReadBuf = new byte[65536]; } this.ReadChunk(this.m_readPacketHeaderBuf, 0, 4); ushort num = BitConverter.ToUInt16(this.m_readPacketHeaderBuf, 0); int num2 = (int)(num + 1); num = BitConverter.ToUInt16(this.m_readPacketHeaderBuf, 2); int num3 = (int)(num + 1); this.ReadChunk(this.m_xpressReadBuf, 0, num2); bool flag; if (num3 <= len) { flag = Xpress.Decompress(this.m_xpressReadBuf, 0, num2, buf, off, num3); } else { if (this.m_decompressBuf == null) { this.m_decompressBuf = new byte[65536]; } flag = Xpress.Decompress(this.m_xpressReadBuf, 0, num2, this.m_decompressBuf, 0, num3); } if (!flag) { NetworkPackagingLayer.Tracer.TraceError((long)this.GetHashCode(), "Decompression failed"); throw new NetworkCorruptDataException(this.PartnerNodeName); } ExchangeNetworkPerfmonCounters perfCounters = this.m_netChannel.PerfCounters; if (perfCounters != null && this.m_netChannel.NetworkPath != null) { perfCounters.RecordCompressedDataReceived(num2, num3, this.m_netChannel.NetworkPath.Purpose); } this.TotalDecompressedBytesReceived += (long)num3; this.TotalCompressedBytesReceived += (long)num2; if (num3 <= len) { this.m_bytesRemainingToReadInCurrentBlock = 0; return(num3); } this.m_decompressBufContentLen = num3; this.m_bytesRemainingToReadInCurrentBlock = num3 - len; Array.Copy(this.m_decompressBuf, 0, buf, off, len); NetworkPackagingLayer.Tracer.TraceError <int, int>((long)this.GetHashCode(), "NetPkg.ReadXpressBlock: Had to buffer 0x{0:X} uncompressed bytes for the next fetch since only 0x{1:X} were requested.", this.m_bytesRemainingToReadInCurrentBlock, len); return(len); }
private QueuedBlockMsg ReadCompressedMsg(NetworkChannel netChan, NetworkChannelMessageHeader msgHdr) { byte[] networkReadWorkingBuf = this.m_networkReadWorkingBuf; BlockModeCompressedDataMsg blockModeCompressedDataMsg = BlockModeCompressedDataMsg.ReadFromNet(netChan, networkReadWorkingBuf, 0); byte[] array = null; int num = 0; int num2 = 0; if (blockModeCompressedDataMsg.LogDataLength > 0) { this.GetAppendSpace(blockModeCompressedDataMsg.LogDataLength); array = this.m_currentBuffer.Buffer; num = this.m_currentBuffer.AppendOffset; int num3 = blockModeCompressedDataMsg.LogDataLength; int num4 = num; foreach (int num5 in blockModeCompressedDataMsg.CompressedLengths) { num2 += num5; netChan.Read(networkReadWorkingBuf, 0, num5); int num6 = Math.Min(num3, 65536); if (!Xpress.Decompress(networkReadWorkingBuf, 0, num5, array, num4, num6)) { throw new NetworkCorruptDataException(this.m_netChannel.PartnerNodeName); } num3 -= num6; num4 += num6; } this.m_currentBuffer.AppendOffset = num + blockModeCompressedDataMsg.LogDataLength; } return(new QueuedBlockMsg(blockModeCompressedDataMsg.EmitContext, array, num, num2) { RequestAckCounter = blockModeCompressedDataMsg.RequestAckCounter, IOBuffer = this.m_currentBuffer }); }