コード例 #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);
            }
        }
コード例 #2
0
ファイル: Session.cs プロジェクト: webdes27/AikaEmu
 public Session(INetwork network, SocketAsyncEventArgs readEventArg, Socket socket)
 {
     Socket                    = socket;
     Id                        = (uint)RemoteEndPoint.GetHashCode();
     _network                  = network;
     ReadEventArg              = readEventArg;
     _writeEventArg.Completed += WriteComplete;
     Ip                        = RemoteEndPoint.Address;
     ProccessPackets();
 }
コード例 #3
0
 public Session(INetBase server, SocketAsyncEventArgs readEventArg, Socket socket)
 {
     Socket                    = socket;
     Id                        = (UInt32)RemoteEndPoint.GetHashCode();
     _server                   = server;
     ReadEventArg              = readEventArg;
     _writeEventArg.Completed += WriteComplete;
     Ip                        = RemoteEndPoint.Address;
     ProccessPackets();
 }
コード例 #4
0
ファイル: ConnectionInfo.cs プロジェクト: personDevelop/sdfc
        /// <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)
                    {
                        hashCodeCache = NetworkIdentifier.GetHashCode() ^ RemoteEndPoint.GetHashCode();
                    }
                    else
                    {
                        hashCodeCache = NetworkIdentifier.GetHashCode();
                    }

                    hashCodeCacheSet = true;
                }

                return(hashCodeCache);
            }
        }
コード例 #5
0
 public override int GetHashCode()
 {
     return(RemoteEndPoint.GetHashCode() ^ LocalPort.GetHashCode());
 }