Code Review
/
controller.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Merge "Bug:1238 - Revert changes to SshClientAdapter."
[controller.git]
/
opendaylight
/
netconf
/
netconf-netty-util
/
src
/
main
/
java
/
org
/
opendaylight
/
controller
/
netconf
/
nettyutil
/
handler
/
ssh
/
client
/
SshClientAdapter.java
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 cf4ec213c296bbd103dfe75f7650670b008aa041..ad8b25ff2156d8e937d65d054b41b1e3f34c159e 100644
(file)
--- 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
@@
-52,15
+52,8
@@
public class SshClientAdapter implements Runnable {
}
public void run() {
}
public void run() {
- SshSession session;
- try {
- session = sshClient.openSession();
- } catch (IOException e) {
- logger.error("Cannot establish session", e);
- sshClient.close();
- return;
- }
try {
try {
+ SshSession session = sshClient.openSession();
invoker.invoke(session);
InputStream stdOut = session.getStdout();
session.getStderr();
invoker.invoke(session);
InputStream stdOut = session.getStdout();
session.getStderr();
@@
-90,6
+83,8
@@
public class SshClientAdapter implements Runnable {
} catch (VirtualSocketException e) {
// Netty closed connection prematurely.
} 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) {
logger.error("Unexpected exception", e);
// Just pass and move on.
} catch (Exception e) {
logger.error("Unexpected exception", e);
@@
-117,6
+112,7
@@
public class SshClientAdapter implements Runnable {
private void writeImpl(ByteBuf message) throws IOException {
message.getBytes(0, stdIn, message.readableBytes());
private void writeImpl(ByteBuf message) throws IOException {
message.getBytes(0, stdIn, message.readableBytes());
+ message.release();
stdIn.flush();
}
stdIn.flush();
}