From f072dac62db940562d03b5829fa1f4fd3ef74c54 Mon Sep 17 00:00:00 2001 From: Maros Marsalek Date: Tue, 19 May 2015 16:06:15 +0200 Subject: [PATCH] BUG-2961 Disable auth and idle timeout for netconf connector The timeouts appeared in the mina SSHD lib in version 14 and are not suitable for netconf connector. Change-Id: I05f0feb58ef30d12a29eefa53ec5ccf300cb3123 Signed-off-by: Maros Marsalek --- .../nettyutil/handler/ssh/client/AsyncSshHandler.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/opendaylight/netconf/netconf-netty-util/src/main/java/org/opendaylight/controller/netconf/nettyutil/handler/ssh/client/AsyncSshHandler.java b/opendaylight/netconf/netconf-netty-util/src/main/java/org/opendaylight/controller/netconf/nettyutil/handler/ssh/client/AsyncSshHandler.java index 064ae72bc7..c89da4984a 100644 --- a/opendaylight/netconf/netconf-netty-util/src/main/java/org/opendaylight/controller/netconf/nettyutil/handler/ssh/client/AsyncSshHandler.java +++ b/opendaylight/netconf/netconf-netty-util/src/main/java/org/opendaylight/controller/netconf/nettyutil/handler/ssh/client/AsyncSshHandler.java @@ -15,6 +15,7 @@ import io.netty.channel.ChannelOutboundHandlerAdapter; 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; @@ -39,7 +40,16 @@ public class AsyncSshHandler extends ChannelOutboundHandlerAdapter { 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(){ + { + 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(); -- 2.36.6