Skip to content

Commit

Permalink
clean-up
Browse files Browse the repository at this point in the history
  • Loading branch information
seran committed Oct 12, 2023
1 parent 63c99b6 commit b1aa75a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ public static String[] collectExternalServiceInfo(ExternalServiceInfo remoteHost
// of time the same info gets added again and again. To do this, have to change the
// data structure of the external service mapping inside ExecutionTracer

// TODO: Experiment
// ExecutionTracer.addHostnameInfo(new HostnameInfo(remoteHostInfo.getHostname(), true));


if (!ExecutionTracer.hasExternalMapping(remoteHostInfo.signature())) {
String signature = remoteHostInfo.signature();
int connectPort = remotePort;
Expand All @@ -38,7 +34,6 @@ public static String[] collectExternalServiceInfo(ExternalServiceInfo remoteHost
connectPort = ExternalServiceSharedUtils.getDefaultWMPort(signature);
}

// return new String[]{remoteHostInfo.getHostname(), "" + remotePort};
return new String[]{ExecutionTracer.getExternalMapping(signature), "" + connectPort};
} else {
return new String[]{ExecutionTracer.getExternalMapping(remoteHostInfo.signature()), "" + remotePort};
Expand All @@ -57,7 +52,7 @@ public static boolean skipHostnameOrIp(String hostname) {
|| hostname.startsWith("0.0.0")
|| hostname.startsWith("10.")
|| hostname.startsWith("docker.socket")
|| (hostname.startsWith("127.") && !ExecutionTracer.hasLocalAddressReplacement(hostname))) {
|| (hostname.startsWith("127.") && !ExecutionTracer.hasMappingForLocalAddress(hostname))) {
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public static InetAddress getByName(String host) throws UnknownHostException {
return InetAddress.getByName(host);

try {
if (ExecutionTracer.hasLocalAddress(host)) {
if (ExecutionTracer.hasLocalAddressForHost(host)) {
String ip = ExecutionTracer.getLocalAddress(host);
return InetAddress.getByName(ip);
}
Expand Down Expand Up @@ -71,7 +71,7 @@ public static InetAddress[] getAllByName(String host) throws UnknownHostExceptio
return InetAddress.getAllByName(host);

try {
if (ExecutionTracer.hasLocalAddress(host)) {
if (ExecutionTracer.hasLocalAddressForHost(host)) {
String ip = ExecutionTracer.getLocalAddress(host);
return new InetAddress[]{InetAddress.getByName(ip)};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ We MUST NOT call getHostName() anywhere in EM.
and if there is a mapping available then Socket will use that value to connect. Otherwise,
nothing will happen.
*/
if (ExecutionTracer.hasLocalAddressReplacement(socketAddress.getHostString())) {
if (ExecutionTracer.hasMappingForLocalAddress(socketAddress.getHostString())) {
String newHostname = ExecutionTracer.getRemoteHostname(socketAddress.getHostString());
ExternalServiceInfo remoteHostInfo = new ExternalServiceInfo(
ExternalServiceSharedUtils.DEFAULT_SOCKET_CONNECT_PROTOCOL,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -709,14 +709,14 @@ public static boolean hasExternalMapping(String signature) {
* Check whether there is a local IP address available for the given
* remote hostname.
*/
public static boolean hasLocalAddress(String hostname) {
public static boolean hasLocalAddressForHost(String hostname) {
return localAddressMapping.containsKey(hostname);
}

/**
* Checks for any replacement available to given local IP address.
*/
public static boolean hasLocalAddressReplacement(String localAddress) {
public static boolean hasMappingForLocalAddress(String localAddress) {
return localAddressMapping.containsValue(localAddress);
}

Expand Down

0 comments on commit b1aa75a

Please sign in to comment.