mirror of https://github.com/apache/nifi.git
NIFI-4160: SFTPTransfer connection timeout for opening channel.
Signed-off-by: Pierre Villard <pierre.villard.fr@gmail.com> This closes #1991.
This commit is contained in:
parent
50c364a793
commit
e84f9a2416
|
@ -431,13 +431,14 @@ public class SFTPTransfer implements FileTransfer {
|
|||
session.setPassword(password);
|
||||
}
|
||||
|
||||
session.setTimeout(ctx.getProperty(FileTransfer.CONNECTION_TIMEOUT).asTimePeriod(TimeUnit.MILLISECONDS).intValue());
|
||||
final int connectionTimeoutMillis = ctx.getProperty(FileTransfer.CONNECTION_TIMEOUT).asTimePeriod(TimeUnit.MILLISECONDS).intValue();
|
||||
session.setTimeout(connectionTimeoutMillis);
|
||||
session.connect();
|
||||
this.session = session;
|
||||
this.closed = false;
|
||||
|
||||
sftp = (ChannelSftp) session.openChannel("sftp");
|
||||
sftp.connect();
|
||||
sftp.connect(connectionTimeoutMillis);
|
||||
session.setTimeout(ctx.getProperty(FileTransfer.DATA_TIMEOUT).asTimePeriod(TimeUnit.MILLISECONDS).intValue());
|
||||
if (!ctx.getProperty(USE_KEEPALIVE_ON_TIMEOUT).asBoolean()) {
|
||||
session.setServerAliveCountMax(0); // do not send keepalive message on SocketTimeoutException
|
||||
|
|
Loading…
Reference in New Issue