internal bool TryMark(EndPoint endPoint, ProtocolTypes protocolTypes, ServerQuality quality) { lock ( listLock ) { ServerInfo[] serverInfos; if (quality == ServerQuality.Good) { serverInfos = servers.Where(x => x.Record.EndPoint.Equals(endPoint) && x.Protocol.HasFlagsFast(protocolTypes)).ToArray(); } else { // If we're marking this server for any failure, mark all endpoints for the host at the same time var host = NetHelpers.ExtractEndpointHost(endPoint).host; serverInfos = servers.Where(x => x.Record.GetHost().Equals(host)).ToArray(); } if (serverInfos.Length == 0) { return(false); } foreach (var serverInfo in serverInfos) { MarkServerCore(serverInfo, quality); } return(true); } }
/// <summary> /// Gets the port number of the associated endpoint. /// </summary> /// <returns>The port numer of the associated endpoint.</returns> public int GetPort() { return(NetHelpers.ExtractEndpointHost(EndPoint).port); }
/// <summary> /// Gets the host of the associated endpoint. This could be an IP address, or a DNS host name. /// </summary> /// <returns>The <see cref="IPAddress"/> of the associated endpoint.</returns> public string GetHost() { return(NetHelpers.ExtractEndpointHost(EndPoint).host); }