aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/src/main/java/com/trilead/ssh2/channel/DynamicAcceptThread.java2
-rw-r--r--lib/src/main/java/com/trilead/ssh2/channel/LocalAcceptThread.java2
-rw-r--r--lib/src/main/java/com/trilead/ssh2/channel/RemoteAcceptThread.java2
-rw-r--r--lib/src/main/java/com/trilead/ssh2/channel/RemoteX11AcceptThread.java2
-rw-r--r--lib/src/main/java/com/trilead/ssh2/channel/StreamForwarder.java21
5 files changed, 15 insertions, 14 deletions
diff --git a/lib/src/main/java/com/trilead/ssh2/channel/DynamicAcceptThread.java b/lib/src/main/java/com/trilead/ssh2/channel/DynamicAcceptThread.java
index f3c8b07..ef3a3d0 100644
--- a/lib/src/main/java/com/trilead/ssh2/channel/DynamicAcceptThread.java
+++ b/lib/src/main/java/com/trilead/ssh2/channel/DynamicAcceptThread.java
@@ -202,7 +202,7 @@ public class DynamicAcceptThread extends Thread implements IChannelWorkerThread
}
try {
- r2l = new StreamForwarder(cn, null, null, cn.stdoutStream, out, "RemoteToLocal");
+ r2l = new StreamForwarder(cn, null, sock, cn.stdoutStream, out, "RemoteToLocal");
l2r = new StreamForwarder(cn, r2l, sock, in, cn.stdinStream, "LocalToRemote");
} catch (IOException e) {
try {
diff --git a/lib/src/main/java/com/trilead/ssh2/channel/LocalAcceptThread.java b/lib/src/main/java/com/trilead/ssh2/channel/LocalAcceptThread.java
index 1b08d9c..885b41f 100644
--- a/lib/src/main/java/com/trilead/ssh2/channel/LocalAcceptThread.java
+++ b/lib/src/main/java/com/trilead/ssh2/channel/LocalAcceptThread.java
@@ -96,7 +96,7 @@ public class LocalAcceptThread extends Thread implements IChannelWorkerThread
try
{
- r2l = new StreamForwarder(cn, null, null, cn.stdoutStream, s.getOutputStream(), "RemoteToLocal");
+ r2l = new StreamForwarder(cn, null, s, cn.stdoutStream, s.getOutputStream(), "RemoteToLocal");
l2r = new StreamForwarder(cn, r2l, s, s.getInputStream(), cn.stdinStream, "LocalToRemote");
}
catch (IOException e)
diff --git a/lib/src/main/java/com/trilead/ssh2/channel/RemoteAcceptThread.java b/lib/src/main/java/com/trilead/ssh2/channel/RemoteAcceptThread.java
index 1ca9d76..8b97b55 100644
--- a/lib/src/main/java/com/trilead/ssh2/channel/RemoteAcceptThread.java
+++ b/lib/src/main/java/com/trilead/ssh2/channel/RemoteAcceptThread.java
@@ -52,7 +52,7 @@ public class RemoteAcceptThread extends Thread
s = new Socket(targetAddress, targetPort);
- StreamForwarder r2l = new StreamForwarder(c, null, null, c.getStdoutStream(), s.getOutputStream(),
+ StreamForwarder r2l = new StreamForwarder(c, null, s, c.getStdoutStream(), s.getOutputStream(),
"RemoteToLocal");
StreamForwarder l2r = new StreamForwarder(c, null, null, s.getInputStream(), c.getStdinStream(),
"LocalToRemote");
diff --git a/lib/src/main/java/com/trilead/ssh2/channel/RemoteX11AcceptThread.java b/lib/src/main/java/com/trilead/ssh2/channel/RemoteX11AcceptThread.java
index 8ee05a2..34ce51f 100644
--- a/lib/src/main/java/com/trilead/ssh2/channel/RemoteX11AcceptThread.java
+++ b/lib/src/main/java/com/trilead/ssh2/channel/RemoteX11AcceptThread.java
@@ -191,7 +191,7 @@ public class RemoteX11AcceptThread extends Thread
/* Start forwarding traffic */
- StreamForwarder r2l = new StreamForwarder(c, null, null, remote_is, x11_os, "RemoteToX11");
+ StreamForwarder r2l = new StreamForwarder(c, null, s, remote_is, x11_os, "RemoteToX11");
StreamForwarder l2r = new StreamForwarder(c, null, null, x11_is, remote_os, "X11ToRemote");
/* No need to start two threads, one can be executed in the current thread */
diff --git a/lib/src/main/java/com/trilead/ssh2/channel/StreamForwarder.java b/lib/src/main/java/com/trilead/ssh2/channel/StreamForwarder.java
index 376a3a0..7e54efb 100644
--- a/lib/src/main/java/com/trilead/ssh2/channel/StreamForwarder.java
+++ b/lib/src/main/java/com/trilead/ssh2/channel/StreamForwarder.java
@@ -17,13 +17,13 @@ import java.net.Socket;
*/
public class StreamForwarder extends Thread
{
- OutputStream os;
- InputStream is;
- byte[] buffer = new byte[Channel.CHANNEL_BUFFER_SIZE];
- Channel c;
- StreamForwarder sibling;
- Socket s;
- String mode;
+ final OutputStream os;
+ final InputStream is;
+ final byte[] buffer = new byte[Channel.CHANNEL_BUFFER_SIZE];
+ final Channel c;
+ final StreamForwarder sibling;
+ final Socket s;
+ final String mode;
StreamForwarder(Channel c, StreamForwarder sibling, Socket s, InputStream is, OutputStream os, String mode)
throws IOException
@@ -97,11 +97,12 @@ public class StreamForwarder extends Thread
catch (IOException e3)
{
}
+ }
+ if (s != null) {
try
{
- if (s != null)
- s.close();
+ s.close();
}
catch (IOException e1)
{
@@ -109,4 +110,4 @@ public class StreamForwarder extends Thread
}
}
}
-} \ No newline at end of file
+}