internal static void SetDagNetwork(SetDagNetworkRequest changeReq) { NetworkManager.RunRpcOperation("SetDagNetwork", delegate(object param0, EventArgs param1) { NetworkManager manager = NetworkManager.GetManager(); if (manager == null) { throw new DagNetworkManagementException(ReplayStrings.NetworkManagerInitError); } lock (manager.m_mapRefreshLock) { using (DagConfigurationStore dagConfigurationStore = new DagConfigurationStore()) { dagConfigurationStore.Open(); PersistentDagNetworkConfig persistentDagNetworkConfig = dagConfigurationStore.LoadNetworkConfig(); if (persistentDagNetworkConfig != null) { string text = persistentDagNetworkConfig.Serialize(); ReplayEventLogConstants.Tuple_DagNetworkConfigOld.LogEvent(DateTime.UtcNow.ToString(), new object[] { text }); } } ExchangeNetworkMap exchangeNetworkMap = NetworkManager.FetchInitializedMap(); PersistentDagNetworkConfig netConfig = exchangeNetworkMap.UpdateNetConfig(changeReq); manager.UpdateNetworkConfig(netConfig); } }); }
internal static ushort GetReplicationPort() { NetworkManager manager = NetworkManager.GetManager(); if (manager == null) { return 64327; } return manager.ReplicationPort; }
internal static void SetDagNetworkConfig(SetDagNetworkConfigRequest configChange) { NetworkManager.RunRpcOperation("SetDagNetworkConfig", delegate(object param0, EventArgs param1) { NetworkManager manager = NetworkManager.GetManager(); if (manager == null) { throw new DagNetworkManagementException(ReplayStrings.NetworkManagerInitError); } lock (manager.m_mapRefreshLock) { using (IAmCluster amCluster = ClusterFactory.Instance.Open()) { using (DagConfigurationStore dagConfigurationStore = new DagConfigurationStore()) { dagConfigurationStore.Open(); PersistentDagNetworkConfig persistentDagNetworkConfig = dagConfigurationStore.LoadNetworkConfig(); if (persistentDagNetworkConfig == null) { persistentDagNetworkConfig = new PersistentDagNetworkConfig(); } else { string text = persistentDagNetworkConfig.Serialize(); ReplayEventLogConstants.Tuple_DagNetworkConfigOld.LogEvent(DateTime.UtcNow.ToString(), new object[] { text }); } if (configChange.SetPort) { persistentDagNetworkConfig.ReplicationPort = configChange.ReplicationPort; manager.ReplicationPort = configChange.ReplicationPort; } manager.NetworkCompression = configChange.NetworkCompression; persistentDagNetworkConfig.NetworkCompression = configChange.NetworkCompression; manager.NetworkEncryption = configChange.NetworkEncryption; persistentDagNetworkConfig.NetworkEncryption = configChange.NetworkEncryption; manager.ManualDagNetworkConfiguration = configChange.ManualDagNetworkConfiguration; persistentDagNetworkConfig.ManualDagNetworkConfiguration = configChange.ManualDagNetworkConfiguration; if (configChange.DiscoverNetworks) { NetworkDiscovery networkDiscovery = new NetworkDiscovery(); networkDiscovery.LoadClusterObjects(amCluster); networkDiscovery.DetermineDnsStatus(); networkDiscovery.AggregateNetworks(true); ExchangeNetworkMap exchangeNetworkMap = new ExchangeNetworkMap(manager); exchangeNetworkMap.Load(networkDiscovery); persistentDagNetworkConfig = exchangeNetworkMap.BuildPersistentDagNetworkConfig(); } manager.UpdateNetworkConfig(persistentDagNetworkConfig); } } } }); }
internal static NetworkPath InternalChooseDagNetworkPath(string targetName, string networkName, NetworkPath.ConnectionPurpose purpose) { string nodeNameFromFqdn = MachineName.GetNodeNameFromFqdn(targetName); NetworkManager manager = NetworkManager.GetManager(); NetworkPath networkPath = null; DagNetConfig dagNetConfig = null; manager.TryWaitForInitialization(); if (manager.m_netMap != null) { networkPath = manager.m_netMap.ChoosePath(nodeNameFromFqdn, networkName); } else { DagNetRoute dagNetRoute = null; DagNetRoute[] array = DagNetChooser.ProposeRoutes(targetName, out dagNetConfig); if (networkName != null) { foreach (DagNetRoute dagNetRoute2 in array) { if (StringUtil.IsEqualIgnoreCase(dagNetRoute2.NetworkName, networkName)) { dagNetRoute = dagNetRoute2; break; } } } else if (array != null && array.Length > 0) { dagNetRoute = array[0]; } if (dagNetRoute != null) { networkPath = new NetworkPath(targetName, dagNetRoute.TargetIPAddr, dagNetRoute.TargetPort, dagNetRoute.SourceIPAddr); networkPath.NetworkName = dagNetRoute.NetworkName; networkPath.CrossSubnet = dagNetRoute.IsCrossSubnet; } } if (networkPath == null) { networkPath = NetworkManager.BuildDnsNetworkPath(targetName, NetworkManager.GetReplicationPort()); } networkPath.Purpose = purpose; if (dagNetConfig == null) { dagNetConfig = DagNetEnvironment.FetchNetConfig(); } networkPath.ApplyNetworkPolicy(dagNetConfig); return networkPath; }
internal static void RemoveDagNetwork(RemoveDagNetworkRequest req) { NetworkManager.RunRpcOperation("RemoveDagNetwork", delegate(object param0, EventArgs param1) { NetworkManager manager = NetworkManager.GetManager(); if (manager == null) { throw new DagNetworkManagementException(ReplayStrings.NetworkManagerInitError); } lock (manager.m_mapRefreshLock) { using (DagConfigurationStore dagConfigurationStore = new DagConfigurationStore()) { dagConfigurationStore.Open(); PersistentDagNetworkConfig persistentDagNetworkConfig = dagConfigurationStore.LoadNetworkConfig(); if (persistentDagNetworkConfig != null) { string text = persistentDagNetworkConfig.Serialize(); ReplayEventLogConstants.Tuple_DagNetworkConfigOld.LogEvent(DateTime.UtcNow.ToString(), new object[] { text }); } } ExchangeNetworkMap exchangeNetworkMap = NetworkManager.FetchInitializedMap(); PersistentDagNetworkConfig persistentDagNetworkConfig2 = exchangeNetworkMap.BuildPersistentDagNetworkConfig(); if (!persistentDagNetworkConfig2.RemoveNetwork(req.Name)) { NetworkManager.TraceError("RemoveDagNetwork {0} not found", new object[] { req.Name }); throw new DagNetworkManagementException(ReplayStrings.NetworkNameNotFound(req.Name)); } manager.UpdateNetworkConfig(persistentDagNetworkConfig2); } }); }