mirror of https://github.com/apache/nifi.git
NIFI-10088 Set SSH Transport Timeout using SFTP Data Timeout property
Signed-off-by: Nathan Gough <thenatog@gmail.com> This closes #6097.
This commit is contained in:
parent
1342ea7025
commit
4aa0d31d9f
|
@ -20,6 +20,7 @@ import net.schmizz.keepalive.KeepAlive;
|
||||||
import net.schmizz.sshj.Config;
|
import net.schmizz.sshj.Config;
|
||||||
import net.schmizz.sshj.SSHClient;
|
import net.schmizz.sshj.SSHClient;
|
||||||
import net.schmizz.sshj.connection.Connection;
|
import net.schmizz.sshj.connection.Connection;
|
||||||
|
import net.schmizz.sshj.transport.Transport;
|
||||||
import net.schmizz.sshj.transport.TransportException;
|
import net.schmizz.sshj.transport.TransportException;
|
||||||
import net.schmizz.sshj.transport.verification.PromiscuousVerifier;
|
import net.schmizz.sshj.transport.verification.PromiscuousVerifier;
|
||||||
import net.schmizz.sshj.userauth.keyprovider.KeyFormat;
|
import net.schmizz.sshj.userauth.keyprovider.KeyFormat;
|
||||||
|
@ -146,6 +147,12 @@ public class StandardSSHClientProvider implements SSHClientProvider {
|
||||||
final int dataTimeout = context.getProperty(DATA_TIMEOUT).asTimePeriod(TimeUnit.MILLISECONDS).intValue();
|
final int dataTimeout = context.getProperty(DATA_TIMEOUT).asTimePeriod(TimeUnit.MILLISECONDS).intValue();
|
||||||
client.setTimeout(dataTimeout);
|
client.setTimeout(dataTimeout);
|
||||||
|
|
||||||
|
// Set Transport and Connection timeouts using Socket Data Timeout property
|
||||||
|
final Transport transport = client.getTransport();
|
||||||
|
transport.setTimeoutMs(dataTimeout);
|
||||||
|
final Connection connection = client.getConnection();
|
||||||
|
connection.setTimeoutMs(dataTimeout);
|
||||||
|
|
||||||
final boolean strictHostKeyChecking = context.getProperty(STRICT_HOST_KEY_CHECKING).asBoolean();
|
final boolean strictHostKeyChecking = context.getProperty(STRICT_HOST_KEY_CHECKING).asBoolean();
|
||||||
final String hostKeyFilePath = context.getProperty(HOST_KEY_FILE).getValue();
|
final String hostKeyFilePath = context.getProperty(HOST_KEY_FILE).getValue();
|
||||||
if (StringUtils.isNotBlank(hostKeyFilePath)) {
|
if (StringUtils.isNotBlank(hostKeyFilePath)) {
|
||||||
|
|
Loading…
Reference in New Issue