libssh2_session_block_directions returning zero

Peter Stuge peter at stuge.se
Mon Jan 10 04:52:19 CET 2022


Jente Hidskes via libssh2-devel wrote:
> Working on a small SFTP client, I am running into the situation where
> libssh2_session_block_directions returns zero. According to the
> documentation[0], libssh2_session_block_directions returns a bitmask
> of LIBSSH2_SESSION_BLOCK_INBOUND and LIBSSH2_SESSION_BLOCK_OUTBOUND
> and tells us what to do in case either or both of these are set. What
> is the right thing to do in case neither is set, or am I doing
> something wrong and this function should never return zero?

According to the documentation it makes sense if it would return zero
in case previous libssh2 calls did *not* return LIBSSH2_ERROR_EAGAIN.

The purpose of libssh2_session_block_directions() is to learn what
libssh2 wants to do next, in which direction it wants data.

If you call the function when there is no pending data then 0 makes
sense to me. Doing so isn't strictly an error but possibly broken
logic in your client..?


//Peter


More information about the libssh2-devel mailing list