Example #1
0
        // Token: 0x0600032B RID: 811 RVA: 0x00011FD4 File Offset: 0x000101D4
        internal static AmLastKnownGoodConfig ConstructLastKnownGoodConfigFromPersistentState()
        {
            AmLastKnownGoodConfig amLastKnownGoodConfig = null;
            string fromRegistry = AmLastKnownGoodConfig.GetFromRegistry();

            amLastKnownGoodConfig = new AmLastKnownGoodConfig();
            if (!string.IsNullOrEmpty(fromRegistry))
            {
                try
                {
                    AmLastKnownConfigSerializable amLastKnownConfigSerializable = (AmLastKnownConfigSerializable)SerializationUtil.XmlToObject(fromRegistry, typeof(AmLastKnownConfigSerializable));
                    amLastKnownGoodConfig.Role = (AmRole)amLastKnownConfigSerializable.Role;
                    amLastKnownGoodConfig.AuthoritativeServer = new AmServerName(amLastKnownConfigSerializable.AuthoritativeServer);
                    amLastKnownGoodConfig.Members             = (from serverNameFqdn in amLastKnownConfigSerializable.Members
                                                                 select new AmServerName(serverNameFqdn)).ToArray <AmServerName>();
                    amLastKnownGoodConfig.m_prevObjectXml = fromRegistry;
                    string text = string.Empty;
                    if (amLastKnownGoodConfig.Members != null)
                    {
                        string[] value = (from server in amLastKnownGoodConfig.Members
                                          select server.NetbiosName).ToArray <string>();
                        text = string.Join(",", value);
                    }
                    ReplayCrimsonEvents.LastKnownGoodConfigInitialized.Log <AmRole, AmServerName, string>(amLastKnownGoodConfig.Role, amLastKnownGoodConfig.AuthoritativeServer, text);
                }
                catch (Exception ex)
                {
                    ReplayCrimsonEvents.LastKnownGoodConfigSerializationError.Log <string, string>("Deserialize", ex.ToString());
                }
            }
            return(amLastKnownGoodConfig);
        }
        // Token: 0x0600062F RID: 1583 RVA: 0x0001E864 File Offset: 0x0001CA64
        internal static bool CheckIfMajorityNodesReachable(AmServerName[] members, out int totalServersCount, out int successfulReplyCount)
        {
            bool flag = false;

            totalServersCount    = 0;
            successfulReplyCount = 0;
            if (members == null)
            {
                AmLastKnownGoodConfig lastKnownGoodConfig = AmSystemManager.Instance.LastKnownGoodConfig;
                if (lastKnownGoodConfig != null && (lastKnownGoodConfig.Role == AmRole.PAM || lastKnownGoodConfig.Role == AmRole.SAM))
                {
                    members = lastKnownGoodConfig.Members;
                }
            }
            if (members != null && members.Length > 0)
            {
                totalServersCount = members.Length;
                Stopwatch stopwatch = new Stopwatch();
                try
                {
                    stopwatch.Start();
                    AmMultiNodeRoleFetcher amMultiNodeRoleFetcher = new AmMultiNodeRoleFetcher(members.ToList <AmServerName>(), TimeSpan.FromSeconds((double)RegistryParameters.MajorityDecisionRpcTimeoutInSec), true);
                    amMultiNodeRoleFetcher.Run();
                    return(amMultiNodeRoleFetcher.IsMajoritySuccessfulRepliesReceived(out totalServersCount, out successfulReplyCount));
                }
                finally
                {
                    ReplayCrimsonEvents.MajorityNodeCheckCompleted.Log <TimeSpan, bool, int, int>(stopwatch.Elapsed, flag, totalServersCount, successfulReplyCount);
                }
            }
            ReplayCrimsonEvents.MajorityNodeNotAttemptedSinceNoMembersAvailable.Log();
            return(flag);
        }
Example #3
0
        internal void NotifyServiceKillToOtherServers(string serviceName, ExDateTime timeInUtc)
        {
            AmLastKnownGoodConfig lastKnownGoodConfig = AmSystemManager.Instance.LastKnownGoodConfig;

            if (lastKnownGoodConfig != null && lastKnownGoodConfig.Role != AmRole.Unknown && lastKnownGoodConfig.Members != null)
            {
                timeInUtc.ToString("s");
                AmServerName[] members = lastKnownGoodConfig.Members;
                for (int i = 0; i < members.Length; i++)
                {
                    AmServerName serverName = members[i];
                    ThreadPool.QueueUserWorkItem(delegate(object param0)
                    {
                        AmServerName serverToRpc     = serverName;
                        AmServerName reportingServer = AmServerName.LocalComputerName;
                        AmHelper.HandleKnownExceptions(delegate(object param0, EventArgs param1)
                        {
                            AmRpcClientHelper.AmReportServiceKill(serverToRpc.NetbiosName, AmRpcClientHelper.RpcTimeoutShort, serviceName, reportingServer.NetbiosName, timeInUtc.ToString("u"));
                        });
                    });
                }
            }
        }