X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fnetconf%2Fnetconf-netty-util%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fnettyutil%2Fhandler%2Fssh%2Fclient%2FSshClientAdapter.java;h=ad8b25ff2156d8e937d65d054b41b1e3f34c159e;hb=81bbe76bd26399118d028663d08e464ce6b7d040;hp=87056db06c23aef8de11c2fe80d919fffbade208;hpb=b78e63501576638e1f000fd46663f8c42340f9e2;p=controller.git diff --git a/opendaylight/netconf/netconf-netty-util/src/main/java/org/opendaylight/controller/netconf/nettyutil/handler/ssh/client/SshClientAdapter.java b/opendaylight/netconf/netconf-netty-util/src/main/java/org/opendaylight/controller/netconf/nettyutil/handler/ssh/client/SshClientAdapter.java index 87056db06c..ad8b25ff21 100644 --- a/opendaylight/netconf/netconf-netty-util/src/main/java/org/opendaylight/controller/netconf/nettyutil/handler/ssh/client/SshClientAdapter.java +++ b/opendaylight/netconf/netconf-netty-util/src/main/java/org/opendaylight/controller/netconf/nettyutil/handler/ssh/client/SshClientAdapter.java @@ -12,7 +12,6 @@ import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelPromise; - import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; @@ -20,6 +19,8 @@ import java.util.LinkedList; import java.util.Queue; import java.util.concurrent.atomic.AtomicBoolean; import org.opendaylight.controller.netconf.nettyutil.handler.ssh.virtualsocket.VirtualSocketException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** @@ -27,6 +28,8 @@ import org.opendaylight.controller.netconf.nettyutil.handler.ssh.virtualsocket.V * pipeline. */ public class SshClientAdapter implements Runnable { + private static final Logger logger = LoggerFactory.getLogger(SshClientAdapter.class); + private static final int BUFFER_SIZE = 1024; private final SshClient sshClient; @@ -80,9 +83,11 @@ public class SshClientAdapter implements Runnable { } catch (VirtualSocketException e) { // Netty closed connection prematurely. + // Or maybe tried to open ganymed connection without having initialized session + // (ctx.channel().remoteAddress() is null) // Just pass and move on. } catch (Exception e) { - throw new IllegalStateException(e); + logger.error("Unexpected exception", e); } finally { sshClient.close(); @@ -107,6 +112,7 @@ public class SshClientAdapter implements Runnable { private void writeImpl(ByteBuf message) throws IOException { message.getBytes(0, stdIn, message.readableBytes()); + message.release(); stdIn.flush(); }