import io.netty.channel.ChannelPromise;
import java.io.IOException;
import java.net.SocketAddress;
+import java.util.HashMap;
import org.apache.sshd.ClientChannel;
import org.apache.sshd.ClientSession;
import org.apache.sshd.SshClient;
public static final int SSH_DEFAULT_NIO_WORKERS = 8;
+ // Disable default timeouts from mina sshd
+ private static final long DEFAULT_TIMEOUT = -1L;
+
static {
+ DEFAULT_CLIENT.setProperties(new HashMap<String, String>(){
+ {
+ put(SshClient.AUTH_TIMEOUT, Long.toString(DEFAULT_TIMEOUT));
+ put(SshClient.IDLE_TIMEOUT, Long.toString(DEFAULT_TIMEOUT));
+ }
+ });
// TODO make configurable, or somehow reuse netty threadpool
DEFAULT_CLIENT.setNioWorkers(SSH_DEFAULT_NIO_WORKERS);
DEFAULT_CLIENT.start();
@Override
public synchronized void connect(final ChannelHandlerContext ctx, final SocketAddress remoteAddress, final SocketAddress localAddress, final ChannelPromise promise) throws Exception {
- LOG.debug("XXX session connecting on channel {}. promise: {} ", ctx.channel(), connectPromise);
+ LOG.debug("SSH session connecting on channel {}. promise: {} ", ctx.channel(), connectPromise);
this.connectPromise = promise;
startSsh(ctx, remoteAddress);
}