示例#1
0
        private void ProcessInput(QueuedBlockMsg dataMsg)
        {
            dataMsg.GetMessageSize();
            if (this.m_newestMessage != null)
            {
                this.m_newestMessage.NextMsg = dataMsg;
                this.m_newestMessage         = dataMsg;
            }
            else
            {
                this.m_newestMessage = dataMsg;
                this.m_oldestMessage = dataMsg;
            }
            bool flag = BitMasker.IsOn((int)dataMsg.EmitContext.grbitOperationalFlags, 16);

            if (PassiveBlockMode.IsDebugTraceEnabled)
            {
                long num = StopwatchStamp.TicksToMicroSeconds(dataMsg.ReadDurationInTics);
                PassiveBlockMode.Tracer.TraceDebug((long)this.GetHashCode(), "MessageArrived({0}) Gen=0x{1:X} Sector=0x{2:X} JBits=0x{3:X} EmitSeq=0x{4:X} LogDataLen=0x{5:X} ReadUSec={6}", new object[]
                {
                    this.DatabaseName,
                    dataMsg.EmitContext.lgposLogData.lGeneration,
                    dataMsg.EmitContext.lgposLogData.isec,
                    (int)dataMsg.EmitContext.grbitOperationalFlags,
                    dataMsg.EmitContext.qwSequenceNum,
                    dataMsg.LogDataLength,
                    num
                });
            }
            this.Copier.PerfmonCounters.RecordGranularBytesReceived((long)dataMsg.LogDataLength, flag);
            ExchangeNetworkPerfmonCounters perfCounters = this.m_netChannel.PerfCounters;

            if (perfCounters != null)
            {
                perfCounters.RecordLogCopyThruputReceived((long)dataMsg.LogDataLength);
                if (dataMsg.CompressedLogDataLength > 0)
                {
                    perfCounters.RecordCompressedDataReceived(dataMsg.CompressedLogDataLength, dataMsg.LogDataLength, NetworkPath.ConnectionPurpose.LogCopy);
                }
            }
            this.TriggerConsumer();
            if (flag || DateTime.UtcNow >= this.m_nextPingDue)
            {
                uint lGeneration = (uint)dataMsg.EmitContext.lgposLogData.lGeneration;
                if (flag)
                {
                    this.Copier.TrackKnownEndOfLog((long)((ulong)lGeneration), dataMsg.EmitContext.logtimeEmit);
                }
                NetworkTransportException ex;
                bool flag2;
                this.TrySendStatusMessageToActive(flag ? PassiveStatusMsg.Flags.AckEndOfGeneration : PassiveStatusMsg.Flags.None, dataMsg.RequestAckCounter, out ex, out flag2);
                if (ex != null)
                {
                    throw ex;
                }
            }
        }
        // Token: 0x060017DB RID: 6107 RVA: 0x00062D0C File Offset: 0x00060F0C
        private int ReadCoconetBlock(byte[] buf, int off, int len)
        {
            if (this.m_coconetDecompressor == null)
            {
                this.m_coconetDecompressor = new CoconetDecompressor(this.CoconetConfig.DictionarySize, (CoconetCompressor.LzOption) this.CoconetConfig.LzOption);
            }
            if (this.m_xpressReadBuf == null || this.m_xpressReadBuf.Length < 1048577)
            {
                this.m_xpressReadBuf = new byte[1048577];
            }
            this.ReadChunk(this.m_readPacketHeaderBuf, 0, 8);
            int num  = BitConverter.ToInt32(this.m_readPacketHeaderBuf, 0);
            int num2 = BitConverter.ToInt32(this.m_readPacketHeaderBuf, 4);

            if (num2 > 1048577 || num2 <= 0)
            {
                throw new NetworkCorruptDataException(this.PartnerNodeName);
            }
            if (num > 1048577 || num <= 0)
            {
                throw new NetworkCorruptDataException(this.PartnerNodeName);
            }
            this.ReadChunk(this.m_xpressReadBuf, 0, num);
            ExTraceGlobals.NetShareTracer.TraceDebug <int, int>((long)this.GetHashCode(), "ReadCoconetBlock l={0} c={1}", num2, num);
            if (num2 <= len)
            {
                this.m_coconetDecompressor.Decompress(this.m_xpressReadBuf, 0, num, buf, off, num2);
            }
            else
            {
                if (this.m_decompressBuf == null || this.m_decompressBuf.Length < 1048577)
                {
                    this.m_decompressBuf = new byte[1048577];
                }
                this.m_coconetDecompressor.Decompress(this.m_xpressReadBuf, 0, num, this.m_decompressBuf, 0, num2);
            }
            ExchangeNetworkPerfmonCounters perfCounters = this.m_netChannel.PerfCounters;

            if (perfCounters != null && this.m_netChannel.NetworkPath != null)
            {
                perfCounters.RecordCompressedDataReceived(num, num2, this.m_netChannel.NetworkPath.Purpose);
            }
            this.TotalDecompressedBytesReceived += (long)num2;
            this.TotalCompressedBytesReceived   += (long)num;
            if (num2 <= len)
            {
                this.m_bytesRemainingToReadInCurrentBlock = 0;
                return(num2);
            }
            this.m_decompressBufContentLen            = num2;
            this.m_bytesRemainingToReadInCurrentBlock = num2 - len;
            Array.Copy(this.m_decompressBuf, 0, buf, off, len);
            NetworkPackagingLayer.Tracer.TraceError <int, int>((long)this.GetHashCode(), "NetPkg.ReadCoconetBlock: 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);
        }
        // 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);
        }
