On Thursday, July 18, 2019 2:13:59 PM CEST Игорь Коваленко wrote:
> Hello!
Hi Igor,
> I'm developing ssh-server and I need that one session can create two
> channels - one with sftp subsystem and one with shell subsystem.
> These channels have to work simultaneously. Shell subsystem must process
> special commands from user and simultaneously user could transfer files.
> Documentation says "You cannot use a single session (or channels for a
> single session) in several threads at the same time."
> Does this mean that I need to do tasks for both of my channels in one
> thread and I need some kind of scheduling between them?
Yes, those channels need to be handled in the same thread. libssh is only
thread safe on a per session basis. Normally your server should be callback
based, so they are handled async anyway.
> Or is it better to create different sessions for shell and for sftp tasks?
You don't have to.
Andreas
--
Andreas Schneider [email protected]
GPG-ID: 8DFF53E18F2ABC8D8F3C92237EE0FC4DCC014E3D