// Token: 0x0600050A RID: 1290 RVA: 0x0001C860 File Offset: 0x0001AA60 private PartitionBasedADRunspaceServerSettingsProvider GetProviderForPartition(string partitionFqdn) { ArgumentValidator.ThrowIfNullOrEmpty("partitionFqdn", partitionFqdn); TopologyProvider instance = TopologyProvider.GetInstance(); SyncWrapper <PartitionBasedADRunspaceServerSettingsProvider> orAdd = this.internalProviders.GetOrAdd(partitionFqdn, (string key) => new SyncWrapper <PartitionBasedADRunspaceServerSettingsProvider>()); PartitionBasedADRunspaceServerSettingsProvider value = orAdd.Value; if (value != null && Globals.GetTickDifference(value.LastTopoRecheck, Environment.TickCount) < (ulong)((long)instance.TopoRecheckIntervalMsec)) { ExTraceGlobals.ServerSettingsProviderTracer.TraceDebug <string>((long)this.GetHashCode(), "ADRunspaceServerSettingsProvider {0} ignoring topology version recheck for partition.", partitionFqdn); return(value); } lock (orAdd) { value = orAdd.Value; if (value == null || Globals.GetTickDifference(value.LastTopoRecheck, Environment.TickCount) > (ulong)((long)TopologyProvider.GetInstance().TopoRecheckIntervalMsec)) { int topologyVersion = instance.GetTopologyVersion(partitionFqdn); if (value == null || value.TopologyVersion != topologyVersion) { ExTraceGlobals.ServerSettingsProviderTracer.TraceDebug <string, int>((long)this.GetHashCode(), "ADRunspaceServerSettingsProvider {0}. Creating new provider version {1}", partitionFqdn, topologyVersion); PartitionBasedADRunspaceServerSettingsProvider value2; if (PartitionBasedADRunspaceServerSettingsProvider.TryCreateNew(partitionFqdn, instance, value, out value2)) { orAdd.Value = value2; orAdd.Value.TopologyVersion = topologyVersion; orAdd.Value.LastTopoRecheck = Environment.TickCount; } } } } return(orAdd.Value); }
// Token: 0x06000505 RID: 1285 RVA: 0x0001C714 File Offset: 0x0001A914 public ADServerInfo GetConfigDc(string forestFqdn) { PartitionBasedADRunspaceServerSettingsProvider providerForPartition = this.GetProviderForPartition(forestFqdn); if (providerForPartition != null) { return(providerForPartition.ConfigDC); } return(null); }
// Token: 0x06000508 RID: 1288 RVA: 0x0001C7E4 File Offset: 0x0001A9E4 internal ADServerInfo[] GetGcFromToken(string partitionFqdn, string token, int serverCountRequested, out bool isInLocalSite, bool forestWideAffinityRequested = false) { PartitionBasedADRunspaceServerSettingsProvider providerForPartition = this.GetProviderForPartition(partitionFqdn); if (providerForPartition != null) { ADServerInfo[] gcFromToken = providerForPartition.GetGcFromToken(token, serverCountRequested, out isInLocalSite, forestWideAffinityRequested); if (gcFromToken != null) { return(gcFromToken); } } if (Globals.IsDatacenter) { throw new ADTransientException(DirectoryStrings.ExceptionADTopologyNoServersForPartition(partitionFqdn)); } throw new ADTransientException(DirectoryStrings.ExceptionADTopologyHasNoAvailableServersInForest(partitionFqdn)); }
// Token: 0x0600051F RID: 1311 RVA: 0x0001CD7C File Offset: 0x0001AF7C internal static bool TryCreateNew(string partitionFqdn, TopologyProvider topologyProvider, PartitionBasedADRunspaceServerSettingsProvider previousInstance, out PartitionBasedADRunspaceServerSettingsProvider newInstance) { ArgumentValidator.ThrowIfNullOrEmpty("partitionFqdn", partitionFqdn); ArgumentValidator.ThrowIfNull("topologyProvider", topologyProvider); newInstance = null; Dictionary <string, ADRunspaceServerSettingsProvider.ADServerInfoState> dictionary = new Dictionary <string, ADRunspaceServerSettingsProvider.ADServerInfoState>(StringComparer.OrdinalIgnoreCase); Dictionary <string, ADRunspaceServerSettingsProvider.ADServerInfoState> dictionary2 = new Dictionary <string, ADRunspaceServerSettingsProvider.ADServerInfoState>(StringComparer.OrdinalIgnoreCase); Dictionary <string, ADRunspaceServerSettingsProvider.ADServerInfoState> dictionary3 = new Dictionary <string, ADRunspaceServerSettingsProvider.ADServerInfoState>(StringComparer.OrdinalIgnoreCase); HashSet <string> hashSet; if (previousInstance != null) { hashSet = new HashSet <string>(previousInstance.GetAllGCs(), StringComparer.OrdinalIgnoreCase); } else { hashSet = new HashSet <string>(StringComparer.OrdinalIgnoreCase); } if (previousInstance != null && ExTraceGlobals.ServerSettingsProviderTracer.IsTraceEnabled(TraceType.DebugTrace)) { string arg = string.Join(",", previousInstance.inSiteGCs.Keys); ExTraceGlobals.ServerSettingsProviderTracer.TraceDebug <string, int>((long)partitionFqdn.GetHashCode(), "Previous in site servers {0} (from instance {1})", arg, previousInstance.GetHashCode()); string arg2 = string.Join(",", previousInstance.outOfSiteGCs.Keys); ExTraceGlobals.ServerSettingsProviderTracer.TraceDebug <string, int>((long)partitionFqdn.GetHashCode(), "Previous out of site servers {0} (from instance {1})", arg2, previousInstance.GetHashCode()); } List <string> currentlyUsedServers = (previousInstance != null) ? previousInstance.GetAllGCs().ToList <string>() : new List <string>(); IList <ADServerInfo> serversForRole = topologyProvider.GetServersForRole(partitionFqdn, currentlyUsedServers, ADServerRole.GlobalCatalog, 25, false); ExTraceGlobals.ServerSettingsProviderTracer.TraceDebug <int, string>((long)partitionFqdn.GetHashCode(), "GetServersForRole returned a list of length: {0} for forest ={1}", serversForRole.Count, partitionFqdn); List <string> list = new List <string>(); List <string> list2 = new List <string>(); List <string> list3 = new List <string>(); for (int i = 0; i < serversForRole.Count; i++) { ADRunspaceServerSettingsProvider.ADServerInfoState adserverInfoState = new ADRunspaceServerSettingsProvider.ADServerInfoState(serversForRole[i]) { IsDown = false }; bool flag = adserverInfoState.IsInLocalSite && previousInstance != null && !previousInstance.inSiteGCs.ContainsKey(adserverInfoState.ServerInfo.Fqdn); bool flag2 = !adserverInfoState.IsInLocalSite && previousInstance != null && !previousInstance.outOfSiteGCs.ContainsKey(adserverInfoState.ServerInfo.Fqdn); bool flag3 = flag || flag2; if (!hashSet.Contains(adserverInfoState.ServerInfo.Fqdn)) { if (adserverInfoState.IsInLocalSite) { list.Add(adserverInfoState.ServerInfo.Fqdn); } else { list2.Add(adserverInfoState.ServerInfo.Fqdn); } } ExTraceGlobals.ServerSettingsProviderTracer.TraceDebug((long)partitionFqdn.GetHashCode(), "Forest = {0}. {1} server: {2}, {3} site.", new object[] { partitionFqdn, flag3 ? "Adding a new" : "Keeping", adserverInfoState.ServerInfo.Fqdn, adserverInfoState.IsInLocalSite ? "in the local" : "out of" }); if (adserverInfoState.IsInLocalSite) { dictionary[adserverInfoState.ServerInfo.Fqdn] = adserverInfoState; } else { dictionary2[adserverInfoState.ServerInfo.Fqdn] = adserverInfoState; } } list.Sort(); list2.Sort(); if (previousInstance != null) { list.InsertRange(0, previousInstance.allInSiteGCs); list2.InsertRange(0, previousInstance.allOutOfSiteGCs); } List <string> list4 = new List <string>(1); if (previousInstance != null && previousInstance.ConfigDC != null) { list4.Add(previousInstance.ConfigDC.Fqdn); } serversForRole = topologyProvider.GetServersForRole(partitionFqdn, list4, ADServerRole.ConfigurationDomainController, 1, false); ExTraceGlobals.ServerSettingsProviderTracer.TraceDebug <int, string>((long)partitionFqdn.GetHashCode(), "GetServersForRole returned a list of length: {0} for forest={1}", serversForRole.Count, partitionFqdn); ADServerInfo adserverInfo = null; if (serversForRole.Count > 0) { adserverInfo = serversForRole[0]; ExTraceGlobals.ServerSettingsProviderTracer.TraceDebug <string, string, string>((long)partitionFqdn.GetHashCode(), "Forest = {0}. {1} Config DC {2}", partitionFqdn, (previousInstance != null && previousInstance.configDC != null && string.Equals(serversForRole[0].Fqdn, previousInstance.configDC.Fqdn, StringComparison.OrdinalIgnoreCase)) ? "New" : "Same", adserverInfo.Fqdn); } else if (previousInstance != null && previousInstance.configDC != null) { adserverInfo = previousInstance.ConfigDC; } if (previousInstance != null && ExTraceGlobals.ServerSettingsProviderTracer.IsTraceEnabled(TraceType.DebugTrace)) { string arg3 = string.Join(",", previousInstance.inForestGCs.Keys); ExTraceGlobals.ServerSettingsProviderTracer.TraceDebug <string, int>((long)partitionFqdn.GetHashCode(), "Previous in forest servers {0} (from instance {1})", arg3, previousInstance.GetHashCode()); } serversForRole = topologyProvider.GetServersForRole(partitionFqdn, currentlyUsedServers, ADServerRole.GlobalCatalog, 25, true); ExTraceGlobals.ServerSettingsProviderTracer.TraceDebug <int, string, string>((long)partitionFqdn.GetHashCode(), "GetServersForRole returned a list of length: {0} for forest = {1}. The list is: {2}.", serversForRole.Count, partitionFqdn, string.Join <ADServerInfo>(",", serversForRole)); for (int j = 0; j < serversForRole.Count; j++) { ADRunspaceServerSettingsProvider.ADServerInfoState adserverInfoState2 = new ADRunspaceServerSettingsProvider.ADServerInfoState(serversForRole[j], true); list3.Add(adserverInfoState2.ServerInfo.Fqdn); if (adserverInfoState2.ServerInfo.IsServerSuitable) { adserverInfoState2.IsDown = false; dictionary3[adserverInfoState2.ServerInfo.Fqdn] = adserverInfoState2; } else { adserverInfoState2.IsDown = true; } } if (adserverInfo != null && (dictionary.Count > 0 || dictionary2.Count > 0)) { newInstance = new PartitionBasedADRunspaceServerSettingsProvider(partitionFqdn, dictionary, dictionary2, dictionary3, adserverInfo, list, list2, list3); return(true); } ExTraceGlobals.ServerSettingsProviderTracer.TraceDebug((long)partitionFqdn.GetHashCode(), "{0} unable to create a new PartitionBasedADRunspaceServerSettingsProvider. CDC {1} InSiteGCs {2} OutOfSiteGCs {3}", new object[] { partitionFqdn, (adserverInfo != null) ? adserverInfo.FqdnPlusPort : "<NULL>", dictionary.Count, dictionary2.Count }); return(false); }