示例#4
0
 // Token: 0x06001778 RID: 6008 RVA: 0x000609A0 File Offset: 0x0005EBA0
 internal void SetupPerfmon()
 {
     foreach (KeyValuePair <string, ExchangeNetwork> keyValuePair in this.Networks)
     {
         ExchangeNetwork value = keyValuePair.Value;
         if (value.ReplicationEnabled && !value.IgnoreNetwork && value.Subnets.Count > 0)
         {
             NetworkManagerPerfmonInstance  instance     = NetworkManagerPerfmon.GetInstance(value.Name);
             ExchangeNetworkPerfmonCounters perfCounters = new ExchangeNetworkPerfmonCounters(instance);
             value.PerfCounters = perfCounters;
         }
     }
 }
 // Token: 0x0600224A RID: 8778 RVA: 0x0009FE58 File Offset: 0x0009E058
 public override void CopyLog(long fromNumber, string destinationFileName, out DateTime writeTimeUtc)
 {
     writeTimeUtc = (DateTime)ExDateTime.UtcNow;
     ExTraceGlobals.LogCopyClientTracer.TraceDebug <string>((long)this.GetHashCode(), "CopyLog {0} starting", destinationFileName);
     base.AllocateBuffer();
     this.GetChannelLock();
     try
     {
         this.OpenChannelIfFirstRequest();
         CopyLogRequest msg = new CopyLogRequest(this.m_channel, this.DatabaseGuid, fromNumber);
         this.SendMessage(msg);
         ReplayStopwatch replayStopwatch = new ReplayStopwatch();
         replayStopwatch.Start();
         NetworkChannelMessage reply        = this.GetReply();
         CopyLogReply          copyLogReply = reply as CopyLogReply;
         if (copyLogReply == null)
         {
             this.m_channel.ThrowUnexpectedMessage(reply);
         }
         long elapsedMilliseconds = replayStopwatch.ElapsedMilliseconds;
         ExTraceGlobals.LogCopyClientTracer.TraceDebug <long>((long)this.GetHashCode(), "Log Copy Response took: {0}ms", elapsedMilliseconds);
         this.m_endOfLog.SetValue(copyLogReply.EndOfLogGeneration, new DateTime?(copyLogReply.EndOfLogUtc));
         writeTimeUtc = copyLogReply.LastWriteUtc;
         CheckSummer summer = null;
         if (this.m_channel.ChecksumDataTransfer)
         {
             summer = new CheckSummer();
         }
         copyLogReply.ReceiveFile(destinationFileName, null, summer);
         elapsedMilliseconds = replayStopwatch.ElapsedMilliseconds;
         ExTraceGlobals.LogCopyClientTracer.TraceDebug <long>((long)this.GetHashCode(), "Transmit/Decomp took: {0}ms", elapsedMilliseconds);
         base.RecordThruput(copyLogReply.FileSize);
         ExchangeNetworkPerfmonCounters perfCounters = this.m_channel.PerfCounters;
         if (perfCounters != null)
         {
             perfCounters.RecordLogCopyThruputReceived(copyLogReply.FileSize);
         }
         replayStopwatch.Stop();
         ExTraceGlobals.LogCopyClientTracer.TraceDebug((long)this.GetHashCode(), "{0}: LogCopy success: {1} for {2} after {3}ms", new object[]
         {
             ExDateTime.Now,
             replayStopwatch.ToString(),
             destinationFileName,
             replayStopwatch.ElapsedMilliseconds
         });
     }
     finally
     {
         this.ReleaseChannelLock();
     }
 }
        // Token: 0x0600224B RID: 8779 RVA: 0x000A000C File Offset: 0x0009E20C
        internal static void CopyLog(Guid dbGuid, NetworkChannel ch, long logGen, string destinationFileName)
        {
            ExTraceGlobals.LogCopyClientTracer.TraceDebug <string>((long)ch.GetHashCode(), "static CopyLog {0} starting", destinationFileName);
            CopyLogRequest copyLogRequest = new CopyLogRequest(ch, dbGuid, logGen);

            copyLogRequest.Send();
            ReplayStopwatch replayStopwatch = new ReplayStopwatch();

            replayStopwatch.Start();
            NetworkChannelMessage message      = ch.GetMessage();
            CopyLogReply          copyLogReply = message as CopyLogReply;

            if (copyLogReply == null)
            {
                ch.ThrowUnexpectedMessage(message);
            }
            long elapsedMilliseconds = replayStopwatch.ElapsedMilliseconds;

            ExTraceGlobals.LogCopyClientTracer.TraceDebug <long>((long)ch.GetHashCode(), "Log Copy Response took: {0}ms", elapsedMilliseconds);
            CheckSummer summer = null;

            if (ch.ChecksumDataTransfer)
            {
                summer = new CheckSummer();
            }
            copyLogReply.ReceiveFile(destinationFileName, null, summer);
            elapsedMilliseconds = replayStopwatch.ElapsedMilliseconds;
            ExTraceGlobals.LogCopyClientTracer.TraceDebug <long>((long)ch.GetHashCode(), "Transmit/Decomp took: {0}ms", elapsedMilliseconds);
            ExchangeNetworkPerfmonCounters perfCounters = ch.PerfCounters;

            if (perfCounters != null)
            {
                perfCounters.RecordLogCopyThruputReceived(copyLogReply.FileSize);
            }
            replayStopwatch.Stop();
            ExTraceGlobals.LogCopyClientTracer.TraceDebug((long)ch.GetHashCode(), "{0}: LogCopy success: {1} for {2} after {3}ms", new object[]
            {
                ExDateTime.Now,
                replayStopwatch.ToString(),
                destinationFileName,
                replayStopwatch.ElapsedMilliseconds
            });
        }