Exemplo n.º 1
0
        // Token: 0x06000F53 RID: 3923 RVA: 0x00041F2C File Offset: 0x0004012C
        private void Open()
        {
            AmClusterHandle amClusterHandle = null;
            AmSystemManager instance        = AmSystemManager.Instance;

            if (instance != null)
            {
                AmConfig config = instance.Config;
                if (config != null)
                {
                    AmDagConfig dagConfig = config.DagConfig;
                    if (dagConfig != null)
                    {
                        IAmCluster cluster = dagConfig.Cluster;
                        if (cluster != null)
                        {
                            amClusterHandle = cluster.Handle;
                        }
                    }
                }
            }
            if (amClusterHandle == null || amClusterHandle.IsInvalid)
            {
                throw new AmClusterNotRunningException();
            }
            using (IDistributedStoreKey clusterKey = DistributedStore.Instance.GetClusterKey(amClusterHandle, null, null, DxStoreKeyAccessMode.Write, false))
            {
                string keyName = string.Format("{0}\\SafetyNet2\\{1}", "ExchangeActiveManager", this.m_dbGuidStr);
                this.m_dbRegKeyHandle = clusterKey.OpenKey(keyName, DxStoreKeyAccessMode.CreateIfNotExist, false, null);
            }
        }
Exemplo n.º 2
0
		private void EnumerateNetworkMap()
		{
			NetworkManager.TraceDebug("EnumerateNetworkMap: attempting to reload", new object[0]);
			using (IAmCluster amCluster = ClusterFactory.Instance.Open())
			{
				PersistentDagNetworkConfig persistentDagNetworkConfig = null;
				string text = null;
				Exception ex = null;
				using (DagConfigurationStore dagConfigurationStore = new DagConfigurationStore())
				{
					dagConfigurationStore.Open();
					persistentDagNetworkConfig = dagConfigurationStore.LoadNetworkConfig(out text);
					PersistentDagNetworkConfig persistentDagNetworkConfig2;
					if (persistentDagNetworkConfig == null)
					{
						persistentDagNetworkConfig2 = new PersistentDagNetworkConfig();
					}
					else
					{
						persistentDagNetworkConfig2 = persistentDagNetworkConfig.Copy();
					}
					IADDatabaseAvailabilityGroup localDag = Dependencies.ADConfig.GetLocalDag();
					if (localDag == null)
					{
						NetworkManager.TraceError("EnumerateNetworkMap can't get the DAG!", new object[0]);
					}
					else
					{
						if (persistentDagNetworkConfig2.NetworkCompression != localDag.NetworkCompression)
						{
							persistentDagNetworkConfig2.NetworkCompression = localDag.NetworkCompression;
						}
						if (persistentDagNetworkConfig2.NetworkEncryption != localDag.NetworkEncryption)
						{
							persistentDagNetworkConfig2.NetworkEncryption = localDag.NetworkEncryption;
						}
						if (persistentDagNetworkConfig2.ManualDagNetworkConfiguration != localDag.ManualDagNetworkConfiguration)
						{
							persistentDagNetworkConfig2.ManualDagNetworkConfiguration = localDag.ManualDagNetworkConfiguration;
						}
					}
					this.NetworkCompression = persistentDagNetworkConfig2.NetworkCompression;
					this.NetworkEncryption = persistentDagNetworkConfig2.NetworkEncryption;
					this.ReplicationPort = persistentDagNetworkConfig2.ReplicationPort;
					this.ManualDagNetworkConfiguration = persistentDagNetworkConfig2.ManualDagNetworkConfiguration;
					if (this.m_portInLocalRegistry != this.ReplicationPort && TcpPortFallback.StorePortNumber(this.ReplicationPort))
					{
						this.m_portInLocalRegistry = this.ReplicationPort;
					}
					NetworkDiscovery networkDiscovery = new NetworkDiscovery();
					networkDiscovery.LoadClusterObjects(amCluster);
					if (this.ManualDagNetworkConfiguration)
					{
						networkDiscovery.LoadExistingConfiguration(persistentDagNetworkConfig2);
					}
					networkDiscovery.DetermineDnsStatus();
					networkDiscovery.AggregateNetworks(true);
					if (!this.ManualDagNetworkConfiguration)
					{
						networkDiscovery.RemoveEmptyNets();
					}
					ExchangeNetworkMap exchangeNetworkMap = new ExchangeNetworkMap(this);
					exchangeNetworkMap.Load(networkDiscovery);
					AmConfig config = AmSystemManager.Instance.Config;
					if (config.IsPAM)
					{
						try
						{
							exchangeNetworkMap.SynchronizeClusterNetworkRoles(amCluster);
						}
						catch (ClusCommonFailException ex2)
						{
							NetworkManager.TraceError("SynchronizeClusterNetworkRoles threw: {0}", new object[]
							{
								ex2
							});
							ex = ex2;
						}
					}
					exchangeNetworkMap.SetupPerfmon();
					persistentDagNetworkConfig2 = exchangeNetworkMap.BuildPersistentDagNetworkConfig();
					string text2 = persistentDagNetworkConfig2.Serialize();
					bool flag = false;
					if (config.IsPAM)
					{
						if (persistentDagNetworkConfig == null || text != text2)
						{
							flag = true;
							Interlocked.Exchange(ref this.m_skipNextClusterRegistryEvent, 1);
							dagConfigurationStore.StoreNetworkConfig(text2);
							if (persistentDagNetworkConfig != null)
							{
								ReplayEventLogConstants.Tuple_DagNetworkConfigOld.LogEvent("DAGNET", new object[]
								{
									text
								});
							}
						}
					}
					else if (this.m_lastWrittenClusterNetConfigXML != null && this.m_lastWrittenClusterNetConfigXML != text2)
					{
						flag = true;
					}
					if (flag)
					{
						ReplayEventLogConstants.Tuple_DagNetworkConfigNew.LogEvent("DAGNET", new object[]
						{
							text2
						});
					}
					this.m_lastWrittenClusterNetConfigXML = text2;
					DagNetConfig dagNetConfig = this.Convert2DagNetConfig(networkDiscovery);
					string text3 = dagNetConfig.Serialize();
					if (this.m_lastWrittenEseReplNetConfigXML == null || this.EseReplDagNetConfigIsStale || text3 != this.m_lastWrittenEseReplNetConfigXML)
					{
						DagNetEnvironment.PublishDagNetConfig(text3);
						this.EseReplDagNetConfigIsStale = false;
					}
					this.m_lastWrittenEseReplNetConfigXML = text3;
					this.m_mapLoadTime = ExDateTime.Now;
					this.m_netMap = exchangeNetworkMap;
					NetworkManager.TraceDebug("EnumerateNetworkMap: completed reload", new object[0]);
					AmSystemManager instance = AmSystemManager.Instance;
					if (instance != null)
					{
						AmNetworkMonitor networkMonitor = instance.NetworkMonitor;
						if (networkMonitor != null)
						{
							networkMonitor.RefreshMapiNetwork();
						}
					}
					if (ex != null)
					{
						throw ex;
					}
				}
			}
		}