示例#1
0
        // Token: 0x0600002E RID: 46 RVA: 0x000025F4 File Offset: 0x000007F4
        public virtual string GetFqdn(string shortNodeName, bool throwException)
        {
            if (SharedHelper.StringIEquals(shortNodeName, "localhost") || SharedHelper.StringIEquals(shortNodeName, MachineName.Local))
            {
                return(AmServerName.LocalComputerName.Fqdn);
            }
            AmServerNameCache.CacheEntry cacheEntry = null;
            bool flag = false;

            try
            {
                this.m_rwLock.EnterReadLock();
                if (this.m_cache != null)
                {
                    flag = true;
                    if (this.m_cache.TryGetValue(shortNodeName, out cacheEntry) && cacheEntry.ExpiryTime > ExDateTime.Now)
                    {
                        return(cacheEntry.Fqdn);
                    }
                }
            }
            finally
            {
                try
                {
                    this.m_rwLock.ExitReadLock();
                }
                catch (SynchronizationLockException)
                {
                }
            }
            string text = AmServerNameCache.ResolveFqdn(shortNodeName, throwException);

            if (!flag)
            {
                return(text);
            }
            try
            {
                this.m_rwLock.EnterWriteLock();
                if (!this.m_cache.TryGetValue(shortNodeName, out cacheEntry))
                {
                    cacheEntry = new AmServerNameCache.CacheEntry();
                    this.m_cache.Add(shortNodeName, cacheEntry);
                }
                cacheEntry.ExpiryTime = ExDateTime.Now + this.TimeToLive;
                cacheEntry.Fqdn       = text;
            }
            finally
            {
                try
                {
                    this.m_rwLock.ExitWriteLock();
                }
                catch (SynchronizationLockException)
                {
                }
            }
            return(text);
        }
示例#2
0
 internal static string GetFqdnNameFromNode(string nodeName)
 {
     if (string.IsNullOrEmpty(nodeName) || SharedHelper.StringIEquals(nodeName, "localhost"))
     {
         nodeName = Environment.MachineName;
     }
     if (!nodeName.Contains("."))
     {
         return(AmServerNameCache.Instance.GetFqdn(nodeName));
     }
     return(nodeName);
 }
示例#3
0
 internal static bool IsEqual(AmServerName src, AmServerName dst)
 {
     return(object.ReferenceEquals(src, dst) || (src != null && dst != null && SharedHelper.StringIEquals(src.Fqdn, dst.Fqdn)));
 }