/// <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); } }
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(); }
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(); }
/// <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); } }
public override int GetHashCode() { return(RemoteEndPoint.GetHashCode() ^ LocalPort.GetHashCode()); }