internal void SendLog(long logGen, NetworkChannel channel, SourceDatabasePerformanceCountersInstance perfCounters)
        {
            ReplayStopwatch replayStopwatch = new ReplayStopwatch();

            replayStopwatch.Start();
            string    text = this.BuildLogFileName(logGen);
            Exception ex   = null;

            try
            {
                using (SafeFileHandle safeFileHandle = LogCopy.OpenLogForRead(text))
                {
                    try
                    {
                        JET_LOGINFOMISC jet_LOGINFOMISC;
                        UnpublishedApi.JetGetLogFileInfo(text, out jet_LOGINFOMISC, JET_LogInfo.Misc2);
                        if (logGen != 0L && (long)jet_LOGINFOMISC.ulGeneration != logGen)
                        {
                            FileCheckLogfileGenerationException ex2 = new FileCheckLogfileGenerationException(text, (long)jet_LOGINFOMISC.ulGeneration, logGen);
                            CorruptLogDetectedException         ex3 = new CorruptLogDetectedException(text, ex2.Message, ex2);
                            throw new FileIOonSourceException(Environment.MachineName, text, ex3.Message, ex3);
                        }
                        JET_SIGNATURE?jet_SIGNATURE = null;
                        lock (this.m_sigLock)
                        {
                            if (this.m_logfileSignature == null)
                            {
                                this.m_logfileSignature = new JET_SIGNATURE?(jet_LOGINFOMISC.signLog);
                            }
                            jet_SIGNATURE = this.m_logfileSignature;
                        }
                        if (!jet_LOGINFOMISC.signLog.Equals(jet_SIGNATURE))
                        {
                            FileCheckLogfileSignatureException ex4 = new FileCheckLogfileSignatureException(text, jet_LOGINFOMISC.signLog.ToString(), jet_SIGNATURE.Value.ToString());
                            CorruptLogDetectedException        ex5 = new CorruptLogDetectedException(text, ex4.Message, ex4);
                            throw new FileIOonSourceException(Environment.MachineName, text, ex5.Message, ex5);
                        }
                    }
                    catch (EsentLogFileCorruptException ex6)
                    {
                        CorruptLogDetectedException ex7 = new CorruptLogDetectedException(text, ex6.Message, ex6);
                        throw new FileIOonSourceException(Environment.MachineName, text, ex7.Message, ex7);
                    }
                    EndOfLog     currentEndOfLog = this.CurrentEndOfLog;
                    CopyLogReply copyLogReply    = new CopyLogReply(channel);
                    copyLogReply.ThisLogGeneration  = logGen;
                    copyLogReply.EndOfLogGeneration = currentEndOfLog.Generation;
                    copyLogReply.EndOfLogUtc        = currentEndOfLog.Utc;
                    CheckSummer summer = null;
                    if (channel.ChecksumDataTransfer)
                    {
                        summer = new CheckSummer();
                    }
                    channel.SetupLogChecksummer(this.Config.LogFilePrefix);
                    channel.SendLogFileTransferReply(copyLogReply, text, safeFileHandle, perfCounters, summer);
                    MonitoredDatabase.Tracer.TracePerformance <long>((long)this.GetHashCode(), "CopyLogFile finished streaming after {0}ms.", replayStopwatch.ElapsedMilliseconds);
                }
            }
            catch (IOException ex8)
            {
                ex = ex8;
            }
            catch (UnauthorizedAccessException ex9)
            {
                ex = ex9;
            }
            catch (EsentErrorException ex10)
            {
                ex = ex10;
            }
            if (ex != null)
            {
                ExTraceGlobals.MonitoredDatabaseTracer.TraceError <string, Exception>((long)this.GetHashCode(), "SendLog({0}) failed: {1}", text, ex);
                throw new FileIOonSourceException(Environment.MachineName, text, ex.Message, ex);
            }
        }