Skip to content

Commit

Permalink
Fix cross-test failure
Browse files Browse the repository at this point in the history
  • Loading branch information
bernardnormier committed Nov 17, 2024
1 parent 8a1794f commit 2c491b5
Showing 1 changed file with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ protected IPEndpointI(
java.net.InetSocketAddress sourceAddr,
String connectionId) {
_instance = instance;
_host = normalizeHost(host);
_host = host;
_normalizedHost = normalizeHost(host);
_port = port;
_sourceAddr = sourceAddr;
_connectionId = connectionId;
Expand Down Expand Up @@ -135,7 +136,7 @@ public boolean equivalent(EndpointI endpoint) {

IPEndpointI ipEndpointI = (IPEndpointI) endpoint;
return ipEndpointI.type() == type()
&& ipEndpointI._host.equals(_host)
&& ipEndpointI._normalizedHost.equals(_normalizedHost)
&& ipEndpointI._port == _port
&& java.util.Objects.equals(ipEndpointI._sourceAddr, _sourceAddr);
}
Expand Down Expand Up @@ -247,14 +248,16 @@ public void fillEndpointInfo(IPEndpointInfo info) {
info.sourceAddress = _sourceAddr == null ? "" : _sourceAddr.getAddress().getHostAddress();
}

public void initWithOptions(java.util.ArrayList<String> args, boolean oaEndpoint) {
void initWithOptions(java.util.ArrayList<String> args, boolean oaEndpoint) {
super.initWithOptions(args);

if (_host == null || _host.isEmpty()) {
_host = normalizeHost(_instance.defaultHost());
_host = _instance.defaultHost();
_normalizedHost = normalizeHost(_host);
} else if (_host.equals("*")) {
if (oaEndpoint) {
_host = "";
_normalizedHost = "";
} else {
throw new ParseException(
"'-h *' not valid for proxy endpoint '" + toString() + "'");
Expand All @@ -263,6 +266,7 @@ public void initWithOptions(java.util.ArrayList<String> args, boolean oaEndpoint

if (_host == null) {
_host = "";
_normalizedHost = "";
}

if (_sourceAddr == null) {
Expand All @@ -282,7 +286,8 @@ protected boolean checkOption(String option, String argument, String endpoint) {
throw new ParseException(
"no argument provided for -h option in endpoint '" + endpoint + "'");
}
_host = normalizeHost(argument);
_host = argument;
_normalizedHost = normalizeHost(argument);
} else if (option.equals("-p")) {
if (argument == null) {
throw new ParseException(
Expand Down Expand Up @@ -347,4 +352,7 @@ protected abstract Connector createConnector(
protected int _port;
protected java.net.InetSocketAddress _sourceAddr;
protected final String _connectionId;

// Set when we set _host; used by the implementation of equivalent.
private String _normalizedHost;
}

0 comments on commit 2c491b5

Please sign in to comment.