Remove AsyncSshHandler.handleSshChanelOpened() 19/102719/4
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 18 Oct 2022 08:58:35 +0000 (10:58 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 18 Oct 2022 11:57:14 +0000 (13:57 +0200)
This is the locked bottom of onOpenComplete(), rename it and co-locate
it with its sole caller, making the code progression linear.

JIRA: NETCONF-905
Change-Id: I5a8fba44767535fb1e59bf48e3f4a422c0db3b59
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/ssh/client/AsyncSshHandler.java

index 36cc81d6cf170a8cfe0f706f2de98184f7b99877..0934720948cb33085b5e29862741de40bb4b3459 100644 (file)
@@ -103,18 +103,6 @@ public class AsyncSshHandler extends ChannelOutboundHandlerAdapter {
                 negotiationFuture);
     }
 
-    private synchronized void handleSshChanelOpened(final ChannelHandlerContext ctx) {
-        LOG.trace("SSH subsystem channel opened successfully on channel: {}", ctx.channel());
-
-        if (negotiationFuture == null) {
-            connectPromise.setSuccess();
-        }
-
-        sshWriteAsyncHandler = new AsyncSshHandlerWriter(channel.getAsyncIn());
-        ctx.fireChannelActive();
-        channel.onClose(() -> disconnect(ctx, ctx.newPromise()));
-    }
-
     private synchronized void handleSshSetupFailure(final ChannelHandlerContext ctx, final Throwable error) {
         LOG.warn("Unable to setup SSH connection on channel: {}", ctx.channel(), error);
 
@@ -219,7 +207,19 @@ public class AsyncSshHandler extends ChannelOutboundHandlerAdapter {
             return;
         }
 
-        handleSshChanelOpened(ctx);
+        onOpenComplete(ctx);
+    }
+
+    private synchronized void onOpenComplete(final ChannelHandlerContext ctx) {
+        LOG.trace("SSH subsystem channel opened successfully on channel: {}", ctx.channel());
+
+        if (negotiationFuture == null) {
+            connectPromise.setSuccess();
+        }
+
+        sshWriteAsyncHandler = new AsyncSshHandlerWriter(channel.getAsyncIn());
+        ctx.fireChannelActive();
+        channel.onClose(() -> disconnect(ctx, ctx.newPromise()));
     }
 
     @Override