BUG-2961 Disable auth and idle timeout for netconf connector 34/20734/2
authorMaros Marsalek <mmarsale@cisco.com>
Tue, 19 May 2015 14:06:15 +0000 (16:06 +0200)
committerGerrit Code Review <gerrit@opendaylight.org>
Fri, 22 May 2015 11:32:54 +0000 (11:32 +0000)
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 <mmarsale@cisco.com>
opendaylight/netconf/netconf-netty-util/src/main/java/org/opendaylight/controller/netconf/nettyutil/handler/ssh/client/AsyncSshHandler.java

index 064ae72bc7c512db762a45007a73e9aeebebbe45..c89da4984a409c507a3c2644ed0671b7a1f4daba 100644 (file)
@@ -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<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();