Skip to content

Commit

Permalink
Don't Ping on Handshake Connection (elastic#39076)
Browse files Browse the repository at this point in the history
* Don't Ping on Handshake Connection

* It does not make sense to run pings on the handshake connection
   * Set the ping interval to `-1` to deactivate pings on it
  • Loading branch information
original-brownbear authored Feb 19, 2019
1 parent 3f8e022 commit a459cb0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ protected void doRun() throws Exception {

logger.trace("[{}] opening probe connection", this);
final Connection connection = transportService.openConnection(targetNode,
ConnectionProfile.buildSingleChannelProfile(Type.REG, probeConnectTimeout, probeHandshakeTimeout));
ConnectionProfile.buildSingleChannelProfile(Type.REG, probeConnectTimeout, probeHandshakeTimeout,
TimeValue.MINUS_ONE, null));
logger.trace("[{}] opened probe connection", this);

final DiscoveryNode remoteNode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,8 @@ protected void ping(final Consumer<PingCollection> resultsConsumer,
}

final ConnectionProfile connectionProfile =
ConnectionProfile.buildSingleChannelProfile(TransportRequestOptions.Type.REG, requestDuration, requestDuration);
ConnectionProfile.buildSingleChannelProfile(TransportRequestOptions.Type.REG, requestDuration, requestDuration,
TimeValue.MINUS_ONE, null);
final PingingRound pingingRound = new PingingRound(pingingRoundIdGenerator.incrementAndGet(), seedAddresses, resultsConsumer,
nodes.getLocalNode(), connectionProfile);
activePingingRounds.put(pingingRound.id(), pingingRound);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,23 +101,6 @@ public static ConnectionProfile buildSingleChannelProfile(TransportRequestOption
return buildSingleChannelProfile(channelType, null, null, null, null);
}

/**
* Builds a connection profile that is dedicated to a single channel type. Allows passing compression
* settings.
*/
public static ConnectionProfile buildSingleChannelProfile(TransportRequestOptions.Type channelType, boolean compressionEnabled) {
return buildSingleChannelProfile(channelType, null, null, null, compressionEnabled);
}

/**
* Builds a connection profile that is dedicated to a single channel type. Allows passing connection and
* handshake timeouts.
*/
public static ConnectionProfile buildSingleChannelProfile(TransportRequestOptions.Type channelType, @Nullable TimeValue connectTimeout,
@Nullable TimeValue handshakeTimeout) {
return buildSingleChannelProfile(channelType, connectTimeout, handshakeTimeout, null, null);
}

/**
* Builds a connection profile that is dedicated to a single channel type. Allows passing connection and
* handshake timeouts and compression settings.
Expand Down

0 comments on commit a459cb0

Please sign in to comment.