// Token: 0x0600224C RID: 8780 RVA: 0x000A012C File Offset: 0x0009E32C public override long GetE00Generation() { long num = 0L; this.GetChannelLock(); try { this.OpenChannelIfFirstRequest(); GetE00GenerationRequest msg = new GetE00GenerationRequest(this.m_channel, this.DatabaseGuid); this.SendMessage(msg); NetworkChannelMessage reply = this.GetReply(); GetE00GenerationReply getE00GenerationReply = reply as GetE00GenerationReply; if (getE00GenerationReply == null) { this.m_channel.ThrowUnexpectedMessage(reply); } num = getE00GenerationReply.LogGeneration; ExTraceGlobals.LogCopyClientTracer.TraceDebug <long>((long)this.GetHashCode(), "LogCopyClient:GetE00Gen: 0x{0:x}", num); } finally { this.ReleaseChannelLock(); } return(num); }
// Token: 0x06000B8F RID: 2959 RVA: 0x000332C8 File Offset: 0x000314C8 public void ForceNewLog() { ExTraceGlobals.IncrementalReseederTracer.TraceDebug((long)this.GetHashCode(), "rolling a log file"); Exception ex = null; try { this.GetChannel(); SeedPageReaderRollLogFileRequest seedPageReaderRollLogFileRequest = new SeedPageReaderRollLogFileRequest(this.m_channel, this.m_databaseGuid, this.m_databaseName, this.m_databasePath); seedPageReaderRollLogFileRequest.Send(); NetworkChannelMessage message = this.m_channel.GetMessage(); if (!(message is SeedPageReaderRollLogFileReply)) { this.m_channel.ThrowUnexpectedMessage(message); } } catch (NetworkRemoteException ex2) { ex = ex2; } catch (NetworkTransportException ex3) { ex = ex3; } if (ex != null) { ReplayEventLogConstants.Tuple_ForceNewLogError.LogEvent(string.Empty, new object[] { this.m_databaseName, this.m_serverName, ex }); throw ex; } }
// Token: 0x06002249 RID: 8777 RVA: 0x0009FDB0 File Offset: 0x0009DFB0 public override long QueryEndOfLog() { long num = -1L; this.GetChannelLock(); try { this.OpenChannelIfFirstRequest(); NotifyEndOfLogRequest msg = new NotifyEndOfLogRequest(this.m_channel, this.DatabaseGuid, 0L); this.SendMessage(msg); NetworkChannelMessage reply = this.GetReply(); NotifyEndOfLogReply notifyEndOfLogReply = reply as NotifyEndOfLogReply; if (notifyEndOfLogReply == null) { this.m_channel.ThrowUnexpectedMessage(reply); } this.m_endOfLog.SetValue(notifyEndOfLogReply.EndOfLogGeneration, new DateTime?(notifyEndOfLogReply.EndOfLogUtc)); num = notifyEndOfLogReply.EndOfLogGeneration; } finally { this.ReleaseChannelLock(); } ExTraceGlobals.LogCopyClientTracer.TraceDebug <long>((long)this.GetHashCode(), "LogCopyClient:QueryEndOfLog: 0x{0:x}", num); return(num); }
// Token: 0x06000B94 RID: 2964 RVA: 0x000337D0 File Offset: 0x000319D0 public byte[] ReadNextPage(long expectedPageNum, out long lowGen, out long highGen) { if (expectedPageNum < 1L) { throw new ArgumentOutOfRangeException(string.Format(CultureInfo.CurrentCulture, "pageNumber is {0}, must be >= 1 ", new object[] { expectedPageNum })); } lowGen = (long)((ulong)-1); highGen = 0L; NetworkChannelMessage message = this.m_channel.GetMessage(); SeedPageReaderSinglePageReply seedPageReaderSinglePageReply = message as SeedPageReaderSinglePageReply; if (seedPageReaderSinglePageReply == null) { this.m_channel.ThrowUnexpectedMessage(message); } if (seedPageReaderSinglePageReply.PageNumber != expectedPageNum) { this.m_channel.ThrowUnexpectedMessage(message); } lowGen = seedPageReaderSinglePageReply.LowGeneration; highGen = seedPageReaderSinglePageReply.HighGeneration; return(seedPageReaderSinglePageReply.PageBytes); }
// Token: 0x0600224D RID: 8781 RVA: 0x000A01B8 File Offset: 0x0009E3B8 public override bool LogExists(long logNum) { bool flag = false; this.GetChannelLock(); try { this.OpenChannelIfFirstRequest(); TestLogExistenceRequest msg = new TestLogExistenceRequest(this.m_channel, this.DatabaseGuid, logNum); this.SendMessage(msg); NetworkChannelMessage reply = this.GetReply(); TestLogExistenceReply testLogExistenceReply = reply as TestLogExistenceReply; if (testLogExistenceReply == null) { this.m_channel.ThrowUnexpectedMessage(reply); } flag = testLogExistenceReply.LogExists; ExTraceGlobals.LogCopyClientTracer.TraceDebug <long, bool>((long)this.GetHashCode(), "LogCopyClient:LogExists(0x{0:x})={1}", logNum, flag); } finally { this.ReleaseChannelLock(); } return(flag); }
// Token: 0x06000B91 RID: 2961 RVA: 0x0003348C File Offset: 0x0003168C public byte[] ReadOnePage(long pageNumber, out long lowGen, out long highGen) { byte[] result = null; if (pageNumber < 1L) { throw new ArgumentOutOfRangeException(string.Format(CultureInfo.CurrentCulture, "pageNumber is {0}, must be >= 1 ", new object[] { pageNumber })); } lowGen = (long)((ulong)-1); highGen = 0L; try { this.GetChannel(); SeedPageReaderSinglePageRequest seedPageReaderSinglePageRequest = new SeedPageReaderSinglePageRequest(this.m_channel, this.m_databaseGuid, this.m_databaseName, this.m_databasePath, (uint)pageNumber); seedPageReaderSinglePageRequest.Send(); NetworkChannelMessage message = this.m_channel.GetMessage(); SeedPageReaderSinglePageReply seedPageReaderSinglePageReply = message as SeedPageReaderSinglePageReply; if (seedPageReaderSinglePageReply == null) { this.m_channel.ThrowUnexpectedMessage(message); } this.m_pageSize = (long)seedPageReaderSinglePageReply.PageBytes.Length; lowGen = seedPageReaderSinglePageReply.LowGeneration; highGen = seedPageReaderSinglePageReply.HighGeneration; result = seedPageReaderSinglePageReply.PageBytes; } catch (NetworkRemoteException ex) { ReplayEventLogConstants.Tuple_ReadOnePageError.LogEvent(string.Empty, new object[] { pageNumber, this.m_databaseName, this.m_serverName, ex }); throw; } catch (NetworkTransportException ex2) { ReplayEventLogConstants.Tuple_ReadOnePageError.LogEvent(string.Empty, new object[] { pageNumber, this.m_databaseName, this.m_serverName, ex2 }); throw; } return(result); }
// Token: 0x060019CC RID: 6604 RVA: 0x0006BFC4 File Offset: 0x0006A1C4 private void UpdateProgress(string seedingHandle, IReplicaSeederCallback callback) { ReplayStopwatch replayStopwatch = new ReplayStopwatch(); ProgressCiFileRequest progressCiFileRequest = new ProgressCiFileRequest(this.channel, this.databaseGuid, seedingHandle); int num = -1; TimeSpan timeout = TimeSpan.FromSeconds((double)RegistryParameters.SeedCatalogProgressIntervalInSec); int progress; for (;;) { progressCiFileRequest.Send(); replayStopwatch.Restart(); NetworkChannelMessage message = this.channel.GetMessage(); ProgressCiFileReply progressCiFileReply = message as ProgressCiFileReply; if (progressCiFileReply == null) { this.channel.ThrowUnexpectedMessage(message); } ExTraceGlobals.SeederServerTracer.TraceDebug <long>((long)this.GetHashCode(), "ProgressCiFile response took: {0}ms", replayStopwatch.ElapsedMilliseconds); progress = progressCiFileReply.Progress; ExTraceGlobals.SeederServerTracer.TraceDebug <int>((long)this.GetHashCode(), "Get seeding progress: {0}", progress); if (callback != null && callback.IsBackupCancelled()) { break; } if (progress < 0) { goto Block_4; } if (progress > num) { ExTraceGlobals.SeederServerTracer.TraceDebug <Guid, int, bool>((long)this.GetHashCode(), "Updating progress for catalog '{0}'. Percent = {1}%. Callback = {2}", this.databaseGuid, progress, callback != null); if (callback != null) { callback.ReportProgress("IndexSystem", 102400L, (long)progress * 1024L, (long)progress * 1024L); } num = progress; } if (progress == 100) { return; } Thread.Sleep(timeout); } ExTraceGlobals.SeederServerTracer.TraceDebug <int>((long)this.GetHashCode(), "The seeding was cancelled at {0}%", num); throw new SeederOperationAbortedException(); Block_4: Exception innerException = new CiSeederGenericException(this.sourceServerFqdn, this.targetServerFqdn, ReplayStrings.CiSeederExchangeSearchTransientException(string.Format("{0}", progress))); throw new PerformingFastOperationException(innerException); }
// 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: 0x06002248 RID: 8776 RVA: 0x0009FC80 File Offset: 0x0009DE80 internal static void QueryLogRange(Guid dbGuid, NetworkChannel ch, out long minGen, out long maxGen, out DateTime maxGenUtc) { minGen = 0L; maxGen = 0L; maxGenUtc = DateTime.UtcNow; bool flag = false; int timeoutToRestore = 0; TcpChannel tcpChannel = null; try { tcpChannel = ch.TcpChannel; if (tcpChannel.ReadTimeoutInMs < RegistryParameters.QueryLogRangeTimeoutInMsec) { timeoutToRestore = tcpChannel.ReadTimeoutInMs; tcpChannel.ReadTimeoutInMs = RegistryParameters.QueryLogRangeTimeoutInMsec; } QueryLogRangeRequest queryLogRangeRequest = new QueryLogRangeRequest(ch, dbGuid); queryLogRangeRequest.Send(); NetworkChannelMessage message = ch.GetMessage(); QueryLogRangeReply queryLogRangeReply = message as QueryLogRangeReply; if (queryLogRangeReply == null) { ch.ThrowUnexpectedMessage(message); } minGen = queryLogRangeReply.FirstAvailableGeneration; maxGen = queryLogRangeReply.EndOfLogGeneration; maxGenUtc = queryLogRangeReply.EndOfLogUtc; ExTraceGlobals.LogCopyClientTracer.TraceDebug <long, long>((long)ch.GetHashCode(), "LogCopyClient:TryQueryLogRange: 0x{0:x} .. {1:x}", minGen, maxGen); flag = true; } finally { if (timeoutToRestore > 0) { if (!flag) { NetworkChannel.RunNetworkFunction(delegate { tcpChannel.ReadTimeoutInMs = timeoutToRestore; }); } else { tcpChannel.ReadTimeoutInMs = timeoutToRestore; } } } }
private void HandleIncomingMessage() { try { if (!this.m_markedForTermination) { lock (this.m_networkReadLock) { NetworkChannelMessage message = this.Channel.GetMessage(); PingMessage pingMessage = message as PingMessage; if (pingMessage != null) { LogCopyServerContext.Tracer.TraceDebug((long)this.GetHashCode(), "HandleIncomingMessage: Ping received"); Interlocked.Exchange(ref this.m_pingPending, 1); this.m_sendDataEnabled = true; } else { ContinuousLogCopyRequest2 continuousLogCopyRequest = message as ContinuousLogCopyRequest2; if (continuousLogCopyRequest == null) { if (message is ContinuousLogCopyRequest) { continuousLogCopyRequest = LogCopyServerContext.UpgradeRequest(this.Channel, message as ContinuousLogCopyRequest); } else { LogCopyServerContext.Tracer.TraceError <NetworkChannelMessage>((long)this.GetHashCode(), "HandleIncomingMessage: UnexpectedMsg:{0}", message); this.Channel.ThrowUnexpectedMessage(message); } } LogCopyServerContext.Tracer.TraceDebug <long, long, ContinuousLogCopyRequest2.Flags>((long)this.GetHashCode(), "HandleIncomingMessage: First=0x{0:X} Max=0x{1:X} Flags=0x{2:X}", continuousLogCopyRequest.FirstGeneration, continuousLogCopyRequest.LastGeneration, continuousLogCopyRequest.FlagsUsed); this.m_sendDataEnabled = true; this.m_nextLogCopyRequest = continuousLogCopyRequest; } this.StartNetworkRead(); this.SignalWorkPending(); } } } catch (NetworkTransportException arg) { LogCopyServerContext.Tracer.TraceError <NetworkTransportException>((long)this.GetHashCode(), "HandleIncomingMessage: Channel exception: {0}", arg); this.MarkForTermination(); } }
// Token: 0x06002247 RID: 8775 RVA: 0x0009FB60 File Offset: 0x0009DD60 public override long QueryLogRange() { long num = 0L; bool flag = false; int num2 = 0; TcpChannel tcpChannel = null; this.GetChannelLock(); try { this.OpenChannelIfFirstRequest(); tcpChannel = this.m_channel.TcpChannel; if (tcpChannel.ReadTimeoutInMs < RegistryParameters.QueryLogRangeTimeoutInMsec) { num2 = tcpChannel.ReadTimeoutInMs; tcpChannel.ReadTimeoutInMs = RegistryParameters.QueryLogRangeTimeoutInMsec; } QueryLogRangeRequest msg = new QueryLogRangeRequest(this.m_channel, this.DatabaseGuid); this.SendMessage(msg); NetworkChannelMessage reply = this.GetReply(); QueryLogRangeReply queryLogRangeReply = reply as QueryLogRangeReply; if (queryLogRangeReply == null) { this.m_channel.ThrowUnexpectedMessage(reply); } this.m_endOfLog.SetValue(queryLogRangeReply.EndOfLogGeneration, new DateTime?(queryLogRangeReply.EndOfLogUtc)); num = queryLogRangeReply.FirstAvailableGeneration; ExTraceGlobals.LogCopyClientTracer.TraceDebug <long, long>((long)this.GetHashCode(), "LogCopyClient:QueryLogRange: 0x{0:x} .. {1:x}", num, this.m_endOfLog.Generation); flag = true; } finally { if (!flag) { this.DiscardChannel(); } else if (num2 > 0) { tcpChannel.ReadTimeoutInMs = num2; } this.ReleaseChannelLock(); } return(num); }
// 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 }); }
// Token: 0x06000B90 RID: 2960 RVA: 0x0003339C File Offset: 0x0003159C public long ReadPageSize() { this.m_pageSize = 3L; ExTraceGlobals.IncrementalReseederTracer.TraceDebug((long)this.GetHashCode(), "fetching the page size"); Exception ex = null; try { this.GetChannel(); SeedPageReaderPageSizeRequest seedPageReaderPageSizeRequest = new SeedPageReaderPageSizeRequest(this.m_channel, this.m_databaseGuid, this.m_databaseName, this.m_databasePath); seedPageReaderPageSizeRequest.Send(); NetworkChannelMessage message = this.m_channel.GetMessage(); SeedPageReaderPageSizeReply seedPageReaderPageSizeReply = message as SeedPageReaderPageSizeReply; if (seedPageReaderPageSizeReply == null) { this.m_channel.ThrowUnexpectedMessage(message); } this.m_pageSize = seedPageReaderPageSizeReply.PageSize; } catch (NetworkRemoteException ex2) { ex = ex2; } catch (NetworkTransportException ex3) { ex = ex3; } if (ex != null) { ReplayEventLogConstants.Tuple_ReadPageSizeError.LogEvent(string.Empty, new object[] { this.m_databaseName, this.m_serverName, ex }); throw ex; } return(this.m_pageSize); }
// Token: 0x060019CA RID: 6602 RVA: 0x0006BDE4 File Offset: 0x00069FE4 internal void SeedCatalog(string endpoint, IReplicaSeederCallback callback, string reason) { ExTraceGlobals.SeederServerTracer.TraceDebug <Guid, string>((long)this.GetHashCode(), "SeedCatalog {0} to {1}.", this.databaseGuid, endpoint); this.GetChannel(); if (this.DoesSourceSupportExtensibleSeedingRequests()) { SeedCiFileRequest2 seedCiFileRequest = new SeedCiFileRequest2(this.channel, this.databaseGuid, endpoint, reason); seedCiFileRequest.Send(); } else { SeedCiFileRequest seedCiFileRequest2 = new SeedCiFileRequest(this.channel, this.databaseGuid, endpoint); seedCiFileRequest2.Send(); } ReplayStopwatch replayStopwatch = new ReplayStopwatch(); replayStopwatch.Start(); NetworkChannelMessage message = this.channel.GetMessage(); SeedCiFileReply seedCiFileReply = message as SeedCiFileReply; if (seedCiFileReply == null) { this.channel.ThrowUnexpectedMessage(message); } ExTraceGlobals.SeederServerTracer.TraceDebug <long>((long)this.GetHashCode(), "SeedCiFile response took: {0}ms", replayStopwatch.ElapsedMilliseconds); string handle = seedCiFileReply.Handle; ExTraceGlobals.SeederServerTracer.TraceDebug <string>((long)this.GetHashCode(), "Get seeding handle: {0}", handle); ExTraceGlobals.FaultInjectionTracer.TraceTest(2911251773U); this.UpdateProgress(handle, callback); replayStopwatch.Stop(); ExTraceGlobals.SeederServerTracer.TraceDebug((long)this.GetHashCode(), "{0}: SeedCatalog succeeded: {1} for {2} after {3} ms", new object[] { ExDateTime.Now, endpoint, this.databaseGuid, replayStopwatch.ElapsedMilliseconds }); }
private QueuedBlockMsg ReadInputMessage(NetworkChannel netChan) { this.m_timeoutPending = false; byte[] networkReadWorkingBuf = this.m_networkReadWorkingBuf; StopwatchStamp stamp = StopwatchStamp.GetStamp(); NetworkChannelMessageHeader msgHdr = NetworkChannelMessage.ReadHeaderFromNet(netChan, networkReadWorkingBuf, 0); NetworkChannelMessage.MessageType messageType = msgHdr.MessageType; QueuedBlockMsg queuedBlockMsg; if (messageType != NetworkChannelMessage.MessageType.BlockModeCompressedData) { if (messageType == NetworkChannelMessage.MessageType.Ping) { PingMessage pingMessage = PingMessage.ReadFromNet(netChan, networkReadWorkingBuf, 0); long systemPerformanceCounter = Win32StopWatch.GetSystemPerformanceCounter(); long arg = Win32StopWatch.ComputeElapsedTimeInUSec(systemPerformanceCounter, pingMessage.ReplyAckCounter) / 1000L; this.Copier.TrackLastContactTime(msgHdr.MessageUtc); PassiveBlockMode.Tracer.TraceDebug <string, long>((long)this.GetHashCode(), "ProcessReadCallback({0}) received a ping after {1}ms, so channel is healthy", this.DatabaseName, arg); return(null); } if (messageType != NetworkChannelMessage.MessageType.GranularLogData) { throw new NetworkUnexpectedMessageException(netChan.PartnerNodeName, string.Format("Unknown Type {0}", msgHdr.MessageType)); } queuedBlockMsg = this.ReadUncompressedMsg(netChan); this.Copier.PerfmonCounters.CompressionEnabled = 0L; } else { queuedBlockMsg = this.ReadCompressedMsg(netChan, msgHdr); this.Copier.PerfmonCounters.CompressionEnabled = 1L; } queuedBlockMsg.ReadDurationInTics = stamp.ElapsedTicks; queuedBlockMsg.MessageUtc = msgHdr.MessageUtc; this.Copier.PerfmonCounters.RecordLogCopierNetworkReadLatency(queuedBlockMsg.ReadDurationInTics); return(queuedBlockMsg); }
internal static bool TestHealth(string targetServer, int targetPort, int timeOutInMs, out string errMsg) { errMsg = null; NetworkChannel networkChannel = null; Exception ex = null; ExTraceGlobals.TcpChannelTracer.TraceFunction <string>(0L, "TcpHealthCheck: testing {0}", targetServer); try { ushort num = (ushort)targetPort; if (num == 0) { num = 64327; } ITcpConnector tcpConnector = Dependencies.TcpConnector; NetworkPath netPath = tcpConnector.BuildDnsNetworkPath(targetServer, (int)num); networkChannel = NetworkChannel.Connect(netPath, TcpChannel.GetDefaultTimeoutInMs(), false); TestHealthRequest testHealthRequest = new TestHealthRequest(networkChannel); testHealthRequest.Send(); NetworkChannelMessage message = networkChannel.GetMessage(); if (!(message is TestHealthReply)) { networkChannel.ThrowUnexpectedMessage(message); } ExTraceGlobals.TcpChannelTracer.TraceFunction <string>(0L, "TcpHealthCheck: {0} is healthy", targetServer); return(true); } catch (NetworkRemoteException ex2) { ex = ex2.InnerException; } catch (NetworkTransportException ex3) { ex = ex3; } catch (Win32Exception ex4) { ex = ex4; } catch (COMException ex5) { ex = ex5; } catch (ClusCommonFailException ex6) { ex = ex6; } catch (ClusCommonTransientException ex7) { ex = ex7; } finally { if (networkChannel != null) { networkChannel.Close(); } } if (ex != null) { ExTraceGlobals.TcpChannelTracer.TraceError <Exception>(0L, "TcpHealthCheck: failed: {0}", ex); errMsg = ex.Message; } return(false); }
// Token: 0x06002245 RID: 8773 RVA: 0x0009FB39 File Offset: 0x0009DD39 private void SendMessage(NetworkChannelMessage msg) { msg.Send(); }
internal static NetworkChannelMessage ReadMessage(NetworkChannel channel, byte[] headerBuf) { int num = 0; NetworkChannelMessage.MessageType messageType = (NetworkChannelMessage.MessageType)Serialization.DeserializeUInt32(headerBuf, ref num); if (!NetworkChannelMessage.IsValidType(messageType)) { throw new NetworkUnexpectedMessageException(channel.PartnerNodeName, string.Format("Unknown Type{0}", messageType)); } int num2 = (int)Serialization.DeserializeUInt32(headerBuf, ref num); if (num2 < 16 || num2 > 1052672) { throw new NetworkUnexpectedMessageException(channel.PartnerNodeName, string.Format("Invalid msgLen: {0}", num2)); } ExTraceGlobals.NetworkChannelTracer.TraceDebug <NetworkChannelMessage.MessageType, string, string>((long)channel.GetHashCode(), "ReadMessage: Received {0} from {1} on {2}", messageType, channel.RemoteEndPointString, channel.LocalEndPointString); byte[] array = new byte[num2]; Array.Copy(headerBuf, 0, array, 0, 16); int len = num2 - 16; channel.Read(array, 16, len); NetworkChannelMessage.MessageType messageType2 = messageType; if (messageType2 <= NetworkChannelMessage.MessageType.CompressionRequest) { if (messageType2 <= NetworkChannelMessage.MessageType.SeedLogCopyRequest) { if (messageType2 <= NetworkChannelMessage.MessageType.Ping) { if (messageType2 <= NetworkChannelMessage.MessageType.PassiveStatus) { if (messageType2 == NetworkChannelMessage.MessageType.TestNetwork0) { return(new TestNetwork0Request(channel, array)); } if (messageType2 != NetworkChannelMessage.MessageType.PassiveStatus) { goto IL_51C; } return(new PassiveStatusMsg(channel, array)); } else { if (messageType2 == NetworkChannelMessage.MessageType.CompressionConfig) { return(new NetworkChannelCompressionConfigMsg(channel, array)); } if (messageType2 != NetworkChannelMessage.MessageType.BlockModeCompressedData) { if (messageType2 != NetworkChannelMessage.MessageType.Ping) { goto IL_51C; } return(new PingMessage(channel, array)); } } } else if (messageType2 <= NetworkChannelMessage.MessageType.EnterBlockMode) { if (messageType2 == NetworkChannelMessage.MessageType.GranularTermination) { return(new GranularTerminationMsg(channel, array)); } if (messageType2 != NetworkChannelMessage.MessageType.GranularLogData) { if (messageType2 != NetworkChannelMessage.MessageType.EnterBlockMode) { goto IL_51C; } return(new EnterBlockModeMsg(channel, array)); } } else { if (messageType2 == NetworkChannelMessage.MessageType.GetE00GenerationRequest) { return(new GetE00GenerationRequest(channel, array)); } if (messageType2 == NetworkChannelMessage.MessageType.CancelCiFileRequest) { return(new CancelCiFileRequest(channel, array)); } if (messageType2 != NetworkChannelMessage.MessageType.SeedLogCopyRequest) { goto IL_51C; } return(new SeedLogCopyRequest(channel, array)); } throw new NetworkUnexpectedMessageException(channel.PartnerNodeName, string.Format("ReadMessage() does not support message type: {0}.", messageType)); } if (messageType2 <= NetworkChannelMessage.MessageType.CopyLogRequest) { if (messageType2 <= NetworkChannelMessage.MessageType.SeedDatabaseFileRequest) { if (messageType2 == NetworkChannelMessage.MessageType.PassiveDatabaseFileRequest) { return(new PassiveSeedDatabaseFileRequest(channel, array)); } if (messageType2 == NetworkChannelMessage.MessageType.SeedDatabaseFileRequest) { return(new SeedDatabaseFileRequest(channel, array)); } } else { switch (messageType2) { case NetworkChannelMessage.MessageType.ContinuousLogCopyRequest: return(new ContinuousLogCopyRequest(channel, array)); case (NetworkChannelMessage.MessageType) 1363627076: break; case NetworkChannelMessage.MessageType.NotifyEndOfLogRequest: return(new NotifyEndOfLogRequest(channel, array)); default: if (messageType2 == NetworkChannelMessage.MessageType.TestLogExistenceRequest) { return(new TestLogExistenceRequest(channel, array)); } if (messageType2 == NetworkChannelMessage.MessageType.CopyLogRequest) { return(new CopyLogRequest(channel, array)); } break; } } } else if (messageType2 <= NetworkChannelMessage.MessageType.SeedPageReaderRollLogFileRequest) { if (messageType2 == NetworkChannelMessage.MessageType.QueryLogRangeRequest) { return(new QueryLogRangeRequest(channel, array)); } if (messageType2 == NetworkChannelMessage.MessageType.TestHealthRequest) { return(new TestHealthRequest(channel, array)); } if (messageType2 == NetworkChannelMessage.MessageType.SeedPageReaderRollLogFileRequest) { return(new SeedPageReaderRollLogFileRequest(channel, array)); } } else { if (messageType2 == NetworkChannelMessage.MessageType.SeedPageReaderMultiplePageRequest) { return(new SeedPageReaderMultiplePageRequest(channel, array)); } if (messageType2 == NetworkChannelMessage.MessageType.ProgressCiFileRequest) { return(new ProgressCiFileRequest(channel, array)); } if (messageType2 == NetworkChannelMessage.MessageType.CompressionRequest) { return(new NetworkChannelCompressionRequest(channel, array)); } } } else if (messageType2 <= NetworkChannelMessage.MessageType.SeedDatabaseFileReply) { if (messageType2 <= NetworkChannelMessage.MessageType.ContinuousLogCopyRequest2) { if (messageType2 <= NetworkChannelMessage.MessageType.SeedCiFileRequest) { if (messageType2 == NetworkChannelMessage.MessageType.SeedPageReaderSinglePageRequest) { return(new SeedPageReaderSinglePageRequest(channel, array)); } if (messageType2 == NetworkChannelMessage.MessageType.SeedCiFileRequest) { return(new SeedCiFileRequest(channel, array)); } } else { if (messageType2 == NetworkChannelMessage.MessageType.SeedCiFileRequest2) { return(new SeedCiFileRequest2(channel, array)); } if (messageType2 == NetworkChannelMessage.MessageType.SeedPageReaderPageSizeRequest) { return(new SeedPageReaderPageSizeRequest(channel, array)); } if (messageType2 == NetworkChannelMessage.MessageType.ContinuousLogCopyRequest2) { return(new ContinuousLogCopyRequest2(channel, array)); } } } else if (messageType2 <= NetworkChannelMessage.MessageType.GetE00GenerationReply) { if (messageType2 == NetworkChannelMessage.MessageType.LogCopyServerStatus) { return(new LogCopyServerStatusMsg(channel, array)); } if (messageType2 == NetworkChannelMessage.MessageType.GranularLogComplete) { return(new GranularLogCompleteMsg(channel, array)); } if (messageType2 == NetworkChannelMessage.MessageType.GetE00GenerationReply) { return(new GetE00GenerationReply(channel, array)); } } else { if (messageType2 == NetworkChannelMessage.MessageType.NotifyEndOfLogAsyncReply) { return(new NotifyEndOfLogAsyncReply(channel, array)); } if (messageType2 == NetworkChannelMessage.MessageType.CancelCiFileReply) { return(new CancelCiFileReply(channel, array)); } if (messageType2 == NetworkChannelMessage.MessageType.SeedDatabaseFileReply) { return(new SeedDatabaseFileReply(channel, array)); } } } else if (messageType2 <= NetworkChannelMessage.MessageType.TestHealthReply) { if (messageType2 <= NetworkChannelMessage.MessageType.TestLogExistenceReply) { if (messageType2 == NetworkChannelMessage.MessageType.NotifyEndOfLogReply) { return(new NotifyEndOfLogReply(channel, messageType, array)); } if (messageType2 == NetworkChannelMessage.MessageType.TestLogExistenceReply) { return(new TestLogExistenceReply(channel, array)); } } else { if (messageType2 == NetworkChannelMessage.MessageType.CopyLogReply) { return(new CopyLogReply(channel, array)); } if (messageType2 == NetworkChannelMessage.MessageType.QueryLogRangeReply) { return(new QueryLogRangeReply(channel, array)); } if (messageType2 == NetworkChannelMessage.MessageType.TestHealthReply) { return(new TestHealthReply(channel, array)); } } } else if (messageType2 <= NetworkChannelMessage.MessageType.CompressionReply) { if (messageType2 == NetworkChannelMessage.MessageType.SeedPageReaderRollLogFileReply) { return(new SeedPageReaderRollLogFileReply(channel, array)); } if (messageType2 == NetworkChannelMessage.MessageType.ProgressCiFileReply) { return(new ProgressCiFileReply(channel, array)); } if (messageType2 == NetworkChannelMessage.MessageType.CompressionReply) { return(new NetworkChannelCompressionReply(channel, array)); } } else { if (messageType2 == NetworkChannelMessage.MessageType.SeedPageReaderSinglePageReply) { return(new SeedPageReaderSinglePageReply(channel, array)); } if (messageType2 == NetworkChannelMessage.MessageType.SeedCiFileReply) { return(new SeedCiFileReply(channel, array)); } if (messageType2 == NetworkChannelMessage.MessageType.SeedPageReaderPageSizeReply) { return(new SeedPageReaderPageSizeReply(channel, array)); } } IL_51C: throw new NetworkUnexpectedMessageException(channel.PartnerNodeName, string.Format("Unknown message type: 0x{0:X}", (int)messageType)); }
private bool EnterBlockMode() { TimeSpan timeout = TimeSpan.FromSeconds(5.0); bool flag; Exception ex = AmStoreHelper.IsDatabaseMounted(this.Database.DatabaseGuid, this.LocalNodeName, timeout, out flag); if (ex != null) { LogCopyServerContext.Tracer.TraceError <Exception>((long)this.GetHashCode(), "Store may not be running. Mount check failed: {0}", ex); return(false); } if (!flag) { LogCopyServerContext.Tracer.TraceDebug <string>((long)this.GetHashCode(), "Db {0} not mounted. BlockMode is not possible", this.Database.DatabaseName); return(false); } EnterBlockModeMsg enterBlockModeMsg = new EnterBlockModeMsg(this.Channel, EnterBlockModeMsg.Flags.PrepareToEnter, this.Database.DatabaseGuid, this.m_currentLogGeneration); bool flag2 = false; bool result; lock (this.m_networkReadLock) { if (this.m_markedForTermination) { result = false; } else { int readTimeoutInMs = this.Channel.TcpChannel.ReadTimeoutInMs; int writeTimeoutInMs = this.Channel.TcpChannel.WriteTimeoutInMs; try { this.Channel.TcpChannel.ReadTimeoutInMs = RegistryParameters.LogShipACLLTimeoutInMsec; this.Channel.TcpChannel.WriteTimeoutInMs = RegistryParameters.LogShipACLLTimeoutInMsec; LogCopyServerContext.Tracer.TraceDebug <string>((long)this.GetHashCode(), "EnterBlockMode requesting PrepareToEnter for {0}", this.PassiveCopyName); enterBlockModeMsg.Send(); EnterBlockModeMsg enterBlockModeMsg2; string text; for (;;) { NetworkChannelMessage message = this.Channel.GetMessage(); PingMessage pingMessage = message as PingMessage; if (pingMessage != null) { LogCopyServerContext.Tracer.TraceDebug((long)this.GetHashCode(), "PingMessage ignored"); } else { ContinuousLogCopyRequest2 continuousLogCopyRequest = message as ContinuousLogCopyRequest2; if (continuousLogCopyRequest != null) { this.m_nextLogCopyRequest = continuousLogCopyRequest; LogCopyServerContext.Tracer.TraceDebug <long, long, ContinuousLogCopyRequest2.Flags>((long)this.GetHashCode(), "ContinuousLogCopyRequest2: First=0x{0:X} Max=0x{1:X} Flags=0x{2:X}", continuousLogCopyRequest.FirstGeneration, continuousLogCopyRequest.LastGeneration, continuousLogCopyRequest.FlagsUsed); } else { enterBlockModeMsg2 = (message as EnterBlockModeMsg); text = null; if (enterBlockModeMsg2 == null) { text = string.Format("Passive({0}) sent unexpected msg: {1}", this.PassiveCopyName, message.GetType()); } else if (enterBlockModeMsg2.AckCounter != enterBlockModeMsg.AckCounter) { text = string.Format("Passive({0}) is out of sync. BlockModeEntry Aborted", this.PassiveCopyName); } if (text != null) { break; } if (enterBlockModeMsg2.FlagsUsed != EnterBlockModeMsg.Flags.PassiveIsReady) { goto Block_13; } if (!this.RequestBlockModeInStore()) { goto Block_15; } } } } LogCopyServerContext.Tracer.TraceError((long)this.GetHashCode(), text); throw new NetworkUnexpectedMessageException(this.m_clientNodeName, text); Block_13: if (enterBlockModeMsg2.FlagsUsed == EnterBlockModeMsg.Flags.PassiveReject) { LogCopyServerContext.Tracer.TraceError <string>((long)this.GetHashCode(), "BlockMode rejected by passive {0}", this.PassiveCopyName); flag2 = true; return(false); } text = string.Format("Passive({0}) passed unexpected flags 0x{1X}", this.PassiveCopyName, enterBlockModeMsg2.FlagsUsed); throw new NetworkUnexpectedMessageException(this.m_clientNodeName, text); Block_15: flag2 = true; result = false; } finally { if (flag2) { this.Channel.TcpChannel.ReadTimeoutInMs = readTimeoutInMs; this.Channel.TcpChannel.WriteTimeoutInMs = writeTimeoutInMs; this.StartNetworkRead(); } } } } return(result); }