[ 
https://issues.apache.org/jira/browse/SSHD-204?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13547754#comment-13547754
 ] 

Kohsuke Kawaguchi commented on SSHD-204:
----------------------------------------

The key addition in this patch is ChannelDataReceiver, which defines callback 
for data received from the client. This method almost feels like OutputStream, 
except a crucial difference of the return value, which is used for the flow 
control purpose.

A ChannelSession now owns an ChannelDataReceiver and it feeds the data into it. 
To maintain the backward compatibility, I added an implementation of 
ChannelDataReceiver that uses a pipe to spool bytes and pass this to 
Command.setInputStream().

Finally, to install a ChannelDataReceiver and to participate in the flow 
control, a Command now needs to have access to ChannelSession. I've done this 
by adding the ChannelSessionAware interface, by following the lead of the 
SessionAware interface.
                
> [PATCH] Provide callback-driven I/O mechanism for Command
> ---------------------------------------------------------
>
>                 Key: SSHD-204
>                 URL: https://issues.apache.org/jira/browse/SSHD-204
>             Project: MINA SSHD
>          Issue Type: Improvement
>    Affects Versions: 0.8.0
>            Reporter: Kohsuke Kawaguchi
>         Attachments: SSHD-204.patch
>
>
> In the current abstraction, the Command interface receives InputStream to 
> read the data from the client, which means I pretty much have to allocate a 
> thread to drain this. Look at MINA's own InvertedShellWrapper, which does 
> exactly this.
> This is often rather inefficient, especially given that MINA SSHD delivers 
> the data from the client to ChannelSession as callbacks. To fix this, it 
> should allow Command to receive these callbacks. This would allow me to 
> further chain other asynchronous IO (such as socket connection to other 
> servers behind) and implement my Command in a truly asynchronous fashion.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to