BUG-2961 Disable auth and idle timeout for netconf connector
[controller.git] / 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();