[
https://issues.apache.org/jira/browse/SSHD-136?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13280016#comment-13280016
]
Guillaume Nodet commented on SSHD-136:
--------------------------------------
One real problem is that such a solution leads to requirements on the
InputStream / OutputStreams used: the InputStream#available() method has to
report accurate data, but more importantantly, there's no way to know when the
stream is finished or not.
{code}
public boolean pump() {
try {
if (!closeFuture.isClosed()) {
int len = Math.min(in.available(),
remoteWindow.getPacketSize());
if (len > 0 && remoteWindow.consumeIfAvailable(len)) {
Buffer buffer =
session.createBuffer(SshConstants.Message.SSH_MSG_CHANNEL_DATA, 0);
buffer.putInt(recipient);
buffer.putInt(len);
int wpos = buffer.wpos(); // keep buffer position for data
write
buffer.wpos(wpos + remoteWindow.getPacketSize()); // Make
room
securedRead(in, buffer.array(), wpos, len); // read data
into buffer
log.debug("Send SSH_MSG_CHANNEL_DATA on channel {}", id);
session.writePacket(buffer);
return true;
}
}
} catch (Exception e) {
if (!closing) {
log.info("Caught exception", e);
close(false);
}
}
return false;
}
{code}
The above code has the mentioned problem, because eof() is not sent anymore.
I think for the proposed logic to work, we need to use enhanced interfaces
instead of InputStream / OutputStream (making sure we have a way to detect real
eof).
> Reduce consumption of ClientInputStreamPump threads and NioProcessor threads.
> ------------------------------------------------------------------------------
>
> Key: SSHD-136
> URL: https://issues.apache.org/jira/browse/SSHD-136
> Project: MINA SSHD
> Issue Type: Improvement
> Affects Versions: 0.5.0
> Reporter: Alexey Polbitsyn
> Attachments: SSHD-136.patch, src-diff.zip, src.zip
>
>
> When using the library to work with 1000 concurrent ssh connections, it
> takes 1000 ClientInputStreamPump threads. 1 thread for 1 channel. It would be
> nice to be able to configure this behavior, for example use 1
> ClientInputStreamPump for all channels of sshclient or session.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira