예제 #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
        /// <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());
 }