public ServerComponentStatePresentationObject(ADObjectId serverId, string serverFqdn, string componentName, MultiValuedProperty <string> componentStates) : base(new SimpleProviderPropertyBag()) { this[SimpleProviderObjectSchema.Identity] = serverId; this.ServerFqdn = serverFqdn; this.Component = componentName; bool serverWideOfflineIsOffline; List <ServerComponentStates.ItemEntry> list; List <ServerComponentStates.ItemEntry> list2; this.State = ServerComponentStates.ReadEffectiveComponentState(this.ServerFqdn, componentStates, ServerComponentStateSources.All, this.Component, ServerComponentStateManager.GetDefaultState(this.Component), out serverWideOfflineIsOffline, out list, out list2); this.ServerWideOfflineIsOffline = serverWideOfflineIsOffline; if (list != null) { this.localStates = new List <ServerComponentStatePresentationObject.RequesterDetails>(list.Count); foreach (ServerComponentStates.ItemEntry info in list) { this.localStates.Add(new ServerComponentStatePresentationObject.RequesterDetails(info)); } } if (list2 != null) { this.remoteStates = new List <ServerComponentStatePresentationObject.RequesterDetails>(list2.Count); foreach (ServerComponentStates.ItemEntry info2 in list2) { this.remoteStates.Add(new ServerComponentStatePresentationObject.RequesterDetails(info2)); } } }
// 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); }
public override void ResolveServer(Server server) { bool flag = ServerComponentStates.IsServerOnline(server.ComponentStates); if (!flag || !server.IsHubTransportServer || (!server.IsE15OrLater && !this.cmdlet.IncludeE14Servers)) { return; } if (server.ServerSite != null) { this.serverToSiteMap[server.Id] = server.ServerSite; } if (server.DatabaseAvailabilityGroup != null || server.ServerSite != null) { GroupOfServersKey key = (server.DatabaseAvailabilityGroup != null) ? GroupOfServersKey.CreateFromDag(server.DatabaseAvailabilityGroup) : GroupOfServersKey.CreateFromSite(server.ServerSite, server.MajorVersion); if (!this.dagToServersMap.ContainsKey(key)) { this.dagToServersMap[key] = new HashSet <ADObjectId>(); } this.dagToServersMap[key].Add(server.Id); return; } this.serversNotBelongingToAnyDag.Add(server.Id); }
// 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; } }
public TopologyServerInfo(Site site, TopologyServer server) { this.Site = site; this.DistinguishedName = server.DistinguishedName; this.ServerFullyQualifiedDomainName = server.Fqdn; this.VersionNumber = server.VersionNumber; this.AdminDisplayVersionNumber = server.AdminDisplayVersion; this.Role = server.CurrentServerRole; this.IsOutOfService = ((bool)server[ActiveDirectoryServerSchema.IsOutOfService] || !ServerComponentStates.IsServerOnline(server.ComponentStates)); }
protected override void InternalProcessRecord() { base.InternalProcessRecord(); ADComputer adcomputer = null; ITopologyConfigurationSession topologyConfigurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(this.DomainController, false, ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromRootOrgScopeSet(), 213, "InternalProcessRecord", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\SystemConfigurationTasks\\ComponentStates\\SetServerComponentState.cs"); string fqdn = this.serverId.Fqdn; string text = fqdn; int num = fqdn.IndexOf('.'); if (num > 0) { text = fqdn.Substring(0, num); } Server server = topologyConfigurationSession.FindServerByName(text); if (server == null) { topologyConfigurationSession.UseConfigNC = false; topologyConfigurationSession.UseGlobalCatalog = true; adcomputer = topologyConfigurationSession.FindComputerByHostName(text); if (adcomputer == null) { base.WriteError(new ADServerNotFoundException(fqdn), ErrorCategory.InvalidArgument, null); } } if (!this.LocalOnly) { if (server != null) { server.ComponentStates = ServerComponentStates.UpdateRemoteState(server.ComponentStates, this.Requester, this.Component, this.State); topologyConfigurationSession.Save(server); } else { adcomputer.ComponentStates = ServerComponentStates.UpdateRemoteState(adcomputer.ComponentStates, this.Requester, this.Component, this.State); topologyConfigurationSession.Save(adcomputer); } } if (!this.RemoteOnly) { string serverFqdn = (server != null) ? server.Fqdn : adcomputer.DnsHostName; TimeSpan invokeTimeout = TimeSpan.FromSeconds((double)this.TimeoutInSeconds); Exception ex = null; try { InvokeWithTimeout.Invoke(delegate() { ServerComponentStates.UpdateLocalState(serverFqdn, this.Requester, this.Component, this.State); }, null, invokeTimeout, true, null); } catch (IOException ex2) { ex = ex2; } catch (UnauthorizedAccessException ex3) { ex = ex3; } catch (SecurityException ex4) { ex = ex4; } if (ex != null && this.LocalOnly) { base.WriteError(new ArgumentException(Strings.SetServerComponentStateServerUnreachable(serverFqdn, ex.Message)), ErrorCategory.ResourceUnavailable, null); } } }
// 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."); }
// Token: 0x0600081D RID: 2077 RVA: 0x0002162C File Offset: 0x0001F82C private MiniServer GetActiveServer(ITopologyConfigurationSession configSession, ADObjectId serverId, bool skipForMaintenanceMode) { bool enabled = VariantConfiguration.InvariantNoFlightingSnapshot.Cafe.CheckServerLocatorServersForMaintenanceMode.Enabled; bool enabled2 = VariantConfiguration.InvariantNoFlightingSnapshot.Cafe.CheckServerOnlineForActiveServer.Enabled; ADPropertyDefinition[] properties; if (enabled) { properties = new ADPropertyDefinition[] { ActiveDirectoryServerSchema.DatabaseCopyAutoActivationPolicy, ServerSchema.ComponentStates, ActiveDirectoryServerSchema.DatabaseCopyActivationDisabledAndMoveNow }; } else if (enabled2) { properties = new ADPropertyDefinition[] { ActiveDirectoryServerSchema.DatabaseCopyAutoActivationPolicy, ServerSchema.ComponentStates }; } else { properties = new ADPropertyDefinition[] { ActiveDirectoryServerSchema.DatabaseCopyAutoActivationPolicy }; } MiniServer miniServer = configSession.ReadMiniServer(serverId, properties); if (miniServer == null) { this.Tracer.TraceDebug((long)this.GetHashCode(), "[MailboxServerLocator.GetActiveServer] return null. Server is NULL."); return(null); } if (skipForMaintenanceMode) { if (miniServer.DatabaseCopyAutoActivationPolicy == DatabaseCopyAutoActivationPolicyType.Blocked) { this.Tracer.TraceDebug <string, string>((long)this.GetHashCode(), "[MailboxServerLocator.GetActiveServer] return null. Server {0} DatabaseCopyAutoActivationPolicy {1}.", miniServer.ToString(), miniServer.DatabaseCopyAutoActivationPolicy.ToString()); return(null); } if (enabled && miniServer.DatabaseCopyActivationDisabledAndMoveNow) { this.Tracer.TraceDebug <MiniServer, bool>((long)this.GetHashCode(), "[MailboxServerLocator.GetActiveServer] return null. Server {0} DatabaseCopyActivationDisabledAndMoveNow is {1}.", miniServer, miniServer.DatabaseCopyActivationDisabledAndMoveNow); return(null); } if (enabled2 || enabled) { MultiValuedProperty <string> multiValuedProperty = (MultiValuedProperty <string>)miniServer[ServerSchema.ComponentStates]; if (!ServerComponentStates.IsServerOnline(multiValuedProperty)) { this.Tracer.TraceDebug <MiniServer, string>((long)this.GetHashCode(), "[MailboxServerLocator.GetActiveServer] return null. Server {0} ComponentStates {1}.", miniServer, (multiValuedProperty == null) ? "<NULL>" : string.Join(",", multiValuedProperty.ToArray())); return(null); } } } return(miniServer); }