Subject: Re: Using libSSH2 in fiber-based parallel system

Re: Using libSSH2 in fiber-based parallel system

From: Jakob Egger <>
Date: Wed, 15 Oct 2014 06:36:47 +0200

No need to use private functions. Just use non-blocking mode.

Use libssh2_session_init, then use libssh2_session_set_blocking to enable non-blocking mode, and then call libssh2_session_handshake repeatedly until it no longer returns LIBSSH2_ERROR_EAGAIN

I'm not aware of how fibers work, but I guess you would call yield() inbetween libssh2 API calls.

(I tried to send this email yesterday, but used the wrong from-address, and the list server seems to have ignored it.)

> Am 13.10.2014 um 12:55 schrieb Martin DraĆĄar <>:
> Hi,
> I have a program that uses fibers as a mean for parallelism and would
> like to use libssh2 in it. However, some of these functions seem more
> apt for thread-based parallelism. I have in mind functions using e.g.
> the BLOCK_ADJUST macros.
> So I just want to ask you, if the following approach I want to use is
> the correct one. Instead of calling libssh2_session_handshake I have
> this cycle that is basically BLOCK_ADJUST sans keepalive:
> while (socket not read or written to)
> {
> session_startup(session, socket);
> yield(); // Pass execution to another fiber
> }
> I ask, because the session_startup function is not exported into public API.
> Thanks.
> Martin
> _______________________________________________
> libssh2-devel

Received on 2014-10-15