Disable NIO read timeout by default 93/92293/1
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 4 Aug 2020 16:57:21 +0000 (18:57 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Wed, 26 Aug 2020 16:15:45 +0000 (18:15 +0200)
Rework which timeouts are disabled, as we are hitting timeout
after 615 seconds.

JIRA: NETCONF-716
Change-Id: I98ef51b4346c2aee0c9c87d58035bc08ef2c77d1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 84c3a3198ad33135dbc982dfb048ee5906d79ece)

netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/ssh/client/AsyncSshHandler.java

index 1aeeaaf48dc716ff76f68a5944c95ed142f32ef6..edf018bed431c1930c097e289e6d7f395bda8e9d 100644 (file)
@@ -21,11 +21,11 @@ import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
 import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.netconf.nettyutil.handler.ssh.authentication.AuthenticationHandler;
-import org.opendaylight.netconf.shaded.sshd.client.SshClient;
 import org.opendaylight.netconf.shaded.sshd.client.channel.ClientChannel;
 import org.opendaylight.netconf.shaded.sshd.client.future.AuthFuture;
 import org.opendaylight.netconf.shaded.sshd.client.future.ConnectFuture;
 import org.opendaylight.netconf.shaded.sshd.client.session.ClientSession;
+import org.opendaylight.netconf.shaded.sshd.common.FactoryManager;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -38,15 +38,15 @@ public class AsyncSshHandler extends ChannelOutboundHandlerAdapter {
     public static final String SUBSYSTEM = "netconf";
 
     public static final int SSH_DEFAULT_NIO_WORKERS = 8;
-    // Disable default timeouts from mina sshd
-    private static final long DEFAULT_TIMEOUT = -1L;
 
     public static final NetconfSshClient DEFAULT_CLIENT;
 
     static {
         final NetconfSshClient c = new NetconfClientBuilder().build();
-        c.getProperties().put(SshClient.AUTH_TIMEOUT, Long.toString(DEFAULT_TIMEOUT));
-        c.getProperties().put(SshClient.IDLE_TIMEOUT, Long.toString(DEFAULT_TIMEOUT));
+        // Disable default timeouts from mina sshd
+        c.getProperties().put(FactoryManager.AUTH_TIMEOUT, "0");
+        c.getProperties().put(FactoryManager.IDLE_TIMEOUT, "0");
+        c.getProperties().put(FactoryManager.NIO2_READ_TIMEOUT, "0");
 
         // TODO make configurable, or somehow reuse netty threadpool
         c.setNioWorkers(SSH_DEFAULT_NIO_WORKERS);