From 2610ec1df534fed79964b764dba8a656ae950aee Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Tue, 18 Oct 2022 10:58:35 +0200 Subject: [PATCH 1/1] Remove AsyncSshHandler.handleSshChanelOpened() 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 --- .../handler/ssh/client/AsyncSshHandler.java | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/ssh/client/AsyncSshHandler.java b/netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/ssh/client/AsyncSshHandler.java index 36cc81d6cf..0934720948 100644 --- a/netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/ssh/client/AsyncSshHandler.java +++ b/netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/ssh/client/AsyncSshHandler.java @@ -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 -- 2.36.6