libssh2_session_block_directions() which returns a bitmask for what
directions the connection blocks. It is to be used applications that use
non-blocking sockets and when a libssh2 function returns
LIBSSH2_ERROR_EAGAIN this function can be used to figure out in which
direction the socket would block and thus it can wait for the socket to
again be ready for communication in that direction before it calls libssh2
again.
pains in apps relying on it, but it is broken by design and we should not
rely on it at all. Go for the LIBSSH2_VERSION_* defines instead if you need
to check for versions.
the making of the release archive.
Added 'maketgz' as a script to build release archives with, including automated
snapshots or whatever. It updates the defines in include/libssh2.h.
configure now extracts the version number from the include/libssh2.h header in
the source tree instead of using it fixed set in the script (to remove the
need for regenerating the configure script when we run maketgz).
Makefile.am now has a dist-hook that puts ".dist" files in the release tree
instead of the file without the .dist extension, so that we can easily add
modified files in release archives. Like maketgz.
calling functions to support that with the following API notes:
* libssh2_publickey_shutdown(), libssh2_session_free() changed
to return an "int" to allow signaling of LIBSSH2_ERROR_EAGAIN.
* libssh2_scp_recv(), libssh2_scp_send_ex() and libssh2_sftp_init()
will loop in on libssh2_channel_free() when there is an error.
It is not possible to return LIBSSH2_ERROR_EAGAIN in this condition
in these 3 functions and not lose the original error code.
Functions that return an "int", and friends, return LIBSSH2SFTP_EAGAIN.
Functions that return a structure return NULL and set the error to
LIBSSH2_ERROR_EAGAIN
all the way up to the user interface. All code modules bug sftp.c have
been completed.
Functions that return an "int", or similar return LIBSSH2CHANNEL_EAGAIN to
indicate some part of the call would block, in non-blocking mode.
Functions that return a structure, like "LIBSSH2_CHANNEL *", return NULL
and set the libssh2 error. The error can be obtained with either
libssh2_session_last_error() or libssh2_session_last_errno(). Either of
these will return the error code of LIBSSH2_ERROR_EAGAIN if the
call would block, in non-blocking mode.
The current state of a function and some variable are keep in the
structures so that on the next call the operation that would block can
be retried again with the same data.
the recent commits converted the tabs to 4 spaces, which matched the
initial indent size. Other commits converted the tabs to 8 spaces, this
didn't match.
All the code has been converted to 4 space indents. No changes to line
lengths or actual code was performed. This is in preperation to my up
coming non-blocking work so my commits should only be code changes and
line lengths in the code I am working on.
* The following low level packet routines now fully support non-blocking:
libssh2_sftp_packet_read()
libssh2_sftp_packet_ask()
libssh2_sftp_packet_require()
libssh2_sftp_packet_requirev()
* libssh2_sftp_readdirnb() functions completely in non-blocking mode
* The rest of the routines which call the libssh2_sftp_packet_* routine
loop on a return code of PACKET_EAGAIN. This maintains the current
functionality until they fully support non-blocking
* The state of all function are labeled with either NB-SAFE or NB-UNSAFE,
for those that are know. NB-UNSAFE?? for those that haven't been
examined.
various stuff if libssh2 was built with debug. If built without debug, the
function does nothing.
2 - configure --enable-debug is now enough to build a debug version (including
picky compiler options)
3 - internally, we no longer need/use #ifdef/#endif around all uses of the
_libssh2_debug() function/macro.
The scp.c example is the first application to test this new debug logging.
blocking way. The channel code is now responsible for enabling/disabling
blocking status and to work with it.
I've also modified indenting and fixed compiler warnings at places, and
added a bunch of new examples in example/simple that I've used to verify that
the code still runs like before.
libssh2_channel_{read|write}nb_ex() and libssh2_sftp_{read|write}nb() are the
four new functions that supposedly work non-blocking.
include/ into the src/ directory. The include/ dir is now strictly for public
headers.
Also, I removed the special win32 source package creation target in the
makefile and I modified the contact email address in configure.in to point out
the libssh2-devel list.
The convience functions pass in the return from strlen() which is "size_t",
usually an "unsigned long". This created the possiblility of passing in
a value that could look negative.
All "int" lengths were converted to "unsigned int". Ideally they should
all become "size_t", but that is a bigger change. This is a good start.