Author: gnodet
Date: Sat May 19 12:10:16 2012
New Revision: 1340427
URL: http://svn.apache.org/viewvc?rev=1340427&view=rev
Log:
[SSHD-164] Allow the buffer size for the IO pumps to be configurable in
InvertedShellWrapper
Modified:
mina/sshd/trunk/sshd-core/src/main/java/org/apache/sshd/server/shell/InvertedShellWrapper.java
Modified:
mina/sshd/trunk/sshd-core/src/main/java/org/apache/sshd/server/shell/InvertedShellWrapper.java
URL:
http://svn.apache.org/viewvc/mina/sshd/trunk/sshd-core/src/main/java/org/apache/sshd/server/shell/InvertedShellWrapper.java?rev=1340427&r1=1340426&r2=1340427&view=diff
==============================================================================
---
mina/sshd/trunk/sshd-core/src/main/java/org/apache/sshd/server/shell/InvertedShellWrapper.java
(original)
+++
mina/sshd/trunk/sshd-core/src/main/java/org/apache/sshd/server/shell/InvertedShellWrapper.java
Sat May 19 12:10:16 2012
@@ -37,7 +37,11 @@ import org.apache.sshd.server.ExitCallba
*/
public class InvertedShellWrapper implements Command {
+ /** default buffer size for the IO pumps. */
+ public static final int DEFAULT_BUFFER_SIZE = 8192;
+
private final InvertedShell shell;
+ private final int bufferSize;
private InputStream in;
private OutputStream out;
private OutputStream err;
@@ -48,7 +52,12 @@ public class InvertedShellWrapper implem
private Thread thread;
public InvertedShellWrapper(InvertedShell shell) {
+ this(shell, DEFAULT_BUFFER_SIZE);
+ }
+
+ public InvertedShellWrapper(InvertedShell shell, int bufferSize) {
this.shell = shell;
+ this.bufferSize = bufferSize;
}
public void setInputStream(InputStream in) {
@@ -91,7 +100,7 @@ public class InvertedShellWrapper implem
// Use a single thread to correctly sequence the output and error
streams.
// If any bytes are available from the output stream, send them
first, then
// check the error stream, or wait until more data is available.
- byte[] buffer = new byte[512];
+ byte[] buffer = new byte[bufferSize];
for (;;) {
if (!shell.isAlive()) {
callback.onExit(shell.exitValue());