Ejemplo n.º 1
0
        /// <summary>
        /// Returns NetworkIdentifier.GetHashCode() ^ RemoteEndPoint.GetHashCode();
        /// </summary>
        /// <returns>The hashcode for this connection info</returns>
        public override int GetHashCode()
        {
            lock (internalLocker)
            {
                if (!hashCodeCacheSet)
                {
                    if (RemoteEndPoint != null & LocalEndPoint != null)
                    {
                        hashCodeCache = NetworkIdentifier.GetHashCode() ^ LocalEndPoint.GetHashCode() ^ RemoteEndPoint.GetHashCode() ^ (ApplicationLayerProtocol == ApplicationLayerProtocolStatus.Enabled ? 1 << 31 : 0);
                    }
                    if (RemoteEndPoint != null)
                    {
                        hashCodeCache = NetworkIdentifier.GetHashCode() ^ RemoteEndPoint.GetHashCode() ^ (ApplicationLayerProtocol == ApplicationLayerProtocolStatus.Enabled ? 1 << 31 : 0);
                    }
                    else if (LocalEndPoint != null)
                    {
                        hashCodeCache = NetworkIdentifier.GetHashCode() ^ LocalEndPoint.GetHashCode() ^ (ApplicationLayerProtocol == ApplicationLayerProtocolStatus.Enabled ? 1 << 31 : 0);
                    }
                    else
                    {
                        hashCodeCache = NetworkIdentifier.GetHashCode() ^ (ApplicationLayerProtocol == ApplicationLayerProtocolStatus.Enabled ? 1 << 31 : 0);
                    }

                    hashCodeCacheSet = true;
                }

                return(hashCodeCache);
            }
        }
Ejemplo n.º 2
0
        public override int GetHashCode()
        {
            // ReSharper disable NonReadonlyMemberInGetHashCode
            if (LocalEndPoint == null | RemoteEndPoint == null)
            {
                return(-1);
            }

            return((LocalEndPoint.GetHashCode() + 0x0609) ^ RemoteEndPoint.GetHashCode());
            // ReSharper restore NonReadonlyMemberInGetHashCode
        }
Ejemplo n.º 3
0
 /// <summary>
 ///  Returns the hashcode for this object.
 /// </summary>
 /// <returns></returns>
 /// <remarks>
 /// Excluding those properties which are not serialized:
 /// ClientCertificates, ServerCertificateValidationCallback, NetworkCredential, ProtocolLoggerDelegate
 /// </remarks>
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = MaxFailures;
         hashCode = (hashCode * 397) ^ RetryDelayTime;
         hashCode = (hashCode * 397) ^ (MailOutputDirectory != null ? MailOutputDirectory.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Name != null ? Name.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (SmtpHost != null ? SmtpHost.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ SmtpPort;
         hashCode = (hashCode * 397) ^ (ClientDomain != null ? ClientDomain.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (LocalEndPoint != null ? LocalEndPoint.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (int)MessageOutput;
         hashCode = (hashCode * 397) ^ (int)SslProtocols;
         hashCode = (hashCode * 397) ^ (int)SecureSocketOptions;
         hashCode = (hashCode * 397) ^ Timeout;
         hashCode = (hashCode * 397) ^ DelayBetweenMessages;
         return(hashCode);
     }
 }
Ejemplo n.º 4
0
 public override int GetHashCode()
 {
     return((LocalEndPoint == null | RemoteEndPoint == null) ? -1 : (LocalEndPoint.GetHashCode() + 0x0609) ^ RemoteEndPoint.GetHashCode());
 }