// Token: 0x0600000F RID: 15 RVA: 0x00002248 File Offset: 0x00000448 public FrontEndTransportService() { base.ServiceName = "MSExchangeFrontEndTransport"; base.CanStop = true; base.CanPauseAndContinue = false; base.AutoLog = false; string componentId = ServerComponentStates.GetComponentId(ServerComponentEnum.FrontendTransport); this.components = new Components(componentId, true); }
// Token: 0x06001461 RID: 5217 RVA: 0x00051DA8 File Offset: 0x0004FFA8 protected override DatabaseValidationCheck.Result ValidateInternal(DatabaseValidationCheck.Arguments args, ref LocalizedString error) { if (!args.IgnoreMaintenanceChecks) { IADServer iadserver = args.ADConfig.LookupMiniServerByName(args.TargetServer); if (iadserver == null) { error = ReplayStrings.AmBcsTargetServerADError(args.TargetServer.Fqdn, ReplayStrings.AmBcsNoneSpecified); return(DatabaseValidationCheck.Result.Failed); } if (ServerComponentStates.ReadEffectiveComponentState(iadserver.Fqdn, iadserver.ComponentStates, ServerComponentStateSources.AD, ServerComponentStates.GetComponentId(ServerComponentEnum.HighAvailability), ServiceState.Active) == ServiceState.Inactive) { error = ReplayStrings.AmBcsTargetServerIsHAComponentOffline(iadserver.Fqdn); return(DatabaseValidationCheck.Result.Failed); } if (iadserver.DatabaseCopyAutoActivationPolicy == DatabaseCopyAutoActivationPolicyType.Blocked) { error = ReplayStrings.AmBcsTargetServerActivationBlocked(args.TargetServer.Fqdn); return(DatabaseValidationCheck.Result.Failed); } } return(DatabaseValidationCheck.Result.Passed); }
// Token: 0x06001061 RID: 4193 RVA: 0x000431C8 File Offset: 0x000413C8 internal void LoadFromAD(PickerServerList oldServers) { this.context.Tracer.TracePfd <int, string>(0L, "PFD EMS {0} Loading {1} servers From AD...", 30619, this.context.ServerRole.ToString()); Server server = this.context.ConfigurationSession.FindLocalServer(); if (server != null) { this.CheckForOverride(server); if (server.ServerSite == null) { this.context.Tracer.TraceError(0L, "Local server doesn't belong to a site"); ExEventLog.EventTuple tuple = this.context.HasValidConfiguration ? ApplicationLogicEventLogConstants.Tuple_LocalServerNotInSiteWarning : ApplicationLogicEventLogConstants.Tuple_LocalServerNotInSite; this.context.LogEvent(tuple, null, new object[0]); return; } this.context.ServerPickerClient.LocalServerDiscovered(server); this.localSite = server.ServerSite; QueryFilter filter = new AndFilter(new QueryFilter[] { new BitMaskAndFilter(ServerSchema.CurrentServerRole, (ulong)((long)this.context.ServerRole)), new ComparisonFilter(ComparisonOperator.Equal, ServerSchema.ServerSite, server.ServerSite), new ComparisonFilter(ComparisonOperator.GreaterThanOrEqual, ServerSchema.VersionNumber, Server.CurrentProductMinimumVersion), new ComparisonFilter(ComparisonOperator.LessThan, ServerSchema.VersionNumber, Server.NextProductMinimumVersion) }); HashSet <string> hashSet = new HashSet <string>(StringComparer.OrdinalIgnoreCase); HashSet <string> hashSet2 = new HashSet <string>(StringComparer.OrdinalIgnoreCase); ADPagedReader <Server> adpagedReader = this.context.ConfigurationSession.FindPaged <Server>(null, QueryScope.SubTree, filter, null, 0); foreach (Server server2 in adpagedReader) { ServiceState serviceState = ServerComponentStates.ReadEffectiveComponentState(server2.Fqdn, server2.ComponentStates, ServerComponentStateSources.AD, ServerComponentStates.GetComponentId(this.context.Component), ServiceState.Active); if (this.context.Component != ServerComponentEnum.None && serviceState != ServiceState.Active) { this.context.Tracer.TraceDebug <string, string, ServiceState>(0L, "Component {0} is not active on server {1}. Current component state is {2}.", this.context.Component.ToString(), server2.DistinguishedName, serviceState); } else { bool flag = true; if (this.overrideList != null && this.overrideList.Count > 0) { if (this.overrideList.Contains(server2.DistinguishedName)) { this.context.Tracer.TraceDebug <string, string>(0L, "Adding {0} Server from override list: {1} to active list", this.context.ServerRole.ToString(), server2.DistinguishedName); } else { flag = false; } } else { this.context.Tracer.TraceDebug <string, string, int>(0L, "Adding {0} Server: {1} Version: {2} to active list", this.context.ServerRole.ToString(), server2.DistinguishedName, server2.VersionNumber); } if (flag) { if (this.fqdnServers.ContainsKey(server2.Fqdn) || hashSet.Contains(server2.Name) || hashSet2.Contains(server2.ExchangeLegacyDN)) { this.context.Tracer.TraceError <string, string, string>(0L, "Found more than one server with same FQDN {0} or LegacyDN {1} or MachineName {2}.", server2.Fqdn, server2.ExchangeLegacyDN, server2.Name); this.context.LogEvent(ApplicationLogicEventLogConstants.Tuple_MisconfiguredServer, server2.Fqdn, new object[] { server2.ExchangeLegacyDN, server2.Name }); } else { PickerServer pickerServer = this.context.ServerPickerClient.CreatePickerServer(server2, this); if (oldServers != null) { PickerServer pickerServer2 = oldServers.PickServerByFqdn(pickerServer.FQDN); if (pickerServer2 != null) { pickerServer2.CopyStatusTo(pickerServer); } } this.serverList.Add(pickerServer); this.fqdnServers.Add(pickerServer.FQDN, pickerServer); hashSet.Add(pickerServer.MachineName); hashSet2.Add(pickerServer.LegacyDN); } } } } this.context.ServerPickerClient.ServerListUpdated(this.serverList); if ((server.CurrentServerRole & this.context.ServerRole) == ServerRole.None) { this.localServer = this.context.ServerPickerClient.CreatePickerServer(server, this); } else { PickerServer pickerServer3 = this.FindMatchingServer(server); if (pickerServer3 != null) { this.localServer = pickerServer3; } else { this.context.Tracer.TraceDebug <string>(0L, "Local server ({0}) meets criteria, but wasn't found in AD using list query; won't be preferred", server.Fqdn); this.localServer = this.context.ServerPickerClient.CreatePickerServer(server, this); } } try { this.localIP = Dns.GetHostEntry(Dns.GetHostName()).AddressList[0]; } catch (SocketException ex) { this.context.Tracer.TraceError <string>(0L, "Can't get local IP address due to: {0}", ex.ToString()); ExEventLog.EventTuple tuple2 = this.context.HasValidConfiguration ? ApplicationLogicEventLogConstants.Tuple_CantGetLocalIPWarning : ApplicationLogicEventLogConstants.Tuple_CantGetLocalIP; this.context.LogEvent(tuple2, ex.GetType().FullName, new object[] { ex }); return; } this.localIPBytes = this.localIP.GetAddressBytes(); this.context.Tracer.TracePfd <int, string, int>(0L, "PFD EMS {0} Finished finding {1} servers: {2} found.", 19355, this.context.ServerRole.ToString(), this.serverList.Count); this.isValid = true; } }
// Token: 0x06000009 RID: 9 RVA: 0x0000213C File Offset: 0x0000033C protected override void RunMain(DateTime now) { Components.SmtpInComponent.UpdateTime(now); if (now - this.lastTimeThrottlingManagerSwept > FrontEndBackgroundProcessingThread.ipTableScanInterval) { Components.MessageThrottlingComponent.MessageThrottlingManager.CleanupIdleEntries(); Components.UnhealthyTargetFilterComponent.CleanupExpiredEntries(); this.lastTimeThrottlingManagerSwept = now; } if (now - this.lastTimeServiceStateChecked > FrontEndBackgroundProcessingThread.serviceStateScanInterval) { bool flag = this.serviceStateHelper.CheckState(this.startupServiceState); if (flag && this.serverComponentStateChangedHandler != null) { ServiceState serviceState = ServiceStateHelper.GetServiceState(Components.Configuration, ServerComponentStates.GetComponentId(ServerComponentEnum.FrontendTransport)); this.serverComponentStateChangedHandler(serviceState); } this.lastTimeServiceStateChecked = now; } if (Components.ResourceManager.IsMonitoringEnabled && now - Components.ResourceManager.LastTimeResourceMonitored > Components.ResourceManager.MonitorInterval) { Components.ResourceManager.OnMonitorResource(null); } }
// Token: 0x06000008 RID: 8 RVA: 0x000020FC File Offset: 0x000002FC protected override void Run() { DateTime utcNow = DateTime.UtcNow; this.lastTimeThrottlingManagerSwept = utcNow; this.lastTimeServiceStateChecked = utcNow; this.serviceStateHelper = new ServiceStateHelper(Components.Configuration, ServerComponentStates.GetComponentId(ServerComponentEnum.FrontendTransport)); base.Run(); }
// Token: 0x06000015 RID: 21 RVA: 0x00002D34 File Offset: 0x00000F34 private void Run(string[] args) { bool flag = false; bool passiveRole = false; bool flag2 = false; bool flag3 = false; bool selfListening = false; string text = null; string name = null; string name2 = null; string s = null; string fullName = Assembly.GetExecutingAssembly().FullName; ExTraceGlobals.GeneralTracer.TraceDebug <string>(0L, "Process {0} starting", fullName); foreach (string text2 in args) { if (text2.StartsWith("-?", StringComparison.Ordinal)) { Program.UsageAndExit(); } else if (text2.StartsWith("-console", StringComparison.Ordinal)) { flag2 = true; } else if (text2.StartsWith("-stopkey:", StringComparison.Ordinal)) { text = text2.Remove(0, "-stopkey:".Length); } else if (text2.StartsWith("-hangkey:", StringComparison.Ordinal)) { name = text2.Remove(0, "-hangkey:".Length); } else if (text2.StartsWith("-resetkey:", StringComparison.Ordinal)) { text2.Remove(0, "-resetkey:".Length); } else if (text2.StartsWith("-readykey:", StringComparison.Ordinal)) { name2 = text2.Remove(0, "-readykey:".Length); } else if (text2.StartsWith("-pipe:", StringComparison.Ordinal)) { s = text2.Remove(0, "-pipe:".Length); } else if (text2.StartsWith("-passive", StringComparison.Ordinal)) { passiveRole = true; } else if (text2.StartsWith("-paused", StringComparison.Ordinal)) { flag = true; } else if (text2.StartsWith("-wait", StringComparison.Ordinal)) { flag3 = true; } else if (text2.StartsWith("-workerListening", StringComparison.Ordinal)) { selfListening = true; } } bool flag4 = !string.IsNullOrEmpty(text); if (!flag4) { if (!flag2) { Program.UsageAndExit(); } Console.WriteLine("Starting {0}, running in console mode.", Assembly.GetExecutingAssembly().GetName().Name); if (flag3) { Console.WriteLine("Press ENTER to continue."); Console.ReadLine(); } } string error; if (!Components.TryLoadTransportAppConfig(out error)) { this.StopService(Strings.AppConfigLoadFailure(error), false, false, false); return; } this.SetThreadPoolLimits(Components.TransportAppConfig); this.stopHandle = Program.OpenSemaphore(text, "stop"); this.hangHandle = Program.OpenSemaphore(name, "hang"); this.readyHandle = Program.OpenSemaphore(name2, "ready"); if (this.hangHandle != null) { Thread thread = new Thread(new ThreadStart(this.WaitForHangSignal)); thread.Start(); } Globals.InitializeMultiPerfCounterInstance("Transport"); ExTraceGlobals.GeneralTracer.TraceDebug(0L, "Program.Run() starting components."); SettingOverrideSync.Instance.Start(true); if (!VariantConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).Transport.ADExceptionHandling.Enabled) { Program.ConstructComponentLoadTree(); } else { ADOperationResult adoperationResult = ADNotificationAdapter.TryRunADOperation(new ADOperation(Program.ConstructComponentLoadTree), 3); if (!adoperationResult.Succeeded) { ExTraceGlobals.GeneralTracer.TraceError <Exception>(0L, "Construct components load tree failed {0}.", adoperationResult.Exception); Program.eventLogger.LogEvent(TransportEventLogConstants.Tuple_EdgeTransportInitializationFailure, null, new object[] { adoperationResult.Exception.ToString() }); bool canRetry = adoperationResult.ErrorCode == ADOperationErrorCode.RetryableError; this.StopService(Strings.ADOperationFailure(adoperationResult.Exception.ToString()), canRetry, false, true); return; } } string componentId = ServerComponentStates.GetComponentId(this.CalculateServerComponentName()); this.transportComponents = new Components(componentId, true); this.transportComponents.Start(new Components.StopServiceHandler(this.StopService), passiveRole, flag4, selfListening, true); if (flag4) { SafeFileHandle handle = new SafeFileHandle(new IntPtr(long.Parse(s)), true); this.listenPipeStream = new PipeStream(handle, FileAccess.Read, true); this.controlObject = new ControlObject(this.listenPipeStream, this); if (this.controlObject.Initialize()) { if (this.readyHandle != null) { ExTraceGlobals.GeneralTracer.TraceDebug(0L, "Signal the process is ready"); this.readyHandle.Release(); this.readyHandle.Close(); this.readyHandle = null; } ExTraceGlobals.GeneralTracer.TraceDebug(0L, "Start processing stored messages."); if (!flag) { this.transportComponents.Continue(); } ExTraceGlobals.GeneralTracer.TraceDebug(0L, "Waiting for shutdown signal to exit."); this.stopHandle.WaitOne(); } } else { ExTraceGlobals.GeneralTracer.TraceDebug(0L, "Service connected. Start processing messages."); if (!flag) { this.transportComponents.Continue(); } Console.WriteLine("Press ENTER to exit "); bool flag5 = false; while (!flag5) { string text3 = Console.ReadLine(); if (string.IsNullOrEmpty(text3)) { Console.WriteLine("Exiting."); flag5 = true; } else if (text3.Equals("p")) { Console.WriteLine("Pause."); this.transportComponents.Pause(); } else if (text3.Equals("c")) { Console.WriteLine("Continue."); this.transportComponents.Continue(); } else { Console.WriteLine("Unknown command."); } } } ExTraceGlobals.GeneralTracer.TraceDebug(0L, "Received a signal to shut down. Closing control pipe."); this.CloseControlPipeStream(); ExTraceGlobals.GeneralTracer.TraceDebug(0L, "Stopping components."); ADNotificationListener.Stop(); this.transportComponents.Stop(); ExTraceGlobals.GeneralTracer.TraceDebug(0L, "Components stopped."); }