Eugeny/russh

[Server-side] Turn an exec_request into a Channel

edgarogh opened this issue · 3 comments

Hello, I'd like to process an (unique) SSH channel in a separate tokio task, for simplicity, and the Channel type would be perfect for that.

But I don't understand how I can use it from the server side, from a given ChannelId, since none of the functions that return a Channel can be parameterized with an existing ID.

As an alternative, I've considered implementing my own alternative to Channel that relies on the usual russh::server::Handler methods, but a few Session methods, like Session::flush_pending, can't be called on a Handle to that session.

Thank you in advance!

I'm not sure I follow - normally you'd just take the channel and session.handle() from one of the Handler::channel_open_* methods and move them into a tokio task - could you explain your case in more detail?

There should also almost never be a need to manually call protocol handling functions like flush_pending that aren't available on a Handle

Ohh, I completely missed the fact I could implement Handler::channel_open_session, it gives me exactly the Channel I need. I think I got confused between Handle and Handler while browsing through rustdoc (I understand what they are but might have misread one for the other).
Thank you! Have a great day.

Right, the Handle method you're thinking about is for opening a server-to-client channel (a non-standard protocol extension) :)